Skip to content

Commit fcb22db

Browse files
committed
update test expectations for boring locals + dropckoutlives interactions
The suboptimal error only appears with NLLs due to liveness differences where polonius cannot have as many boring locals.
1 parent 86dc62a commit fcb22db

6 files changed

+129
-18
lines changed

tests/ui/drop/dropck-normalize-errors.stderr renamed to tests/ui/drop/dropck-normalize-errors.nll.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>`
2-
--> $DIR/dropck-normalize-errors.rs:15:28
2+
--> $DIR/dropck-normalize-errors.rs:19:28
33
|
44
LL | fn make_a_decoder<'a>() -> ADecoder<'a> {
55
| ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
66
|
77
help: this trait has no implementations, consider adding one
8-
--> $DIR/dropck-normalize-errors.rs:7:1
8+
--> $DIR/dropck-normalize-errors.rs:11:1
99
|
1010
LL | trait NonImplementedTrait {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1212
note: required because it appears within the type `BDecoder`
13-
--> $DIR/dropck-normalize-errors.rs:26:12
13+
--> $DIR/dropck-normalize-errors.rs:30:12
1414
|
1515
LL | pub struct BDecoder {
1616
| ^^^^^^^^
1717
note: required because it appears within the type `ADecoder<'a>`
18-
--> $DIR/dropck-normalize-errors.rs:12:12
18+
--> $DIR/dropck-normalize-errors.rs:16:12
1919
|
2020
LL | pub struct ADecoder<'a> {
2121
| ^^^^^^^^
2222
= note: the return type of a function must have a statically known size
2323

2424
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder`
25-
--> $DIR/dropck-normalize-errors.rs:23:20
25+
--> $DIR/dropck-normalize-errors.rs:27:20
2626
|
2727
LL | type Decoder = BDecoder;
2828
| ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
2929
|
3030
help: this trait has no implementations, consider adding one
31-
--> $DIR/dropck-normalize-errors.rs:7:1
31+
--> $DIR/dropck-normalize-errors.rs:11:1
3232
|
3333
LL | trait NonImplementedTrait {
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^^
3535
note: required because it appears within the type `BDecoder`
36-
--> $DIR/dropck-normalize-errors.rs:26:12
36+
--> $DIR/dropck-normalize-errors.rs:30:12
3737
|
3838
LL | pub struct BDecoder {
3939
| ^^^^^^^^
4040
note: required by a bound in `Decode::Decoder`
41-
--> $DIR/dropck-normalize-errors.rs:4:5
41+
--> $DIR/dropck-normalize-errors.rs:8:5
4242
|
4343
LL | type Decoder;
4444
| ^^^^^^^^^^^^^ required by this bound in `Decode::Decoder`
@@ -48,25 +48,25 @@ LL | type Decoder: ?Sized;
4848
| ++++++++
4949

5050
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied
51-
--> $DIR/dropck-normalize-errors.rs:27:22
51+
--> $DIR/dropck-normalize-errors.rs:31:22
5252
|
5353
LL | non_implemented: <NonImplementedStruct as NonImplementedTrait>::Assoc,
5454
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
5555
|
5656
help: this trait has no implementations, consider adding one
57-
--> $DIR/dropck-normalize-errors.rs:7:1
57+
--> $DIR/dropck-normalize-errors.rs:11:1
5858
|
5959
LL | trait NonImplementedTrait {
6060
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6161

6262
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied
63-
--> $DIR/dropck-normalize-errors.rs:15:28
63+
--> $DIR/dropck-normalize-errors.rs:19:28
6464
|
6565
LL | fn make_a_decoder<'a>() -> ADecoder<'a> {
6666
| ^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
6767
|
6868
help: this trait has no implementations, consider adding one
69-
--> $DIR/dropck-normalize-errors.rs:7:1
69+
--> $DIR/dropck-normalize-errors.rs:11:1
7070
|
7171
LL | trait NonImplementedTrait {
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>`
2+
--> $DIR/dropck-normalize-errors.rs:19:28
3+
|
4+
LL | fn make_a_decoder<'a>() -> ADecoder<'a> {
5+
| ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
6+
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/dropck-normalize-errors.rs:11:1
9+
|
10+
LL | trait NonImplementedTrait {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12+
note: required because it appears within the type `BDecoder`
13+
--> $DIR/dropck-normalize-errors.rs:30:12
14+
|
15+
LL | pub struct BDecoder {
16+
| ^^^^^^^^
17+
note: required because it appears within the type `ADecoder<'a>`
18+
--> $DIR/dropck-normalize-errors.rs:16:12
19+
|
20+
LL | pub struct ADecoder<'a> {
21+
| ^^^^^^^^
22+
= note: the return type of a function must have a statically known size
23+
24+
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder`
25+
--> $DIR/dropck-normalize-errors.rs:27:20
26+
|
27+
LL | type Decoder = BDecoder;
28+
| ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
29+
|
30+
help: this trait has no implementations, consider adding one
31+
--> $DIR/dropck-normalize-errors.rs:11:1
32+
|
33+
LL | trait NonImplementedTrait {
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
35+
note: required because it appears within the type `BDecoder`
36+
--> $DIR/dropck-normalize-errors.rs:30:12
37+
|
38+
LL | pub struct BDecoder {
39+
| ^^^^^^^^
40+
note: required by a bound in `Decode::Decoder`
41+
--> $DIR/dropck-normalize-errors.rs:8:5
42+
|
43+
LL | type Decoder;
44+
| ^^^^^^^^^^^^^ required by this bound in `Decode::Decoder`
45+
help: consider relaxing the implicit `Sized` restriction
46+
|
47+
LL | type Decoder: ?Sized;
48+
| ++++++++
49+
50+
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied
51+
--> $DIR/dropck-normalize-errors.rs:31:22
52+
|
53+
LL | non_implemented: <NonImplementedStruct as NonImplementedTrait>::Assoc,
54+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
55+
|
56+
help: this trait has no implementations, consider adding one
57+
--> $DIR/dropck-normalize-errors.rs:11:1
58+
|
59+
LL | trait NonImplementedTrait {
60+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
61+
62+
error: aborting due to 3 previous errors
63+
64+
For more information about this error, try `rustc --explain E0277`.

tests/ui/drop/dropck-normalize-errors.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Test that we don't ICE when computing the drop types for
22

3+
//@ ignore-compare-mode-polonius (explicit revisions)
4+
//@ revisions: nll polonius
5+
//@ [polonius] compile-flags: -Zpolonius=next
6+
37
trait Decode<'a> {
48
type Decoder;
59
}
@@ -14,7 +18,7 @@ pub struct ADecoder<'a> {
1418
}
1519
fn make_a_decoder<'a>() -> ADecoder<'a> {
1620
//~^ ERROR the trait bound
17-
//~| ERROR the trait bound
21+
//[nll]~| ERROR the trait bound
1822
panic!()
1923
}
2024

tests/ui/wf/hir-wf-check-erase-regions.stderr renamed to tests/ui/wf/hir-wf-check-erase-regions.nll.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: `&'a T` is not an iterator
2-
--> $DIR/hir-wf-check-erase-regions.rs:7:21
2+
--> $DIR/hir-wf-check-erase-regions.rs:11:21
33
|
44
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
@@ -11,7 +11,7 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter`
1111
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
1212

1313
error[E0277]: `&'a T` is not an iterator
14-
--> $DIR/hir-wf-check-erase-regions.rs:7:21
14+
--> $DIR/hir-wf-check-erase-regions.rs:11:21
1515
|
1616
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
@@ -23,7 +23,7 @@ note: required by a bound in `Flatten`
2323
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
2424

2525
error[E0277]: `&'a T` is not an iterator
26-
--> $DIR/hir-wf-check-erase-regions.rs:11:27
26+
--> $DIR/hir-wf-check-erase-regions.rs:15:27
2727
|
2828
LL | fn into_iter(self) -> Self::IntoIter {
2929
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
@@ -35,7 +35,7 @@ note: required by a bound in `Flatten`
3535
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
3636

3737
error[E0277]: `&T` is not an iterator
38-
--> $DIR/hir-wf-check-erase-regions.rs:11:27
38+
--> $DIR/hir-wf-check-erase-regions.rs:15:27
3939
|
4040
LL | fn into_iter(self) -> Self::IntoIter {
4141
| ^^^^^^^^^^^^^^ `&T` is not an iterator
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
error[E0277]: `&'a T` is not an iterator
2+
--> $DIR/hir-wf-check-erase-regions.rs:11:21
3+
|
4+
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
6+
|
7+
= help: the trait `Iterator` is not implemented for `&'a T`
8+
= help: the trait `Iterator` is implemented for `&mut I`
9+
= note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator`
10+
note: required by a bound in `std::iter::IntoIterator::IntoIter`
11+
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
12+
13+
error[E0277]: `&'a T` is not an iterator
14+
--> $DIR/hir-wf-check-erase-regions.rs:11:21
15+
|
16+
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
18+
|
19+
= help: the trait `Iterator` is not implemented for `&'a T`
20+
= help: the trait `Iterator` is implemented for `&mut I`
21+
= note: required for `&'a T` to implement `IntoIterator`
22+
note: required by a bound in `Flatten`
23+
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
24+
25+
error[E0277]: `&'a T` is not an iterator
26+
--> $DIR/hir-wf-check-erase-regions.rs:15:27
27+
|
28+
LL | fn into_iter(self) -> Self::IntoIter {
29+
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
30+
|
31+
= help: the trait `Iterator` is not implemented for `&'a T`
32+
= help: the trait `Iterator` is implemented for `&mut I`
33+
= note: required for `&'a T` to implement `IntoIterator`
34+
note: required by a bound in `Flatten`
35+
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
36+
37+
error: aborting due to 3 previous errors
38+
39+
For more information about this error, try `rustc --explain E0277`.

tests/ui/wf/hir-wf-check-erase-regions.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Regression test for #87549.
22
//@ incremental
33

4+
//@ ignore-compare-mode-polonius (explicit revisions)
5+
//@ revisions: nll polonius
6+
//@ [polonius] compile-flags: -Zpolonius=next
7+
48
pub struct Table<T, const N: usize>([Option<T>; N]);
59

610
impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> {
@@ -10,7 +14,7 @@ impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> {
1014

1115
fn into_iter(self) -> Self::IntoIter {
1216
//~^ ERROR `&'a T` is not an iterator
13-
//~| ERROR `&T` is not an iterator
17+
//[nll]~| ERROR `&T` is not an iterator
1418
unimplemented!()
1519
}
1620
}

0 commit comments

Comments
 (0)