Merge #3892
3892: Add L_DOLLAR for TYPE_RECOVERY_SET r=matklad a=edwin0cheng This PR is a hot fix for issue #3861 that just prevent it make the parser being stuck. The actual problem described in https://github.com/rust-analyzer/rust-analyzer/pull/3873#issuecomment-610208693 is a very deep rabbit hole I don't want to dig right now :( Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
9aa3bca536
@ -1614,6 +1614,23 @@ macro_rules! my_macro {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_issue_3861() {
|
||||
let macro_fixture = parse_macro(
|
||||
r#"
|
||||
macro_rules! rgb_color {
|
||||
($p:expr, $t: ty) => {
|
||||
pub fn new() {
|
||||
let _ = 0 as $t << $p;
|
||||
}
|
||||
};
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
||||
macro_fixture.expand_items(r#"rgb_color!(8 + 8, u32);"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_repeat_bad_var() {
|
||||
// FIXME: the second rule of the macro should be removed and an error about
|
||||
|
@ -7,7 +7,7 @@
|
||||
DYN_KW, L_ANGLE,
|
||||
]);
|
||||
|
||||
const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA];
|
||||
const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR];
|
||||
|
||||
pub(crate) fn type_(p: &mut Parser) {
|
||||
type_with_bounds_cond(p, true);
|
||||
|
Loading…
Reference in New Issue
Block a user