1
Fork 0

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:
Nicholas Nethercote 2024-05-09 11:56:38 +10:00
parent 609b9a67c9
commit d6c63bdb21
2 changed files with 4 additions and 14 deletions

View file

@ -69,16 +69,8 @@ impl<'a> DescriptionCtx<'a> {
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 => {
(alt_span, "revar", format!("{region:?}"))
bug!("unexpected region for DescriptionCtx: {:?}", region);
}
};
Some(DescriptionCtx { span, kind, arg })