forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for ice rust-lang#119275 "no entry found for key" in predica…
…tes_of.rs fixes rust-lang#119275
- Loading branch information
1 parent
b0e1008
commit bd2d70d
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
.../ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs
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,18 @@ | ||
// test for ICE #119275 "no entry found for key" in predicates_of.rs | ||
|
||
#![feature(generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
|
||
fn bug<const N: Nat>(&self) | ||
//~^ ERROR `self` parameter is only allowed in associated functions | ||
//~^^ ERROR cannot find type `Nat` in this scope | ||
where | ||
for<const N: usize = 3, T = u32> [(); COT::BYTES]:, | ||
//~^ ERROR only lifetime parameters can be used in this context | ||
//~^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders | ||
//~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders | ||
//~^^^^ ERROR failed to resolve: use of undeclared type `COT` | ||
{ | ||
} | ||
|
||
pub fn main() {} |
46 changes: 46 additions & 0 deletions
46
...const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr
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,46 @@ | ||
error: `self` parameter is only allowed in associated functions | ||
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:6:22 | ||
| | ||
LL | fn bug<const N: Nat>(&self) | ||
| ^^^^^ not semantically valid as function parameter | ||
| | ||
= note: associated functions are those in `impl` or `trait` definitions | ||
|
||
error[E0412]: cannot find type `Nat` in this scope | ||
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:6:17 | ||
| | ||
LL | fn bug<const N: Nat>(&self) | ||
| ^^^ not found in this scope | ||
|
||
error[E0658]: only lifetime parameters can be used in this context | ||
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:15 | ||
| | ||
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:, | ||
| ^ ^ | ||
| | ||
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information | ||
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error: defaults for generic parameters are not allowed in `for<...>` binders | ||
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:9 | ||
| | ||
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:, | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: defaults for generic parameters are not allowed in `for<...>` binders | ||
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:29 | ||
| | ||
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:, | ||
| ^^^^^^^ | ||
|
||
error[E0433]: failed to resolve: use of undeclared type `COT` | ||
--> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:43 | ||
| | ||
LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:, | ||
| ^^^ use of undeclared type `COT` | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors have detailed explanations: E0412, E0433, E0658. | ||
For more information about an error, try `rustc --explain E0412`. |