8921: Resolve any lifetime variables to 'static after inference r=flodiebold a=flodiebold

Chalk's unification can sometimes create lifetime variables, which we
currently don't really deal with, but at least we don't want to leak
them outside of inference.

Should fix #8919.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
This commit is contained in:
bors[bot] 2021-05-22 12:32:12 +00:00 committed by GitHub
commit 057e2ed574
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -435,7 +435,7 @@ mod resolve {
use super::InferenceTable;
use crate::{
ConcreteConst, Const, ConstData, ConstValue, DebruijnIndex, GenericArg, InferenceVar,
Interner, Ty, TyVariableKind, VariableKind,
Interner, Lifetime, Ty, TyVariableKind, VariableKind,
};
use chalk_ir::{
cast::Cast,
@ -524,5 +524,17 @@ mod resolve {
};
Ok(result)
}
fn fold_inference_lifetime(
&mut self,
_var: InferenceVar,
_outer_binder: DebruijnIndex,
) -> Fallible<Lifetime> {
// fall back all lifetimes to 'static -- currently we don't deal
// with any lifetimes, but we can sometimes get some lifetime
// variables through Chalk's unification, and this at least makes
// sure we don't leak them outside of inference
Ok(crate::static_lifetime())
}
}
}