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.
Auto merge of rust-lang#79734 - ethanboxx:inferred_const_note, r=varkor
Const parameters can not be inferred with `_` help note This should close: rust-lang#79557 # Example output ``` error[E0747]: type provided when a constant was expected --> inferred_const_note.rs:6:19 | 6 | let a = foo::<_, 2>([0, 1, 2]); | ^ | = help: Const parameters can not be inferred with `_` error: aborting due to previous error For more information about this error, try `rustc --explain E0747`. ``` r? `@lcnr`
- Loading branch information
Showing
4 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
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
8 changes: 8 additions & 0 deletions
8
src/test/ui/const-generics/min_const_generics/inferred_const.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,8 @@ | ||
#![feature(min_const_generics)] | ||
fn foo<const N: usize, const K: usize>(data: [u32; N]) -> [u32; K] { | ||
[0; K] | ||
} | ||
fn main() { | ||
let a = foo::<_, 2>([0, 1, 2]); | ||
//~^ ERROR type provided when a constant was expected | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/min_const_generics/inferred_const.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,11 @@ | ||
error[E0747]: type provided when a constant was expected | ||
--> $DIR/inferred_const.rs:6:19 | ||
| | ||
LL | let a = foo::<_, 2>([0, 1, 2]); | ||
| ^ | ||
| | ||
= help: const arguments cannot yet be inferred with `_` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0747`. |