about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-15 21:00:49 -0400
committerMichael Goulet <michael@errs.io>2024-04-15 21:05:15 -0400
commit6288a721f5ea59a59b4304a7b70c92d7755e8aa8 (patch)
tree4e060f9d43053ce5a7f75f5c6cba2c4ecf17fedf /compiler/rustc_hir_analysis
parentccfcd950b333fed046275dd8d54fe736ca498aa7 (diff)
downloadrust-6288a721f5ea59a59b4304a7b70c92d7755e8aa8.tar.gz
rust-6288a721f5ea59a59b4304a7b70c92d7755e8aa8.zip
Delay span bug when Self resolves to DefKind::{Mod,Trait}
Diffstat (limited to 'compiler/rustc_hir_analysis')
-rw-r--r--compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
index 63aeb165a48..b15bf54234d 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -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),
         }
     }