about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-04 20:23:52 -0400
committerMichael Goulet <michael@errs.io>2024-04-15 16:45:26 -0400
commit52c6b101ea18ed6f09367bf459ac55ffe473cd9c (patch)
tree4bd7b7084b701a4c3e9deb299db09c209b5a7dbc /compiler/rustc_hir_analysis/src
parentce8961039e244b1e4e0fa02fc10d59a22abc9ea3 (diff)
downloadrust-52c6b101ea18ed6f09367bf459ac55ffe473cd9c.tar.gz
rust-52c6b101ea18ed6f09367bf459ac55ffe473cd9c.zip
Use a path instead of an ident (and stop manually resolving)
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs16
-rw-r--r--compiler/rustc_hir_analysis/src/errors/precise_captures.rs10
2 files changed, 23 insertions, 3 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
index fb3713140ff..78c2665fd1f 100644
--- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
+++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
@@ -583,9 +583,19 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
                     self.resolve_type_ref(def_id.expect_local(), param.hir_id);
                 }
                 Res::Err => {}
-                _ => {
-                    // This is handled in resolve
-                    self.tcx.dcx().delayed_bug(format!("parameter should have been resolved"));
+                Res::SelfTyAlias { alias_to, .. } => {
+                    self.tcx.dcx().emit_err(errors::PreciseCaptureSelfAlias {
+                        span: param.ident.span,
+                        self_span: self.tcx.def_span(alias_to),
+                        what: self.tcx.def_descr(alias_to),
+                    });
+                }
+                res => {
+                    self.tcx.dcx().emit_err(errors::BadPreciseCapture {
+                        span: param.ident.span,
+                        kind: "type or const",
+                        found: res.descr().to_string(),
+                    });
                 }
             },
         }
diff --git a/compiler/rustc_hir_analysis/src/errors/precise_captures.rs b/compiler/rustc_hir_analysis/src/errors/precise_captures.rs
index e2eb9c72bf2..520bf1d9f40 100644
--- a/compiler/rustc_hir_analysis/src/errors/precise_captures.rs
+++ b/compiler/rustc_hir_analysis/src/errors/precise_captures.rs
@@ -33,6 +33,16 @@ pub struct BadPreciseCapture {
 }
 
 #[derive(Diagnostic)]
+#[diag(hir_analysis_precise_capture_self_alias)]
+pub struct PreciseCaptureSelfAlias {
+    #[primary_span]
+    pub span: Span,
+    #[label]
+    pub self_span: Span,
+    pub what: &'static str,
+}
+
+#[derive(Diagnostic)]
 #[diag(hir_analysis_duplicate_precise_capture)]
 pub struct DuplicatePreciseCapture {
     #[primary_span]