Use a path instead of an ident (and stop manually resolving)
This commit is contained in:
parent
ce8961039e
commit
52c6b101ea
12 changed files with 81 additions and 84 deletions
|
@ -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(),
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -32,6 +32,16 @@ pub struct BadPreciseCapture {
|
|||
pub found: String,
|
||||
}
|
||||
|
||||
#[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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue