-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not ICE on HIR based WF check when involving lifetimes
Fix #87549.
- Loading branch information
1 parent
3fd3b42
commit 23c82af
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Regression test for #87549. | ||
// compile-flags: -C incremental=tmp/wf/hir-wf-check-erase-regions | ||
|
||
pub struct Table<T, const N: usize>([Option<T>; N]); | ||
|
||
impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> { | ||
type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&T` is not an iterator | ||
type Item = &'a T; | ||
|
||
fn into_iter(self) -> Self::IntoIter { //~ ERROR `&T` is not an iterator | ||
unimplemented!() | ||
} | ||
} | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
error[E0277]: `&T` is not an iterator | ||
--> $DIR/hir-wf-check-erase-regions.rs:7:5 | ||
| | ||
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator | ||
| | ||
::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL | ||
| | ||
LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { | ||
| ------------ required by this bound in `Flatten` | ||
| | ||
= help: the trait `Iterator` is not implemented for `&T` | ||
= note: required because of the requirements on the impl of `IntoIterator` for `&T` | ||
|
||
error[E0277]: `&T` is not an iterator | ||
--> $DIR/hir-wf-check-erase-regions.rs:10:27 | ||
| | ||
LL | fn into_iter(self) -> Self::IntoIter { | ||
| ^^^^^^^^^^^^^^ `&T` is not an iterator | ||
| | ||
::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL | ||
| | ||
LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { | ||
| ------------ required by this bound in `Flatten` | ||
| | ||
= help: the trait `Iterator` is not implemented for `&T` | ||
= note: required because of the requirements on the impl of `IntoIterator` for `&T` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |