Skip to content

Commit 80bac8a

Browse files
authored
Rollup merge of #161330 - zakrad:regr-test-159559, r=JohnTitor
Add regression test for nested RPIT not an iterator ICE Closes #159559
2 parents 3432c9f + ceeaac0 commit 80bac8a

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/159559>.
2+
//! Reporting the `E0277` for the unsatisfied `IntoIterator` bound on the
3+
//! nested opaque type used to ICE ("Normalizing ... without wrapping in a
4+
//! `Binder`") in the RPIT method-chain suggestion when the return type
5+
//! captures a lifetime.
6+
7+
trait Cap<'a> {}
8+
9+
impl<T> Cap<'_> for T {}
10+
11+
fn fail_late_bound<'a>(
12+
a: &u8,
13+
_: &'a u8,
14+
) -> impl IntoIterator<Item = impl Cap<'a> + IntoIterator<Item = impl Cap<'a>>> {
15+
//~^ ERROR `&u8` is not an iterator
16+
[a]
17+
}
18+
19+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0277]: `&u8` is not an iterator
2+
--> $DIR/nested-rpit-not-iterator-ice-159559.rs:14:31
3+
|
4+
LL | ) -> impl IntoIterator<Item = impl Cap<'a> + IntoIterator<Item = impl Cap<'a>>> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&u8` is not an iterator
6+
|
7+
= help: the trait `Iterator` is not implemented for `&u8`
8+
= note: required for `&u8` to implement `IntoIterator`
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)