Skip to content

Commit

Permalink
Delay span bug when Self resolves to DefKind::{Mod,Trait}
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Apr 16, 2024
1 parent ccfcd95 commit 2c7b8d4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down

0 comments on commit 2c7b8d4

Please sign in to comment.