Don't point at Self type if we can't find an infer variable in ambiguous trait predicate

This commit is contained in:
Michael Goulet
2022-06-25 10:42:23 -07:00
parent ca0105ba4e
commit 12ab6bfafd
15 changed files with 94 additions and 57 deletions

View File

@@ -914,9 +914,17 @@ impl<'tcx> Term<'tcx> {
pub fn ty(&self) -> Option<Ty<'tcx>> {
if let Term::Ty(ty) = self { Some(*ty) } else { None }
}
pub fn ct(&self) -> Option<Const<'tcx>> {
if let Term::Const(c) = self { Some(*c) } else { None }
}
pub fn into_arg(self) -> GenericArg<'tcx> {
match self {
Term::Ty(ty) => ty.into(),
Term::Const(c) => c.into(),
}
}
}
/// This kind of predicate has no *direct* correspondent in the