-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Description
#![feature(min_const_generics)]
struct Foo<const M: usize>;
macro_rules! baz {
( $x:expr) => {
Foo<$x> //[full]~ ERROR constant expression depends
}
}
fn test<const N: usize>() {
let _: baz!(N);
}
fails with
error: expressions must be enclosed in braces to be used as const generic arguments
--> src/lib.rs:9:17
|
9 | let _: baz!(N);
| ^
|
help: enclose the `const` expression in braces
|
9 | let _: baz!({ N });
|
This should be allowed. See the discussion in https://github.com/rust-lang/rust/pull/78916/files#r520390092 for more details.
As fixing this should allow strictly more code to compile, this won't require a breaking change. I do not consider this to be blocking stabilization.
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.