Skip to content

Commit 88189a7

Browse files
committed
Auto merge of #120123 - lcnr:sadboi-compat, r=jackh726
use implied bounds compat mode in MIR borrowck cc - #119956 - #118553 This should hopefully fix bevy 🤔 `cargo test` ends up freezing my computer though, cargo build went from err to ok however 😁 r? `@jackh726`
2 parents 32ec40c + 058ab53 commit 88189a7

File tree

8 files changed

+46
-24
lines changed

8 files changed

+46
-24
lines changed

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

+10-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,22 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
4848
param_env.and(ty)
4949
});
5050

51-
tcx.implied_outlives_bounds(canonicalized)
51+
if tcx.sess.opts.unstable_opts.no_implied_bounds_compat {
52+
tcx.implied_outlives_bounds(canonicalized)
53+
} else {
54+
tcx.implied_outlives_bounds_compat(canonicalized)
55+
}
5256
}
5357

5458
fn perform_locally_with_next_solver(
5559
ocx: &ObligationCtxt<'_, 'tcx>,
5660
key: ParamEnvAnd<'tcx, Self>,
5761
) -> Result<Self::QueryResponse, NoSolution> {
58-
compute_implied_outlives_bounds_inner(ocx, key.param_env, key.value.ty)
62+
if ocx.infcx.tcx.sess.opts.unstable_opts.no_implied_bounds_compat {
63+
compute_implied_outlives_bounds_inner(ocx, key.param_env, key.value.ty)
64+
} else {
65+
compute_implied_outlives_bounds_compat_inner(ocx, key.param_env, key.value.ty)
66+
}
5967
}
6068
}
6169

tests/ui/associated-inherent-types/issue-111404-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ impl<'a> Foo<fn(&'a ())> {
1010
fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {}
1111
//~^ ERROR higher-ranked subtype error
1212
//~| ERROR higher-ranked subtype error
13-
//~| ERROR higher-ranked subtype error
1413

1514
fn main() {}

tests/ui/associated-inherent-types/issue-111404-1.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,5 @@ LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {}
1212
|
1313
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1414

15-
error: higher-ranked subtype error
16-
--> $DIR/issue-111404-1.rs:10:1
17-
|
18-
LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {}
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20-
|
21-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
22-
23-
error: aborting due to 3 previous errors
15+
error: aborting due to 2 previous errors
2416

tests/ui/implied-bounds/bevy_world_query.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ impl<Q: WorldQuery + 'static> SystemParam for Query<Q> {
1919

2020
pub struct ParamSet<T: SystemParam>(T) where T::State: Sized;
2121

22-
fn handler<'a>(_: ParamSet<Query<&'a u8>>) {}
22+
fn handler<'a>(x: ParamSet<Query<&'a u8>>) {
23+
let _: ParamSet<_> = x;
24+
}
2325

2426
fn ref_handler<'a>(_: &ParamSet<Query<&'a u8>>) {}
2527

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/normalization-nested.rs:40:5
3+
|
4+
LL | pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str {
5+
| -- lifetime `'x` defined here
6+
LL | s
7+
| ^ returning this value requires that `'x` must outlive `'static`
8+
9+
error: aborting due to 1 previous error
10+

tests/ui/implied-bounds/normalization-nested.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
// Test for normalization of projections that appear in the item bounds
22
// (versus those that appear directly in the input types).
33
//
4-
// revisions: param_ty lifetime
5-
// check-pass
4+
// revisions: param_ty lifetime param_ty_no_compat lifetime_no_compat
5+
6+
//[param_ty] check-pass
7+
//[param_ty_no_compat] check-pass
8+
//[lifetime_no_compat] check-pass
9+
//[param_ty_no_compat] compile-flags: -Zno-implied-bounds-compat
10+
//[lifetime_no_compat] compile-flags: -Zno-implied-bounds-compat
611

712
pub trait Iter {
813
type Item;
914
}
1015

11-
#[cfg(param_ty)]
16+
#[cfg(any(param_ty, param_ty_no_compat))]
1217
impl<X, I> Iter for I
1318
where
1419
I: IntoIterator<Item = X>,
1520
{
1621
type Item = X;
1722
}
1823

19-
#[cfg(lifetime)]
24+
#[cfg(any(lifetime, lifetime_no_compat))]
2025
impl<'x, I> Iter for I
2126
where
2227
I: IntoIterator<Item = &'x ()>,
@@ -33,6 +38,7 @@ pub fn test_wfcheck<'x>(_: Map<Vec<&'x ()>>) {}
3338

3439
pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str {
3540
s
41+
//[lifetime]~^ ERROR lifetime may not live long enough
3642
}
3743

3844
fn main() {}

tests/ui/inference/issue-80409.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
// This should not pass, because `usize: Fsm` does not hold. However, it currently ICEs.
22

3-
// check-fail
4-
// known-bug: #80409
5-
// failure-status: 101
6-
// normalize-stderr-test "note: .*\n\n" -> ""
7-
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
8-
// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
9-
// rustc-env:RUST_BACKTRACE=0
3+
// ignore-tidy-linelength
4+
5+
// revisions: compat no-compat
6+
//[compat] check-pass
7+
//[no-compat] compile-flags: -Zno-implied-bounds-compat
8+
//[no-compat] check-fail
9+
//[no-compat] known-bug: #80409
10+
//[no-compat] failure-status: 101
11+
//[no-compat] normalize-stderr-test "note: .*\n\n" -> ""
12+
//[no-compat] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
13+
//[no-compat] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
14+
//[no-compat] rustc-env:RUST_BACKTRACE=0
1015

1116
#![allow(unreachable_code, unused)]
1217

0 commit comments

Comments
 (0)