Do precise capturing arg validation in resolve

This commit is contained in:
Michael Goulet 2024-09-15 17:14:49 -04:00
parent 13b5a4e43b
commit 26bdfefae1
6 changed files with 72 additions and 33 deletions

View file

@ -584,7 +584,6 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
| Res::SelfTyParam { trait_: def_id } => {
self.resolve_type_ref(def_id.expect_local(), param.hir_id);
}
Res::Err => {}
Res::SelfTyAlias { alias_to, .. } => {
self.tcx.dcx().emit_err(errors::PreciseCaptureSelfAlias {
span: param.ident.span,
@ -593,11 +592,10 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
});
}
res => {
self.tcx.dcx().emit_err(errors::BadPreciseCapture {
span: param.ident.span,
kind: "type or const",
found: res.descr().to_string(),
});
self.tcx.dcx().span_delayed_bug(
param.ident.span,
format!("expected type or const param, found {res:?}"),
);
}
},
}