We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
const
1 parent cebeda3 commit acc2154Copy full SHA for acc2154
compiler/rustc_parse/src/parser/nonterminal.rs
@@ -27,6 +27,8 @@ impl<'a> Parser<'a> {
27
token.can_begin_expr()
28
// This exception is here for backwards compatibility.
29
&& !token.is_keyword(kw::Let)
30
+ // This exception is here for backwards compatibility.
31
+ && !token.is_keyword(kw::Const)
32
}
33
NonterminalKind::Ty => token.can_begin_type(),
34
NonterminalKind::Ident => get_macro_ident(token).is_some(),
src/test/ui/inline-const/macro-with-const.rs
@@ -0,0 +1,20 @@
1
+// check-pass
2
+
3
+macro_rules! exp {
4
+ (const $n:expr) => {
5
+ $n
6
+ };
7
+}
8
9
+macro_rules! stmt {
10
+ (exp $e:expr) => {
11
+ $e
12
13
+ (exp $($t:tt)+) => {
14
+ exp!($($t)+)
15
16
17
18
+fn main() {
19
+ stmt!(exp const 1);
20
0 commit comments