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. Sometimes this causes
NLLs to emit a duplicate error as well.
This commit is contained in:
Rémy Rakic 2025-03-24 07:09:18 +00:00
parent 43327b5da6
commit f4094ea252
6 changed files with 129 additions and 18 deletions

View file

@ -1,44 +1,44 @@
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>`
--> $DIR/dropck-normalize-errors.rs:15:28
--> $DIR/dropck-normalize-errors.rs:19:28
|
LL | fn make_a_decoder<'a>() -> ADecoder<'a> {
| ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:7:1
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `BDecoder`
--> $DIR/dropck-normalize-errors.rs:26:12
--> $DIR/dropck-normalize-errors.rs:30:12
|
LL | pub struct BDecoder {
| ^^^^^^^^
note: required because it appears within the type `ADecoder<'a>`
--> $DIR/dropck-normalize-errors.rs:12:12
--> $DIR/dropck-normalize-errors.rs:16:12
|
LL | pub struct ADecoder<'a> {
| ^^^^^^^^
= note: the return type of a function must have a statically known size
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder`
--> $DIR/dropck-normalize-errors.rs:23:20
--> $DIR/dropck-normalize-errors.rs:27:20
|
LL | type Decoder = BDecoder;
| ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:7:1
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `BDecoder`
--> $DIR/dropck-normalize-errors.rs:26:12
--> $DIR/dropck-normalize-errors.rs:30:12
|
LL | pub struct BDecoder {
| ^^^^^^^^
note: required by a bound in `Decode::Decoder`
--> $DIR/dropck-normalize-errors.rs:4:5
--> $DIR/dropck-normalize-errors.rs:8:5
|
LL | type Decoder;
| ^^^^^^^^^^^^^ required by this bound in `Decode::Decoder`
@ -48,25 +48,25 @@ LL | type Decoder: ?Sized;
| ++++++++
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied
--> $DIR/dropck-normalize-errors.rs:27:22
--> $DIR/dropck-normalize-errors.rs:31:22
|
LL | non_implemented: <NonImplementedStruct as NonImplementedTrait>::Assoc,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:7:1
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied
--> $DIR/dropck-normalize-errors.rs:15:28
--> $DIR/dropck-normalize-errors.rs:19:28
|
LL | fn make_a_decoder<'a>() -> ADecoder<'a> {
| ^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:7:1
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,64 @@
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `ADecoder<'a>`
--> $DIR/dropck-normalize-errors.rs:19:28
|
LL | fn make_a_decoder<'a>() -> ADecoder<'a> {
| ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `BDecoder`
--> $DIR/dropck-normalize-errors.rs:30:12
|
LL | pub struct BDecoder {
| ^^^^^^^^
note: required because it appears within the type `ADecoder<'a>`
--> $DIR/dropck-normalize-errors.rs:16:12
|
LL | pub struct ADecoder<'a> {
| ^^^^^^^^
= note: the return type of a function must have a statically known size
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied in `BDecoder`
--> $DIR/dropck-normalize-errors.rs:27:20
|
LL | type Decoder = BDecoder;
| ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `BDecoder`
--> $DIR/dropck-normalize-errors.rs:30:12
|
LL | pub struct BDecoder {
| ^^^^^^^^
note: required by a bound in `Decode::Decoder`
--> $DIR/dropck-normalize-errors.rs:8:5
|
LL | type Decoder;
| ^^^^^^^^^^^^^ required by this bound in `Decode::Decoder`
help: consider relaxing the implicit `Sized` restriction
|
LL | type Decoder: ?Sized;
| ++++++++
error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not satisfied
--> $DIR/dropck-normalize-errors.rs:31:22
|
LL | non_implemented: <NonImplementedStruct as NonImplementedTrait>::Assoc,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct`
|
help: this trait has no implementations, consider adding one
--> $DIR/dropck-normalize-errors.rs:11:1
|
LL | trait NonImplementedTrait {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,5 +1,9 @@
// Test that we don't ICE when computing the drop types for
//@ ignore-compare-mode-polonius (explicit revisions)
//@ revisions: nll polonius
//@ [polonius] compile-flags: -Zpolonius=next
trait Decode<'a> {
type Decoder;
}
@ -14,7 +18,7 @@ pub struct ADecoder<'a> {
}
fn make_a_decoder<'a>() -> ADecoder<'a> {
//~^ ERROR the trait bound
//~| ERROR the trait bound
//[nll]~| ERROR the trait bound
panic!()
}

View file

@ -1,5 +1,5 @@
error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:7:21
--> $DIR/hir-wf-check-erase-regions.rs:11:21
|
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
@ -11,7 +11,7 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:7:5
--> $DIR/hir-wf-check-erase-regions.rs:11:5
|
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
| ^^^^^^^^^^^^^ `&'a T` is not an iterator
@ -23,7 +23,7 @@ note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:11:27
--> $DIR/hir-wf-check-erase-regions.rs:15:27
|
LL | fn into_iter(self) -> Self::IntoIter {
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
@ -35,7 +35,7 @@ note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
error[E0277]: `&T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:11:27
--> $DIR/hir-wf-check-erase-regions.rs:15:27
|
LL | fn into_iter(self) -> Self::IntoIter {
| ^^^^^^^^^^^^^^ `&T` is not an iterator

View file

@ -0,0 +1,39 @@
error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:11:21
|
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
|
= help: the trait `Iterator` is not implemented for `&'a T`
= help: the trait `Iterator` is implemented for `&mut I`
= note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator`
note: required by a bound in `std::iter::IntoIterator::IntoIter`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:11:5
|
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
| ^^^^^^^^^^^^^ `&'a T` is not an iterator
|
= help: the trait `Iterator` is not implemented for `&'a T`
= help: the trait `Iterator` is implemented for `&mut I`
= note: required for `&'a T` to implement `IntoIterator`
note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
error[E0277]: `&'a T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:15:27
|
LL | fn into_iter(self) -> Self::IntoIter {
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
|
= help: the trait `Iterator` is not implemented for `&'a T`
= help: the trait `Iterator` is implemented for `&mut I`
= note: required for `&'a T` to implement `IntoIterator`
note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.

View file

@ -1,6 +1,10 @@
// Regression test for #87549.
//@ incremental
//@ ignore-compare-mode-polonius (explicit revisions)
//@ revisions: nll polonius
//@ [polonius] compile-flags: -Zpolonius=next
pub struct Table<T, const N: usize>([Option<T>; N]);
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> {
fn into_iter(self) -> Self::IntoIter {
//~^ ERROR `&'a T` is not an iterator
//~| ERROR `&T` is not an iterator
//[nll]~| ERROR `&T` is not an iterator
unimplemented!()
}
}