Skip to content

Commit 750d3cb

Browse files
Merge #7887
7887: Fix fail to parse :: for meta in mbe r=edwin0cheng a=edwin0cheng fixes #7886 bors r+ Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2 parents 94012e2 + 20eda09 commit 750d3cb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/mbe/src/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,8 @@ fn test_meta() {
954954
.assert_expand_items(
955955
r#"foo! { cfg(target_os = "windows") }"#,
956956
r#"# [cfg (target_os = "windows")] fn bar () {}"#,
957-
);
957+
)
958+
.assert_expand_items(r#"foo! { hello::world }"#, r#"# [hello :: world] fn bar () {}"#);
958959
}
959960

960961
#[test]

crates/parser/src/grammar.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub(crate) mod fragments {
9595
// https://doc.rust-lang.org/reference/paths.html#simple-paths
9696
// The start of an meta must be a simple path
9797
match p.current() {
98-
IDENT | T![::] | T![super] | T![self] | T![crate] => p.bump_any(),
98+
IDENT | T![super] | T![self] | T![crate] => p.bump_any(),
9999
T![=] => {
100100
p.bump_any();
101101
match p.current() {
@@ -105,6 +105,7 @@ pub(crate) mod fragments {
105105
}
106106
break;
107107
}
108+
_ if p.at(T![::]) => p.bump(T![::]),
108109
_ => break,
109110
}
110111
}

0 commit comments

Comments
 (0)