Skip to content

Commit 19e597a

Browse files
Deeply normalize and extract registered outlives for implied bound hacks
1 parent 9f48ded commit 19e597a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,17 @@ pub fn compute_implied_outlives_bounds_compat_inner<'tcx>(
202202
}
203203
}
204204

205-
let pred = match obligation.predicate.kind().no_bound_vars() {
205+
let pred = if ocx.infcx.next_trait_solver() {
206+
ocx.deeply_normalize(
207+
&ObligationCause::dummy_with_span(span),
208+
param_env,
209+
obligation.predicate,
210+
)
211+
.map_err(|_| NoSolution)?
212+
} else {
213+
obligation.predicate
214+
};
215+
let pred = match pred.kind().no_bound_vars() {
206216
None => continue,
207217
Some(pred) => pred,
208218
};
@@ -240,6 +250,13 @@ pub fn compute_implied_outlives_bounds_compat_inner<'tcx>(
240250
}
241251
}
242252

253+
outlives_bounds.extend(
254+
ocx.infcx
255+
.take_registered_region_obligations()
256+
.into_iter()
257+
.map(|o| ty::OutlivesPredicate(o.sup_type.into(), o.sub_region)),
258+
);
259+
243260
// This call to `select_all_or_error` is necessary to constrain inference variables, which we
244261
// use further down when computing the implied bounds.
245262
match ocx.select_all_or_error().as_slice() {

tests/ui/implied-bounds/bevy_world_query.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![crate_name = "bevy_ecs"]
22

3+
//@ revisions: current next
4+
//@ ignore-compare-mode-next-solver (explicit revisions)
5+
//@[next] compile-flags: -Znext-solver
36
//@ check-pass
47

58
// We currently special case bevy from erroring on incorrect implied bounds

0 commit comments

Comments
 (0)