Remove span from BrAnon.
This commit is contained in:
parent
ded1a8b026
commit
26cb34cd18
39 changed files with 76 additions and 107 deletions
|
@ -56,11 +56,8 @@ impl<'a> DescriptionCtx<'a> {
|
|||
(Some(span), "as_defined", name.to_string())
|
||||
}
|
||||
}
|
||||
ty::BrAnon(span) => {
|
||||
let span = match span {
|
||||
Some(_) => span,
|
||||
None => Some(tcx.def_span(scope)),
|
||||
};
|
||||
ty::BrAnon => {
|
||||
let span = Some(tcx.def_span(scope));
|
||||
(span, "defined_here", String::new())
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -775,7 +775,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
|||
r: ty::Region<'tcx>,
|
||||
) -> ty::Region<'tcx> {
|
||||
let var = self.canonical_var(info, r.into());
|
||||
let br = ty::BoundRegion { var, kind: ty::BrAnon(None) };
|
||||
let br = ty::BoundRegion { var, kind: ty::BrAnon };
|
||||
ty::Region::new_late_bound(self.interner(), self.binder_index, br)
|
||||
}
|
||||
|
||||
|
|
|
@ -242,12 +242,9 @@ fn msg_span_from_named_region<'tcx>(
|
|||
};
|
||||
(text, Some(span))
|
||||
}
|
||||
ty::BrAnon(span) => (
|
||||
ty::BrAnon => (
|
||||
"the anonymous lifetime as defined here".to_string(),
|
||||
Some(match span {
|
||||
Some(span) => span,
|
||||
None => tcx.def_span(scope)
|
||||
})
|
||||
Some(tcx.def_span(scope))
|
||||
),
|
||||
_ => (
|
||||
format!("the lifetime `{region}` as defined here"),
|
||||
|
@ -262,11 +259,7 @@ fn msg_span_from_named_region<'tcx>(
|
|||
..
|
||||
}) => (format!("the lifetime `{name}` as defined here"), Some(tcx.def_span(def_id))),
|
||||
ty::RePlaceholder(ty::PlaceholderRegion {
|
||||
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(Some(span)), .. },
|
||||
..
|
||||
}) => ("the anonymous lifetime defined here".to_owned(), Some(span)),
|
||||
ty::RePlaceholder(ty::PlaceholderRegion {
|
||||
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(None), .. },
|
||||
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon, .. },
|
||||
..
|
||||
}) => ("an anonymous lifetime".to_owned(), None),
|
||||
_ => bug!("{:?}", region),
|
||||
|
|
|
@ -61,7 +61,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||
let is_impl_item = region_info.is_impl_item;
|
||||
|
||||
match br {
|
||||
ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon(..) => {}
|
||||
ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon => {}
|
||||
_ => {
|
||||
/* not an anonymous region */
|
||||
debug!("try_report_named_anon_conflict: not an anonymous region");
|
||||
|
|
|
@ -36,15 +36,13 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
|
|||
ty::BrNamed(def_id, symbol) => {
|
||||
(Some(self.tcx().def_span(def_id)), Some(symbol))
|
||||
}
|
||||
ty::BrAnon(span) => (*span, None),
|
||||
ty::BrEnv => (None, None),
|
||||
ty::BrAnon | ty::BrEnv => (None, None),
|
||||
};
|
||||
let (sup_span, sup_symbol) = match sup_name {
|
||||
ty::BrNamed(def_id, symbol) => {
|
||||
(Some(self.tcx().def_span(def_id)), Some(symbol))
|
||||
}
|
||||
ty::BrAnon(span) => (*span, None),
|
||||
ty::BrEnv => (None, None),
|
||||
ty::BrAnon | ty::BrEnv => (None, None),
|
||||
};
|
||||
let diag = match (sub_span, sup_span, sub_symbol, sup_symbol) {
|
||||
(Some(sub_span), Some(sup_span), Some(&sub_symbol), Some(&sup_symbol)) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue