Skip to content

Commit bd2d70d

Browse files
committed
add test for ice rust-lang#119275 "no entry found for key" in predicates_of.rs
fixes rust-lang#119275
1 parent b0e1008 commit bd2d70d

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// test for ICE #119275 "no entry found for key" in predicates_of.rs
2+
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
6+
fn bug<const N: Nat>(&self)
7+
//~^ ERROR `self` parameter is only allowed in associated functions
8+
//~^^ ERROR cannot find type `Nat` in this scope
9+
where
10+
for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
11+
//~^ ERROR only lifetime parameters can be used in this context
12+
//~^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
13+
//~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
14+
//~^^^^ ERROR failed to resolve: use of undeclared type `COT`
15+
{
16+
}
17+
18+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: `self` parameter is only allowed in associated functions
2+
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:6:22
3+
|
4+
LL | fn bug<const N: Nat>(&self)
5+
| ^^^^^ not semantically valid as function parameter
6+
|
7+
= note: associated functions are those in `impl` or `trait` definitions
8+
9+
error[E0412]: cannot find type `Nat` in this scope
10+
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:6:17
11+
|
12+
LL | fn bug<const N: Nat>(&self)
13+
| ^^^ not found in this scope
14+
15+
error[E0658]: only lifetime parameters can be used in this context
16+
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:15
17+
|
18+
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
19+
| ^ ^
20+
|
21+
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
22+
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
23+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
24+
25+
error: defaults for generic parameters are not allowed in `for<...>` binders
26+
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:9
27+
|
28+
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
29+
| ^^^^^^^^^^^^^^^^^^
30+
31+
error: defaults for generic parameters are not allowed in `for<...>` binders
32+
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:29
33+
|
34+
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
35+
| ^^^^^^^
36+
37+
error[E0433]: failed to resolve: use of undeclared type `COT`
38+
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:43
39+
|
40+
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
41+
| ^^^ use of undeclared type `COT`
42+
43+
error: aborting due to 6 previous errors
44+
45+
Some errors have detailed explanations: E0412, E0433, E0658.
46+
For more information about an error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)