introduce new fallback algorithm
We now fallback type variables using the following rules: * Construct a coercion graph `A -> B` where `A` and `B` are unresolved type variables or the `!` type. * Let D be those variables that are reachable from `!`. * Let N be those variables that are reachable from a variable not in D. * All variables in (D \ N) fallback to `!`. * All variables in (D & N) fallback to `()`.
This commit is contained in:
committed by
Mark Rousskov
parent
e0c38af27c
commit
2ee89144e2
@@ -1672,6 +1672,14 @@ impl<'tcx> TyS<'tcx> {
|
||||
matches!(self.kind(), Infer(TyVar(_)))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ty_vid(&self) -> Option<ty::TyVid> {
|
||||
match self.kind() {
|
||||
&Infer(TyVar(vid)) => Some(vid),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_ty_infer(&self) -> bool {
|
||||
matches!(self.kind(), Infer(_))
|
||||
|
||||
Reference in New Issue
Block a user