Skip to content

Commit 2c7b8d4

Browse files
Delay span bug when Self resolves to DefKind::{Mod,Trait}
1 parent ccfcd95 commit 2c7b8d4

File tree

1 file changed

+11
-0
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+11
-0
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,17 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
18791879
self.set_tainted_by_errors(e);
18801880
Ty::new_error(self.tcx(), e)
18811881
}
1882+
Res::Def(..) => {
1883+
assert_eq!(
1884+
path.segments.get(0).map(|seg| seg.ident.name),
1885+
Some(kw::SelfUpper),
1886+
"only expected incorrect resolution for `Self`"
1887+
);
1888+
Ty::new_error(
1889+
self.tcx(),
1890+
self.tcx().dcx().span_delayed_bug(span, "incorrect resolution for `Self`"),
1891+
)
1892+
}
18821893
_ => span_bug!(span, "unexpected resolution: {:?}", path.res),
18831894
}
18841895
}

0 commit comments

Comments
 (0)