Skip to content

Commit 498efa6

Browse files
authored
Rollup merge of rust-lang#104052 - TaKO8Ki:fix-103997, r=notriddle
Fix `resolution_failure` ICE Fixes rust-lang#103997
2 parents f0bd2cd + 6b2257b commit 498efa6

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
402402
})
403403
.and_then(|self_id| match tcx.def_kind(self_id) {
404404
DefKind::Impl => self.def_id_to_res(self_id),
405+
DefKind::Use => None,
405406
def_kind => Some(Res::Def(def_kind, self_id)),
406407
})
407408
}
@@ -1772,7 +1773,6 @@ fn resolution_failure(
17721773

17731774
// Otherwise, it must be an associated item or variant
17741775
let res = partial_res.expect("None case was handled by `last_found_module`");
1775-
let name = res.name(tcx);
17761776
let kind = match res {
17771777
Res::Def(kind, _) => Some(kind),
17781778
Res::Primitive(_) => None,
@@ -1814,6 +1814,7 @@ fn resolution_failure(
18141814
} else {
18151815
"associated item"
18161816
};
1817+
let name = res.name(tcx);
18171818
let note = format!(
18181819
"the {} `{}` has no {} named `{}`",
18191820
res.descr(),

src/test/rustdoc-ui/issue-103997.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// check-pass
2+
3+
pub fn foo() {}
4+
5+
/// [`foo`](Self::foo) //~ WARNING unresolved link to `Self::foo`
6+
pub use foo as bar;
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
warning: unresolved link to `Self::foo`
2+
--> $DIR/issue-103997.rs:5:13
3+
|
4+
LL | /// [`foo`](Self::foo)
5+
| ^^^^^^^^^ no item named `Self` in scope
6+
|
7+
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
8+
9+
warning: 1 warning emitted
10+

0 commit comments

Comments
 (0)