Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6c71e59

Browse files
matthiaskrgrRenjiSann
authored andcommittedMar 25, 2024
add test for opaque type with non-universal region substs rust-lang#101852
Fixes rust-lang#101852
1 parent 2f8b324 commit 6c71e59

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// issue: rust-lang/rust#101852
2+
// ICE opaque type with non-universal region substs
3+
4+
pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
5+
//~^ WARN function cannot return without recursing
6+
vec![].append(&mut ice(x.as_ref()));
7+
//~^ ERROR expected generic type parameter, found `&str`
8+
9+
Vec::new()
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning: function cannot return without recursing
2+
--> $DIR/recursive-ice-101862.rs:4:1
3+
|
4+
LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6+
LL |
7+
LL | vec![].append(&mut ice(x.as_ref()));
8+
| --------------- recursive call site
9+
|
10+
= help: a `loop` may express intention better if this is on purpose
11+
= note: `#[warn(unconditional_recursion)]` on by default
12+
13+
error[E0792]: expected generic type parameter, found `&str`
14+
--> $DIR/recursive-ice-101862.rs:6:5
15+
|
16+
LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
17+
| --------------- this generic parameter must be used with a generic type parameter
18+
LL |
19+
LL | vec![].append(&mut ice(x.as_ref()));
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
error: aborting due to 1 previous error; 1 warning emitted
23+
24+
For more information about this error, try `rustc --explain E0792`.

0 commit comments

Comments
 (0)
Please sign in to comment.