-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest turbofish for uninferred const argument
- Loading branch information
Showing
12 changed files
with
110 additions
and
8 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
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
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
14 changes: 14 additions & 0 deletions
14
src/test/ui/const-generics/infer/one-param-uninferred.full.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,14 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/one-param-uninferred.rs:15:23 | ||
| | ||
LL | let _: [u8; 17] = foo(); | ||
| ^^^ cannot infer the value of const parameter `M` declared on the function `foo` | ||
| | ||
help: consider specifying the const argument | ||
| | ||
LL | let _: [u8; 17] = foo::<M>(); | ||
| ^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |
14 changes: 14 additions & 0 deletions
14
src/test/ui/const-generics/infer/one-param-uninferred.min.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,14 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/one-param-uninferred.rs:15:23 | ||
| | ||
LL | let _: [u8; 17] = foo(); | ||
| ^^^ cannot infer the value of const parameter `M` declared on the function `foo` | ||
| | ||
help: consider specifying the const argument | ||
| | ||
LL | let _: [u8; 17] = foo::<M>(); | ||
| ^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |
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,17 @@ | ||
// Test that we emit an error if we cannot properly infer a constant. | ||
// revisions: full min | ||
|
||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
#![cfg_attr(min, feature(min_const_generics))] | ||
|
||
fn foo<const N: usize, const M: usize>() -> [u8; N] { | ||
todo!() | ||
} | ||
|
||
fn main() { | ||
// FIXME(const_generics): Currently this only suggests one const parameter, | ||
// but instead it should suggest to provide all parameters. | ||
let _: [u8; 17] = foo(); | ||
//~^ ERROR type annotations needed | ||
} |
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
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