Deeply normalize in impl header
This commit is contained in:
parent
ce0c952e96
commit
ef9d992a0d
2 changed files with 29 additions and 1 deletions
|
@ -301,7 +301,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
|
||||||
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
|
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
|
||||||
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
|
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
|
||||||
let result: Result<_, ErrorGuaranteed> = param_env
|
let result: Result<_, ErrorGuaranteed> = param_env
|
||||||
.and(type_op::normalize::Normalize { value: ty })
|
.and(DeeplyNormalize { value: ty })
|
||||||
.fully_perform(self.infcx, span);
|
.fully_perform(self.infcx, span);
|
||||||
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
|
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
|
||||||
continue;
|
continue;
|
||||||
|
|
28
tests/ui/borrowck/implied-bound-from-impl-header.rs
Normal file
28
tests/ui/borrowck/implied-bound-from-impl-header.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//@ 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 in impl header.
|
||||||
|
|
||||||
|
trait Ref<'a> {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
impl<'a, T> Ref<'a> for T where T: 'a {
|
||||||
|
type Assoc = &'a T;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn outlives<'a, T: 'a>() {}
|
||||||
|
|
||||||
|
trait Trait<'a, T> {
|
||||||
|
fn test();
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, T> Trait<'a, T> for <T as Ref<'a>>::Assoc {
|
||||||
|
fn test() {
|
||||||
|
outlives::<'a, T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue