Unresolved link -> incompatible link kind
Clearly it has been resolved, because we say on the next line what it resolved to.
This commit is contained in:
parent
444f5a0556
commit
fc273a035d
3 changed files with 21 additions and 22 deletions
|
@ -777,7 +777,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
|
||||||
(_, Some(Disambiguator::Kind(expected))) if kind == expected => {}
|
(_, Some(Disambiguator::Kind(expected))) if kind == expected => {}
|
||||||
(_, Some(expected)) => {
|
(_, Some(expected)) => {
|
||||||
// The resolved item did not match the disambiguator; give a better error than 'not found'
|
// The resolved item did not match the disambiguator; give a better error than 'not found'
|
||||||
let msg = format!("unresolved link to `{}`", path_str);
|
let msg = format!("incompatible link kind for `{}`", path_str);
|
||||||
report_diagnostic(cx, &msg, &item, &dox, link_range, |diag, sp| {
|
report_diagnostic(cx, &msg, &item, &dox, link_range, |diag, sp| {
|
||||||
// HACK(jynelson): by looking at the source I saw the DefId we pass
|
// HACK(jynelson): by looking at the source I saw the DefId we pass
|
||||||
// for `expected.descr()` doesn't matter, since it's not a crate
|
// for `expected.descr()` doesn't matter, since it's not a crate
|
||||||
|
@ -787,7 +787,6 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
|
||||||
diag.note(¬e);
|
diag.note(¬e);
|
||||||
if let Some(sp) = sp {
|
if let Some(sp) = sp {
|
||||||
diag.span_suggestion(sp, &help_msg, suggestion, Applicability::MaybeIncorrect);
|
diag.span_suggestion(sp, &help_msg, suggestion, Applicability::MaybeIncorrect);
|
||||||
diag.set_sort_span(sp);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -12,52 +12,52 @@ const c: usize = 0;
|
||||||
trait T {}
|
trait T {}
|
||||||
|
|
||||||
/// Link to [struct@S]
|
/// Link to [struct@S]
|
||||||
//~^ ERROR unresolved link to `S`
|
//~^ ERROR incompatible link kind for `S`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [mod@S]
|
/// Link to [mod@S]
|
||||||
//~^ ERROR unresolved link to `S`
|
//~^ ERROR incompatible link kind for `S`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [union@S]
|
/// Link to [union@S]
|
||||||
//~^ ERROR unresolved link to `S`
|
//~^ ERROR incompatible link kind for `S`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [trait@S]
|
/// Link to [trait@S]
|
||||||
//~^ ERROR unresolved link to `S`
|
//~^ ERROR incompatible link kind for `S`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [struct@T]
|
/// Link to [struct@T]
|
||||||
//~^ ERROR unresolved link to `T`
|
//~^ ERROR incompatible link kind for `T`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [derive@m]
|
/// Link to [derive@m]
|
||||||
//~^ ERROR unresolved link to `m`
|
//~^ ERROR incompatible link kind for `m`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [const@s]
|
/// Link to [const@s]
|
||||||
//~^ ERROR unresolved link to `s`
|
//~^ ERROR incompatible link kind for `s`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [static@c]
|
/// Link to [static@c]
|
||||||
//~^ ERROR unresolved link to `c`
|
//~^ ERROR incompatible link kind for `c`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [fn@c]
|
/// Link to [fn@c]
|
||||||
//~^ ERROR unresolved link to `c`
|
//~^ ERROR incompatible link kind for `c`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
|
|
||||||
/// Link to [c()]
|
/// Link to [c()]
|
||||||
//~^ ERROR unresolved link to `c`
|
//~^ ERROR incompatible link kind for `c`
|
||||||
//~| NOTE this link resolved
|
//~| NOTE this link resolved
|
||||||
//~| HELP use its disambiguator
|
//~| HELP use its disambiguator
|
||||||
pub fn f() {}
|
pub fn f() {}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error: unresolved link to `S`
|
error: incompatible link kind for `S`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:14:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:14:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [struct@S]
|
LL | /// Link to [struct@S]
|
||||||
|
@ -11,7 +11,7 @@ LL | #![deny(broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: this link resolved to an enum, which is not a struct
|
= note: this link resolved to an enum, which is not a struct
|
||||||
|
|
||||||
error: unresolved link to `S`
|
error: incompatible link kind for `S`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:19:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:19:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [mod@S]
|
LL | /// Link to [mod@S]
|
||||||
|
@ -19,7 +19,7 @@ LL | /// Link to [mod@S]
|
||||||
|
|
|
|
||||||
= note: this link resolved to an enum, which is not a module
|
= note: this link resolved to an enum, which is not a module
|
||||||
|
|
||||||
error: unresolved link to `S`
|
error: incompatible link kind for `S`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:24:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:24:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [union@S]
|
LL | /// Link to [union@S]
|
||||||
|
@ -27,7 +27,7 @@ LL | /// Link to [union@S]
|
||||||
|
|
|
|
||||||
= note: this link resolved to an enum, which is not a union
|
= note: this link resolved to an enum, which is not a union
|
||||||
|
|
||||||
error: unresolved link to `S`
|
error: incompatible link kind for `S`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:29:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:29:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [trait@S]
|
LL | /// Link to [trait@S]
|
||||||
|
@ -35,7 +35,7 @@ LL | /// Link to [trait@S]
|
||||||
|
|
|
|
||||||
= note: this link resolved to an enum, which is not a trait
|
= note: this link resolved to an enum, which is not a trait
|
||||||
|
|
||||||
error: unresolved link to `T`
|
error: incompatible link kind for `T`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:34:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:34:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [struct@T]
|
LL | /// Link to [struct@T]
|
||||||
|
@ -43,7 +43,7 @@ LL | /// Link to [struct@T]
|
||||||
|
|
|
|
||||||
= note: this link resolved to a trait, which is not a struct
|
= note: this link resolved to a trait, which is not a struct
|
||||||
|
|
||||||
error: unresolved link to `m`
|
error: incompatible link kind for `m`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:39:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:39:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [derive@m]
|
LL | /// Link to [derive@m]
|
||||||
|
@ -51,7 +51,7 @@ LL | /// Link to [derive@m]
|
||||||
|
|
|
|
||||||
= note: this link resolved to a macro, which is not a derive macro
|
= note: this link resolved to a macro, which is not a derive macro
|
||||||
|
|
||||||
error: unresolved link to `s`
|
error: incompatible link kind for `s`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:44:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:44:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [const@s]
|
LL | /// Link to [const@s]
|
||||||
|
@ -59,7 +59,7 @@ LL | /// Link to [const@s]
|
||||||
|
|
|
|
||||||
= note: this link resolved to a static, which is not a constant
|
= note: this link resolved to a static, which is not a constant
|
||||||
|
|
||||||
error: unresolved link to `c`
|
error: incompatible link kind for `c`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:49:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:49:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [static@c]
|
LL | /// Link to [static@c]
|
||||||
|
@ -67,7 +67,7 @@ LL | /// Link to [static@c]
|
||||||
|
|
|
|
||||||
= note: this link resolved to a constant, which is not a static
|
= note: this link resolved to a constant, which is not a static
|
||||||
|
|
||||||
error: unresolved link to `c`
|
error: incompatible link kind for `c`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:54:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:54:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [fn@c]
|
LL | /// Link to [fn@c]
|
||||||
|
@ -75,7 +75,7 @@ LL | /// Link to [fn@c]
|
||||||
|
|
|
|
||||||
= note: this link resolved to a constant, which is not a function
|
= note: this link resolved to a constant, which is not a function
|
||||||
|
|
||||||
error: unresolved link to `c`
|
error: incompatible link kind for `c`
|
||||||
--> $DIR/intra-links-disambiguator-mismatch.rs:59:14
|
--> $DIR/intra-links-disambiguator-mismatch.rs:59:14
|
||||||
|
|
|
|
||||||
LL | /// Link to [c()]
|
LL | /// Link to [c()]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue