Skip to content

Commit 20eda09

Browse files
committed
Fix fail to parse :: for meta in mbe
1 parent 3d662e3 commit 20eda09

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)