Fix up DescriptionCtx::new
.
The comment mentions that `ReBound` and `ReVar` aren't expected here. Experimentation with the full test suite indicates this is true, and that `ReErased` also doesn't occur. So the commit introduces `bug!` for those cases. (If any of them show up later on, at least we'll have a test case.) The commit also remove the first sentence in the comment. `RePlaceholder` is now handled in the match arm above this comment and nothing is printed for it, so that sentence is just wrong. Furthermore, issue #13998 was closed some time ago.
This commit is contained in:
parent
609b9a67c9
commit
d6c63bdb21
2 changed files with 4 additions and 14 deletions
|
@ -69,16 +69,8 @@ impl<'a> DescriptionCtx<'a> {
|
||||||
|
|
||||||
ty::RePlaceholder(_) | ty::ReError(_) => return None,
|
ty::RePlaceholder(_) | ty::ReError(_) => return None,
|
||||||
|
|
||||||
// FIXME(#13998) RePlaceholder should probably print like
|
|
||||||
// ReLateParam rather than dumping Debug output on the user.
|
|
||||||
//
|
|
||||||
// We shouldn't really be having unification failures with ReVar
|
|
||||||
// and ReBound though.
|
|
||||||
//
|
|
||||||
// FIXME(@lcnr): figure out why we have to handle `ReBound`
|
|
||||||
// here, this feels somewhat off.
|
|
||||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
||||||
(alt_span, "revar", format!("{region:?}"))
|
bug!("unexpected region for DescriptionCtx: {:?}", region);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Some(DescriptionCtx { span, kind, arg })
|
Some(DescriptionCtx { span, kind, arg })
|
||||||
|
|
|
@ -172,11 +172,9 @@ pub(super) fn note_and_explain_region<'tcx>(
|
||||||
|
|
||||||
ty::ReError(_) => return,
|
ty::ReError(_) => return,
|
||||||
|
|
||||||
// We shouldn't really be having unification failures with ReVar
|
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
||||||
// and ReBound though.
|
bug!("unexpected region for note_and_explain_region: {:?}", region);
|
||||||
//
|
}
|
||||||
// FIXME(@lcnr): Figure out whether this is reachable and if so, why.
|
|
||||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => (format!("lifetime `{region}`"), alt_span),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
emit_msg_span(err, prefix, description, span, suffix);
|
emit_msg_span(err, prefix, description, span, suffix);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue