Skip to content

Commit eea5604

Browse files
committed
oops! new unsoundness
Bless tests and show an introduced unsoundness related to exits<'a> { forall<'b> { 'a == 'b } }. We now resolve the var ?a in U0 to the placeholder !b in U1.
1 parent 79dca7b commit eea5604

7 files changed

+21
-41
lines changed

Diff for: tests/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
//
33
// In particular, we test this pattern in trait solving, where it is not connected
44
// to any part of the source code.
5+
//
6+
// check-pass
7+
// Oops!
58

69
use std::cell::Cell;
710

@@ -25,5 +28,5 @@ fn main() {
2528
// yielding `fn(&!b u32)`, in a fresh universe U1
2629
// - So we get `?a = !b` but the universe U0 assigned to `?a` cannot name `!b`.
2730

28-
foo::<()>(); //~ ERROR implementation of `Trait` is not general enough
31+
foo::<()>();
2932
}

Diff for: tests/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr

-11
This file was deleted.

Diff for: tests/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ LL | fn give_some<'a>() {
1414
| -- lifetime `'a` defined here
1515
LL | want_hrtb::<&'a u32>()
1616
| ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
17-
|
18-
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
19-
--> $DIR/hrtb-just-for-static.rs:9:15
20-
|
21-
LL | where T : for<'a> Foo<&'a isize>
22-
| ^^^^^^^^^^^^^^^^^^^^^^
2317

2418
error: implementation of `Foo` is not general enough
2519
--> $DIR/hrtb-just-for-static.rs:30:5

Diff for: tests/ui/traits/inductive-overflow/lifetime.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ impl<'a> Y for C<'a> {
1515
struct C<'a>(&'a ());
1616
struct X<T: Y>(T::P);
1717

18-
impl<T: NotAuto> NotAuto for Box<T> {} //~ NOTE: required
18+
impl<T: NotAuto> NotAuto for Box<T> {}
19+
impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} //~ NOTE: required
1920
//~^ NOTE unsatisfied trait bound introduced here
20-
impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
2121
impl<'a> NotAuto for C<'a> {}
2222

2323
fn is_send<S: NotAuto>() {}
@@ -28,6 +28,4 @@ fn main() {
2828
// Should only be a few notes.
2929
is_send::<X<C<'static>>>();
3030
//~^ ERROR overflow evaluating
31-
//~| 3 redundant requirements hidden
32-
//~| required for
3331
}

Diff for: tests/ui/traits/inductive-overflow/lifetime.stderr

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
error[E0275]: overflow evaluating the requirement `X<C<'_>>: NotAuto`
1+
error[E0275]: overflow evaluating the requirement `Box<X<C<'static>>>: NotAuto`
22
--> $DIR/lifetime.rs:29:5
33
|
44
LL | is_send::<X<C<'static>>>();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
note: required for `Box<X<C<'_>>>` to implement `NotAuto`
8-
--> $DIR/lifetime.rs:18:18
7+
note: required for `X<C<'static>>` to implement `NotAuto`
8+
--> $DIR/lifetime.rs:19:12
99
|
10-
LL | impl<T: NotAuto> NotAuto for Box<T> {}
11-
| ------- ^^^^^^^ ^^^^^^
12-
| |
13-
| unsatisfied trait bound introduced here
14-
= note: 3 redundant requirements hidden
15-
= note: required for `X<C<'static>>` to implement `NotAuto`
10+
LL | impl<T: Y> NotAuto for X<T> where T::P: NotAuto {}
11+
| ^^^^^^^ ^^^^ ------- unsatisfied trait bound introduced here
1612
note: required by a bound in `is_send`
1713
--> $DIR/lifetime.rs:23:15
1814
|

Diff for: tests/ui/wf/hir-wf-check-erase-regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
pub struct Table<T, const N: usize>([Option<T>; N]);
55

66
impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> {
7-
type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&T` is not an iterator
7+
type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&'a T` is not an iterator
88
type Item = &'a T;
99

10-
fn into_iter(self) -> Self::IntoIter { //~ ERROR `&T` is not an iterator
10+
fn into_iter(self) -> Self::IntoIter { //~ ERROR `&'a T` is not an iterator
1111
unimplemented!()
1212
}
1313
}

Diff for: tests/ui/wf/hir-wf-check-erase-regions.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
error[E0277]: `&T` is not an iterator
1+
error[E0277]: `&'a T` is not an iterator
22
--> $DIR/hir-wf-check-erase-regions.rs:7:21
33
|
44
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
66
|
7-
= help: the trait `Iterator` is not implemented for `&T`
7+
= help: the trait `Iterator` is not implemented for `&'a T`
88
= help: the trait `Iterator` is implemented for `&mut I`
9-
= note: required for `&T` to implement `IntoIterator`
9+
= note: required for `&'a T` to implement `IntoIterator`
1010
note: required by a bound in `Flatten`
1111
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
1212

13-
error[E0277]: `&T` is not an iterator
13+
error[E0277]: `&'a T` is not an iterator
1414
--> $DIR/hir-wf-check-erase-regions.rs:10:27
1515
|
1616
LL | fn into_iter(self) -> Self::IntoIter {
17-
| ^^^^^^^^^^^^^^ `&T` is not an iterator
17+
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
1818
|
19-
= help: the trait `Iterator` is not implemented for `&T`
19+
= help: the trait `Iterator` is not implemented for `&'a T`
2020
= help: the trait `Iterator` is implemented for `&mut I`
21-
= note: required for `&T` to implement `IntoIterator`
21+
= note: required for `&'a T` to implement `IntoIterator`
2222
note: required by a bound in `Flatten`
2323
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
2424

0 commit comments

Comments
 (0)