mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Merge #8921
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:
commit
057e2ed574
1 changed files with 13 additions and 1 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue