-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #83654 - JohnTitor:issue-83606, r=estebank
Do not emit a suggestion that causes the E0632 error Fixes #83606
- Loading branch information
Showing
3 changed files
with
47 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Regression test for #83606. | ||
|
||
fn foo<const N: usize>(_: impl std::fmt::Display) -> [usize; N] { | ||
[0; N] | ||
} | ||
|
||
fn main() { | ||
let _ = foo("foo"); //<- Do not suggest `foo::<N>("foo");`! | ||
//~^ ERROR: type annotations needed for `[usize; _]` | ||
} |
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[E0282]: type annotations needed for `[usize; _]` | ||
--> $DIR/issue-83606.rs:8:13 | ||
| | ||
LL | let _ = foo("foo"); //<- Do not suggest `foo::<N>("foo");`! | ||
| - ^^^ cannot infer the value of const parameter `N` declared on the function `foo` | ||
| | | ||
| consider giving this pattern the explicit type `[usize; _]`, where the type parameter `N` is specified | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |