You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime --> src/main.rs:5:33 |5 | let _ = 0 as $ty << 1; | ^...10 | m!(u8); | ------ in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
Ordinarily this would not be valid syntax
typeType = u8;fnf(){let _ = 0asType << 1;}
error: `<<` is interpreted as a start of generic arguments for `Type`, not a shift --> src/main.rs:4:23 |4 | let _ = 0 as Type << 1; | ^^ - interpreted as generic arguments | | | not interpreted as shift |help: try shifting the cast value |4 | let _ = (0 as Type) << 1; | + +
but the presence of a macro metavariable behaves like invisible parentheses, which makes it into:
typeType = u8;fnf(){let _ = 0as(Type) << 1;}
which is supposed to be valid (warn(unused_parens) notwithstanding).
warning: unnecessary parentheses around type --> src/main.rs:4:18 |4 | let _ = 0 as (Type) << 1; | ^ ^ | = note: `#[warn(unused_parens)]` on by defaulthelp: remove these parentheses |4 - let _ = 0 as (Type) << 1;4 + let _ = 0 as Type << 1; |
The text was updated successfully, but these errors were encountered:
Rustc's parser allows this, but syn does not.
Ordinarily this would not be valid syntax
but the presence of a macro metavariable behaves like invisible parentheses, which makes it into:
which is supposed to be valid (
warn(unused_parens)
notwithstanding).The text was updated successfully, but these errors were encountered: