Skip to content

Commit b0e1008

Browse files
committed
add test for ice #113017 no entry found for key in generics_of.rs
Fixes #113017
1 parent d7e166d commit b0e1008

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// test for ICE "no entry found for key" in generics_of.rs #113017
2+
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
6+
pub fn String<V>(elem)
7+
//~^ ERROR expected one of `:`, `@`, or `|`, found `)`
8+
where
9+
V: 'a,
10+
//~^ ERROR use of undeclared lifetime name `'a`
11+
for<const N: usize = { || {}}> V: 'a,
12+
//~^ ERROR use of undeclared lifetime name `'a`
13+
//~^^ ERROR only lifetime parameters can be used in this context
14+
//~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
15+
for<C2: , R2, R3: > <&str as IntoIterator>::Item: 'static,
16+
//~^ ERROR `&` without an explicit lifetime name cannot be used here
17+
//~^^ ERROR only lifetime parameters can be used in this context
18+
{}
19+
20+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
error: expected one of `:`, `@`, or `|`, found `)`
2+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:6:22
3+
|
4+
LL | pub fn String<V>(elem)
5+
| ^ expected one of `:`, `@`, or `|`
6+
|
7+
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
8+
help: if this is a `self` type, give it a parameter name
9+
|
10+
LL | pub fn String<V>(self: elem)
11+
| +++++
12+
help: if this is a parameter name, give it a type
13+
|
14+
LL | pub fn String<V>(elem: TypeName)
15+
| ++++++++++
16+
help: if this is a type, explicitly ignore the parameter name
17+
|
18+
LL | pub fn String<V>(_: elem)
19+
| ++
20+
21+
error[E0261]: use of undeclared lifetime name `'a`
22+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:9:8
23+
|
24+
LL | V: 'a,
25+
| ^^ undeclared lifetime
26+
|
27+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
28+
help: consider making the bound lifetime-generic with a new `'a` lifetime
29+
|
30+
LL | for<'a> V: 'a,
31+
| +++++++
32+
help: consider introducing lifetime `'a` here
33+
|
34+
LL | pub fn String<'a, V>(elem)
35+
| +++
36+
37+
error[E0261]: use of undeclared lifetime name `'a`
38+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:39
39+
|
40+
LL | for<const N: usize = { || {}}> V: 'a,
41+
| ^^ undeclared lifetime
42+
|
43+
help: consider making the bound lifetime-generic with a new `'a` lifetime
44+
|
45+
LL | for<'a, const N: usize = { || {}}> V: 'a,
46+
| +++
47+
help: consider introducing lifetime `'a` here
48+
|
49+
LL | pub fn String<'a, V>(elem)
50+
| +++
51+
52+
error[E0637]: `&` without an explicit lifetime name cannot be used here
53+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:15:26
54+
|
55+
LL | for<C2: , R2, R3: > <&str as IntoIterator>::Item: 'static,
56+
| ^ explicit lifetime name needed here
57+
|
58+
help: consider introducing a higher-ranked lifetime here
59+
|
60+
LL | for<'a> for<C2: , R2, R3: > <&'a str as IntoIterator>::Item: 'static,
61+
| +++++++ ++
62+
63+
error[E0658]: only lifetime parameters can be used in this context
64+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:15
65+
|
66+
LL | for<const N: usize = { || {}}> V: 'a,
67+
| ^
68+
|
69+
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
70+
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
71+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
72+
73+
error[E0658]: only lifetime parameters can be used in this context
74+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:15:9
75+
|
76+
LL | for<C2: , R2, R3: > <&str as IntoIterator>::Item: 'static,
77+
| ^^ ^^ ^^
78+
|
79+
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
80+
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
81+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
82+
83+
error: defaults for generic parameters are not allowed in `for<...>` binders
84+
--> $DIR/ice-generics_of-no-entry-found-for-key-113017.rs:11:9
85+
|
86+
LL | for<const N: usize = { || {}}> V: 'a,
87+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
88+
89+
error: aborting due to 7 previous errors
90+
91+
Some errors have detailed explanations: E0261, E0637, E0658.
92+
For more information about an error, try `rustc --explain E0261`.

0 commit comments

Comments
 (0)