mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Rollup merge of #104052 - TaKO8Ki:fix-103997, r=notriddle
Fix `resolution_failure` ICE Fixes #103997
This commit is contained in:
commit
498efa6273
@ -402,6 +402,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
|
||||
})
|
||||
.and_then(|self_id| match tcx.def_kind(self_id) {
|
||||
DefKind::Impl => self.def_id_to_res(self_id),
|
||||
DefKind::Use => None,
|
||||
def_kind => Some(Res::Def(def_kind, self_id)),
|
||||
})
|
||||
}
|
||||
@ -1772,7 +1773,6 @@ fn resolution_failure(
|
||||
|
||||
// Otherwise, it must be an associated item or variant
|
||||
let res = partial_res.expect("None case was handled by `last_found_module`");
|
||||
let name = res.name(tcx);
|
||||
let kind = match res {
|
||||
Res::Def(kind, _) => Some(kind),
|
||||
Res::Primitive(_) => None,
|
||||
@ -1814,6 +1814,7 @@ fn resolution_failure(
|
||||
} else {
|
||||
"associated item"
|
||||
};
|
||||
let name = res.name(tcx);
|
||||
let note = format!(
|
||||
"the {} `{}` has no {} named `{}`",
|
||||
res.descr(),
|
||||
|
6
src/test/rustdoc-ui/issue-103997.rs
Normal file
6
src/test/rustdoc-ui/issue-103997.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// check-pass
|
||||
|
||||
pub fn foo() {}
|
||||
|
||||
/// [`foo`](Self::foo) //~ WARNING unresolved link to `Self::foo`
|
||||
pub use foo as bar;
|
10
src/test/rustdoc-ui/issue-103997.stderr
Normal file
10
src/test/rustdoc-ui/issue-103997.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
warning: unresolved link to `Self::foo`
|
||||
--> $DIR/issue-103997.rs:5:13
|
||||
|
|
||||
LL | /// [`foo`](Self::foo)
|
||||
| ^^^^^^^^^ no item named `Self` in scope
|
||||
|
|
||||
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
Loading…
Reference in New Issue
Block a user