-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.const-generics-bad-diagnosticsAn error is correctly emitted, but is confusing, for `min_const_generics`.An error is correctly emitted, but is confusing, for `min_const_generics`.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
cc @varkor @rust-lang/wg-diagnostics
Say we have:
#![feature(const_generics)]
fn foo<const N: usize>() {}
fn bar() {
foo::<1 + 1>();
}
the parser now greets you with:
error: expected one of `,` or `>`, found `+`
--> src/lib.rs:6:13
|
6 | foo::<1 + 1>();
| ^ expected one of `,` or `>` here
It would be good if you got:
error: expected one of `,` or `>`, found `+`
--> src/lib.rs:6:13
|
6 | foo::<1 + 1>();
| ^ expected one of `,` or `>` here
|
| help: wrap the expression in a block:
6 | foo::<{1 + 1}>();
or some such.
estebank, vadixidav and jonhoo
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-const_generics`#![feature(const_generics)]``#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.const-generics-bad-diagnosticsAn error is correctly emitted, but is confusing, for `min_const_generics`.An error is correctly emitted, but is confusing, for `min_const_generics`.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.