Delay span bug when Self resolves to DefKind::{Mod,Trait}

This commit is contained in:
Michael Goulet 2024-04-15 21:00:49 -04:00
parent ccfcd950b3
commit 6288a721f5
3 changed files with 58 additions and 0 deletions

View file

@ -1879,6 +1879,17 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
self.set_tainted_by_errors(e);
Ty::new_error(self.tcx(), e)
}
Res::Def(..) => {
assert_eq!(
path.segments.get(0).map(|seg| seg.ident.name),
Some(kw::SelfUpper),
"only expected incorrect resolution for `Self`"
);
Ty::new_error(
self.tcx(),
self.tcx().dcx().span_delayed_bug(span, "incorrect resolution for `Self`"),
)
}
_ => span_bug!(span, "unexpected resolution: {:?}", path.res),
}
}