Skip to content

Commit ef9d992

Browse files
Deeply normalize in impl header
1 parent ce0c952 commit ef9d992

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
301301
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
302302
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
303303
let result: Result<_, ErrorGuaranteed> = param_env
304-
.and(type_op::normalize::Normalize { value: ty })
304+
.and(DeeplyNormalize { value: ty })
305305
.fully_perform(self.infcx, span);
306306
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
307307
continue;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//@ check-pass
2+
//@ revisions: current next
3+
//@ ignore-compare-mode-next-solver (explicit revisions)
4+
//@[next] compile-flags: -Znext-solver
5+
6+
// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get
7+
// its implied bounds in impl header.
8+
9+
trait Ref<'a> {
10+
type Assoc;
11+
}
12+
impl<'a, T> Ref<'a> for T where T: 'a {
13+
type Assoc = &'a T;
14+
}
15+
16+
fn outlives<'a, T: 'a>() {}
17+
18+
trait Trait<'a, T> {
19+
fn test();
20+
}
21+
22+
impl<'a, T> Trait<'a, T> for <T as Ref<'a>>::Assoc {
23+
fn test() {
24+
outlives::<'a, T>();
25+
}
26+
}
27+
28+
fn main() {}

0 commit comments

Comments
 (0)