mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
use implied bounds compat mode in MIR borrowck
This commit is contained in:
parent
d3c9082a44
commit
058ab53dc5
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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>>) {}
|
||||
|
||||
|
10
tests/ui/implied-bounds/normalization-nested.lifetime.stderr
Normal file
10
tests/ui/implied-bounds/normalization-nested.lifetime.stderr
Normal file
@ -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
|
||||
|
@ -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() {}
|
||||
|
@ -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)]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user