diff options
| author | lcnr <rust@lcnr.de> | 2024-01-19 08:19:18 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-01-19 15:27:32 +0100 |
| commit | 058ab53dc58b70d4b0b60374d4f7ddfede4dae65 (patch) | |
| tree | e7199fd9361035f662cd31c12c1541e56c795585 | |
| parent | d3c9082a44f00b22152ebc9c92c129b10ccb7793 (diff) | |
| download | rust-058ab53dc58b70d4b0b60374d4f7ddfede4dae65.tar.gz rust-058ab53dc58b70d4b0b60374d4f7ddfede4dae65.zip | |
use implied bounds compat mode in MIR borrowck
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs | 12 | ||||
| -rw-r--r-- | tests/ui/associated-inherent-types/issue-111404-1.rs | 1 | ||||
| -rw-r--r-- | tests/ui/associated-inherent-types/issue-111404-1.stderr | 10 | ||||
| -rw-r--r-- | tests/ui/implied-bounds/bevy_world_query.rs | 4 | ||||
| -rw-r--r-- | tests/ui/implied-bounds/normalization-nested.lifetime.stderr | 10 | ||||
| -rw-r--r-- | tests/ui/implied-bounds/normalization-nested.rs | 14 | ||||
| -rw-r--r-- | tests/ui/inference/issue-80409.no-compat.stderr (renamed from tests/ui/inference/issue-80409.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/inference/issue-80409.rs | 19 |
8 files changed, 46 insertions, 24 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs index 2fdb63d7dee..83d23597c0c 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs @@ -48,14 +48,22 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> { param_env.and(ty) }); - tcx.implied_outlives_bounds(canonicalized) + if tcx.sess.opts.unstable_opts.no_implied_bounds_compat { + tcx.implied_outlives_bounds(canonicalized) + } else { + tcx.implied_outlives_bounds_compat(canonicalized) + } } fn perform_locally_with_next_solver( ocx: &ObligationCtxt<'_, 'tcx>, key: ParamEnvAnd<'tcx, Self>, ) -> Result<Self::QueryResponse, NoSolution> { - compute_implied_outlives_bounds_inner(ocx, key.param_env, key.value.ty) + if ocx.infcx.tcx.sess.opts.unstable_opts.no_implied_bounds_compat { + compute_implied_outlives_bounds_inner(ocx, key.param_env, key.value.ty) + } else { + compute_implied_outlives_bounds_compat_inner(ocx, key.param_env, key.value.ty) + } } } diff --git a/tests/ui/associated-inherent-types/issue-111404-1.rs b/tests/ui/associated-inherent-types/issue-111404-1.rs index 74f9434b881..dd62e59f07d 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.rs +++ b/tests/ui/associated-inherent-types/issue-111404-1.rs @@ -10,6 +10,5 @@ impl<'a> Foo<fn(&'a ())> { fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} //~^ ERROR higher-ranked subtype error //~| ERROR higher-ranked subtype error -//~| ERROR higher-ranked subtype error fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-111404-1.stderr b/tests/ui/associated-inherent-types/issue-111404-1.stderr index 1613161a873..cf4d4a5f19b 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.stderr +++ b/tests/ui/associated-inherent-types/issue-111404-1.stderr @@ -12,13 +12,5 @@ LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: higher-ranked subtype error - --> $DIR/issue-111404-1.rs:10:1 - | -LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/implied-bounds/bevy_world_query.rs b/tests/ui/implied-bounds/bevy_world_query.rs index d5de0e9ef21..2e3d4e6a7c6 100644 --- a/tests/ui/implied-bounds/bevy_world_query.rs +++ b/tests/ui/implied-bounds/bevy_world_query.rs @@ -19,7 +19,9 @@ impl<Q: WorldQuery + 'static> SystemParam for Query<Q> { pub struct ParamSet<T: SystemParam>(T) where T::State: Sized; -fn handler<'a>(_: ParamSet<Query<&'a u8>>) {} +fn handler<'a>(x: ParamSet<Query<&'a u8>>) { + let _: ParamSet<_> = x; +} fn ref_handler<'a>(_: &ParamSet<Query<&'a u8>>) {} diff --git a/tests/ui/implied-bounds/normalization-nested.lifetime.stderr b/tests/ui/implied-bounds/normalization-nested.lifetime.stderr new file mode 100644 index 00000000000..c43cc0999f1 --- /dev/null +++ b/tests/ui/implied-bounds/normalization-nested.lifetime.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/normalization-nested.rs:40:5 + | +LL | pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str { + | -- lifetime `'x` defined here +LL | s + | ^ returning this value requires that `'x` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/implied-bounds/normalization-nested.rs b/tests/ui/implied-bounds/normalization-nested.rs index 3f569aa1ace..6ceb13e9473 100644 --- a/tests/ui/implied-bounds/normalization-nested.rs +++ b/tests/ui/implied-bounds/normalization-nested.rs @@ -1,14 +1,19 @@ // Test for normalization of projections that appear in the item bounds // (versus those that appear directly in the input types). // -// revisions: param_ty lifetime -// check-pass +// revisions: param_ty lifetime param_ty_no_compat lifetime_no_compat + +//[param_ty] check-pass +//[param_ty_no_compat] check-pass +//[lifetime_no_compat] check-pass +//[param_ty_no_compat] compile-flags: -Zno-implied-bounds-compat +//[lifetime_no_compat] compile-flags: -Zno-implied-bounds-compat pub trait Iter { type Item; } -#[cfg(param_ty)] +#[cfg(any(param_ty, param_ty_no_compat))] impl<X, I> Iter for I where I: IntoIterator<Item = X>, @@ -16,7 +21,7 @@ where type Item = X; } -#[cfg(lifetime)] +#[cfg(any(lifetime, lifetime_no_compat))] impl<'x, I> Iter for I where I: IntoIterator<Item = &'x ()>, @@ -33,6 +38,7 @@ pub fn test_wfcheck<'x>(_: Map<Vec<&'x ()>>) {} pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str { s + //[lifetime]~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/tests/ui/inference/issue-80409.stderr b/tests/ui/inference/issue-80409.no-compat.stderr index 7bb4786db3a..7bb4786db3a 100644 --- a/tests/ui/inference/issue-80409.stderr +++ b/tests/ui/inference/issue-80409.no-compat.stderr diff --git a/tests/ui/inference/issue-80409.rs b/tests/ui/inference/issue-80409.rs index d36688978e9..49c9978fe15 100644 --- a/tests/ui/inference/issue-80409.rs +++ b/tests/ui/inference/issue-80409.rs @@ -1,12 +1,17 @@ // This should not pass, because `usize: Fsm` does not hold. However, it currently ICEs. -// check-fail -// known-bug: #80409 -// failure-status: 101 -// normalize-stderr-test "note: .*\n\n" -> "" -// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" -// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -// rustc-env:RUST_BACKTRACE=0 +// ignore-tidy-linelength + +// revisions: compat no-compat +//[compat] check-pass +//[no-compat] compile-flags: -Zno-implied-bounds-compat +//[no-compat] check-fail +//[no-compat] known-bug: #80409 +//[no-compat] failure-status: 101 +//[no-compat] normalize-stderr-test "note: .*\n\n" -> "" +//[no-compat] normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" +//[no-compat] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " +//[no-compat] rustc-env:RUST_BACKTRACE=0 #![allow(unreachable_code, unused)] |
