7050: Ignore third punct when matching for 2-composite punct in mbe r=jonas-schievink a=edwin0cheng
Fixes #6692
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
let tt3 = self.next().unwrap().clone();
Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2, tt3] }.into())
}
- ('-', '=', None)
- | ('-', '>', None)
- | (':', ':', None)
- | ('!', '=', None)
- | ('.', '.', None)
- | ('*', '=', None)
- | ('/', '=', None)
- | ('&', '&', None)
- | ('&', '=', None)
- | ('%', '=', None)
- | ('^', '=', None)
- | ('+', '=', None)
- | ('<', '<', None)
- | ('<', '=', None)
- | ('=', '=', None)
- | ('=', '>', None)
- | ('>', '=', None)
- | ('>', '>', None)
- | ('|', '=', None)
- | ('|', '|', None) => {
+ ('-', '=', _)
+ | ('-', '>', _)
+ | (':', ':', _)
+ | ('!', '=', _)
+ | ('.', '.', _)
+ | ('*', '=', _)
+ | ('/', '=', _)
+ | ('&', '&', _)
+ | ('&', '=', _)
+ | ('%', '=', _)
+ | ('^', '=', _)
+ | ('+', '=', _)
+ | ('<', '<', _)
+ | ('<', '=', _)
+ | ('=', '=', _)
+ | ('=', '>', _)
+ | ('>', '=', _)
+ | ('>', '>', _)
+ | ('|', '=', _)
+ | ('|', '|', _) => {
let tt2 = self.next().unwrap().clone();
Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into())
}
);
}
+#[test]
+fn test_tt_with_composite_without_space() {
+ parse_macro(
+ r#"
+ macro_rules! foo {
+ ($ op:tt, $j:path) => (
+ 0
+ )
+ }
+"#,
+ )
+ // Test macro input without any spaces
+ // See https://github.com/rust-analyzer/rust-analyzer/issues/6692
+ .assert_expand_items("foo!(==,Foo::Bool)", "0");
+}
+
#[test]
fn test_underscore() {
parse_macro(