Deeply normalize args for implied bounds
This commit is contained in:
parent
a02a982ffc
commit
ce0c952e96
2 changed files with 23 additions and 1 deletions
|
@ -264,7 +264,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } =
|
let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } =
|
||||||
param_env
|
param_env
|
||||||
.and(type_op::normalize::Normalize { value: ty })
|
.and(DeeplyNormalize { value: ty })
|
||||||
.fully_perform(self.infcx, span)
|
.fully_perform(self.infcx, span)
|
||||||
.unwrap_or_else(|guar| TypeOpOutput {
|
.unwrap_or_else(|guar| TypeOpOutput {
|
||||||
output: Ty::new_error(self.infcx.tcx, guar),
|
output: Ty::new_error(self.infcx.tcx, guar),
|
||||||
|
|
22
tests/ui/borrowck/implied-bound-from-normalized-arg.rs
Normal file
22
tests/ui/borrowck/implied-bound-from-normalized-arg.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//@ check-pass
|
||||||
|
//@ revisions: current next
|
||||||
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||||
|
//@[next] compile-flags: -Znext-solver
|
||||||
|
|
||||||
|
// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get
|
||||||
|
// its implied bounds.
|
||||||
|
|
||||||
|
trait Ref<'a> {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
impl<'a, T> Ref<'a> for T where T: 'a {
|
||||||
|
type Assoc = &'a T;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn outlives<'a, T: 'a>() {}
|
||||||
|
|
||||||
|
fn test<'a, T>(_: <T as Ref<'a>>::Assoc) {
|
||||||
|
outlives::<'a, T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue