Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 31c44b8

Browse files
committed
use implied bounds compat mode in MIR borrowck
1 parent d3c9082 commit 31c44b8

File tree

9 files changed

+81
-21
lines changed

9 files changed

+81
-21
lines changed

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

Lines changed: 10 additions & 2 deletions
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‎

Lines changed: 0 additions & 1 deletion
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‎

Lines changed: 1 addition & 9 deletions
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‎

Lines changed: 3 additions & 1 deletion
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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Test for normalization of projections that appear in the item bounds
2+
// (versus those that appear directly in the input types).
3+
//
4+
// FIXME(-Zno-implied-bounds-compat): remove this test once this flag is removed,
5+
// duplicate of `normalization-nested.rs`.
6+
7+
// compile-flags: -Zno-implied-bounds-compat
8+
// revisions: param_ty lifetime
9+
// check-pass
10+
11+
pub trait Iter {
12+
type Item;
13+
}
14+
15+
#[cfg(param_ty)]
16+
impl<X, I> Iter for I
17+
where
18+
I: IntoIterator<Item = X>,
19+
{
20+
type Item = X;
21+
}
22+
23+
#[cfg(lifetime)]
24+
impl<'x, I> Iter for I
25+
where
26+
I: IntoIterator<Item = &'x ()>,
27+
{
28+
type Item = &'x ();
29+
}
30+
31+
pub struct Map<I>(I)
32+
where
33+
I: Iter,
34+
I::Item: 'static;
35+
36+
pub fn test_wfcheck<'x>(_: Map<Vec<&'x ()>>) {}
37+
38+
pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str {
39+
s
40+
}
41+
42+
fn main() {}
Lines changed: 10 additions & 0 deletions
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:36: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‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// (versus those that appear directly in the input types).
33
//
44
// revisions: param_ty lifetime
5-
// check-pass
5+
6+
//[param_ty] check-pass
67

78
pub trait Iter {
89
type Item;
@@ -33,6 +34,7 @@ pub fn test_wfcheck<'x>(_: Map<Vec<&'x ()>>) {}
3334

3435
pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str {
3536
s
37+
//[lifetime]~^ ERROR lifetime may not live long enough
3638
}
3739

3840
fn main() {}
File renamed without changes.

‎tests/ui/inference/issue-80409.rs‎

Lines changed: 12 additions & 7 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /