Commit Graph

8 Commits

Author SHA1 Message Date
Joshua Nelson
418f6089e9 Give a better error message when linking to a macro with the wrong disambiguator
Before:

```
warning: unresolved link to `m`
 --> m.rs:1:6
  |
1 | /// [value@m]
  |      ^^^^^^^
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = note: no item named `m` is in scope
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
```

After:

```
warning: unresolved link to `m`
 --> m.rs:1:6
  |
1 | /// [value@m]
  |      ^^^^^^^ help: to link to the macro, use its disambiguator: `m!`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
  = note: this link resolves to the macro `m`, which is not in the value namespace
```
2020-09-05 13:48:19 -04:00
Joshua Nelson
e2d69f2eb1 Make errors more concise and helpful
Before:
```
   = note: this link partially resolves to the struct `S`
   = note: no `fmt` in `S`
```

After:
```
   = note: the struct `S` has no field or associated item named `fmt`
```
2020-09-05 13:48:19 -04:00
Joshua Nelson
7b8d0befd6 Remove some TODOs 2020-09-05 13:48:19 -04:00
Joshua Nelson
002d3a922c Don't give misleading errors for f::A, where f is in the value namespace 2020-09-05 13:48:19 -04:00
Joshua Nelson
f4e6ebd11a Fix tests and improve error message if :: isn't found 2020-09-05 13:48:19 -04:00
Joshua Nelson
42bed03500 Pass on the DefId so rustdoc can name it in suggestions
Look at this beauty:

```rust
error: unresolved link to `S::h`
  --> intra-link-errors.rs:51:6
   |
51 | /// [type@S::h]
   |      ^^^^^^^^^ help: to link to the associated function, use its disambiguator: `S::h()`
   |
   = note: this link resolves to the associated function `h`, which is not in the type namespace
```
2020-09-05 13:48:19 -04:00
Joshua Nelson
fcb21999a7 Report if the thing exists in another namespace 2020-09-05 13:48:19 -04:00
Joshua Nelson
3797f29aad [WIP] give better errors for broken intra doc links 2020-09-05 13:48:19 -04:00