mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 20:34:06 +00:00
extend macro braces test
This commit is contained in:
parent
b5c37e86ff
commit
5f2a627f89
@ -9,6 +9,17 @@ help: enclose the `const` expression in braces
|
||||
LL | let _: baz!({ N });
|
||||
| ^ ^
|
||||
|
||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
||||
--> $DIR/macro_rules-braces.rs:54:17
|
||||
|
|
||||
LL | let _: baz!(10 + 7);
|
||||
| ^^^^^^
|
||||
|
|
||||
help: enclose the `const` expression in braces
|
||||
|
|
||||
LL | let _: baz!({ 10 + 7 });
|
||||
| ^ ^
|
||||
|
||||
error: constant expression depends on a generic parameter
|
||||
--> $DIR/macro_rules-braces.rs:10:13
|
||||
|
|
||||
@ -57,5 +68,5 @@ LL | let _: biz!({ N });
|
||||
= note: this may fail depending on what value the parameter takes
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -9,6 +9,17 @@ help: enclose the `const` expression in braces
|
||||
LL | let _: baz!({ N });
|
||||
| ^ ^
|
||||
|
||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
||||
--> $DIR/macro_rules-braces.rs:54:17
|
||||
|
|
||||
LL | let _: baz!(10 + 7);
|
||||
| ^^^^^^
|
||||
|
|
||||
help: enclose the `const` expression in braces
|
||||
|
|
||||
LL | let _: baz!({ 10 + 7 });
|
||||
| ^ ^
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/macro_rules-braces.rs:31:20
|
||||
|
|
||||
@ -41,5 +52,5 @@ LL | let _: biz!({ N });
|
||||
|
|
||||
= help: const parameters may only be used as standalone arguments, i.e. `N`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -36,6 +36,26 @@ fn test<const N: usize>() {
|
||||
let _: baz!({{ N }}); //[min]~ ERROR generic parameters may not
|
||||
let _: biz!(N);
|
||||
let _: biz!({ N }); //[min]~ ERROR generic parameters may not
|
||||
let _: foo!(3);
|
||||
let _: foo!({ 3 });
|
||||
let _: foo!({{ 3 }});
|
||||
let _: bar!(3);
|
||||
let _: bar!({ 3 });
|
||||
let _: baz!(3);
|
||||
let _: baz!({ 3 });
|
||||
let _: baz!({{ 3 }});
|
||||
let _: biz!(3);
|
||||
let _: biz!({ 3 });
|
||||
let _: foo!(10 + 7);
|
||||
let _: foo!({ 10 + 7 });
|
||||
let _: foo!({{ 10 + 7 }});
|
||||
let _: bar!(10 + 7);
|
||||
let _: bar!({ 10 + 7 });
|
||||
let _: baz!(10 + 7); //~ ERROR expressions must be enclosed in braces
|
||||
let _: baz!({ 10 + 7 });
|
||||
let _: baz!({{ 10 + 7 }});
|
||||
let _: biz!(10 + 7);
|
||||
let _: biz!({ 10 + 7 });
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user