diff options
| author | Jonas Schievink <jonas.schievink@ferrous-systems.com> | 2022-05-13 15:04:15 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonas.schievink@ferrous-systems.com> | 2022-05-13 15:04:36 +0200 |
| commit | 73e0e17b520b61c6016c8ef8247a70cdda0e9f97 (patch) | |
| tree | 1ac46aeb3e62a72b99fcaf3cb5207feca2179be8 | |
| parent | da969635a4a6e2eed930dc81f565390a70512192 (diff) | |
| download | rust-73e0e17b520b61c6016c8ef8247a70cdda0e9f97.tar.gz rust-73e0e17b520b61c6016c8ef8247a70cdda0e9f97.zip | |
Revert "Don't remap float tokens to `INT_NUMBER`"
This reverts commit cb5e8da88a06be415bd804884284c11c0a709bcf.
| -rw-r--r-- | crates/hir-def/src/macro_expansion_tests/proc_macros.rs | 2 | ||||
| -rw-r--r-- | crates/mbe/src/syntax_bridge.rs | 2 | ||||
| -rw-r--r-- | crates/parser/src/grammar.rs | 4 | ||||
| -rw-r--r-- | crates/parser/test_data/parser/inline/ok/0011_field_expr.rast | 6 |
4 files changed, 4 insertions, 10 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/proc_macros.rs b/crates/hir-def/src/macro_expansion_tests/proc_macros.rs index e4b065d0203..a4448329209 100644 --- a/crates/hir-def/src/macro_expansion_tests/proc_macros.rs +++ b/crates/hir-def/src/macro_expansion_tests/proc_macros.rs @@ -104,7 +104,6 @@ macro_rules! id { $($t)* }; } - id! { #[proc_macros::identity] impl Foo for WrapBj { @@ -120,7 +119,6 @@ macro_rules! id { $($t)* }; } - #[proc_macros::identity] impl Foo for WrapBj { async fn foo(&self ) { self .0.id().await ; diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs index 361633e39d2..fb6f8d66c6d 100644 --- a/crates/mbe/src/syntax_bridge.rs +++ b/crates/mbe/src/syntax_bridge.rs @@ -243,8 +243,6 @@ fn convert_tokens<C: TokenConvertor>(conv: &mut C) -> tt::Subtree { let char = match token.to_char(conv) { Some(c) => c, None => { - // FIXME: this isn't really correct, `to_char` yields the *first* char of the token, - // and this is relevant when eg. creating 2 `tt::Punct` from a single `::` token panic!("Token from lexer must be single char: token = {:#?}", token); } }; diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index 4ebf2157c66..f68d7196c86 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -324,9 +324,7 @@ fn name_ref_or_index(p: &mut Parser) { ); let m = p.start(); if p.at(FLOAT_NUMBER_PART) || p.at_ts(FLOAT_LITERAL_FIRST) { - // Ideally we'd remap this to `INT_NUMBER` instead, but that causes the MBE conversion to - // lose track of what's a float and what isn't, causing panics. - p.bump_remap(FLOAT_NUMBER_PART); + p.bump_remap(INT_NUMBER); } else { p.bump_any(); } diff --git a/crates/parser/test_data/parser/inline/ok/0011_field_expr.rast b/crates/parser/test_data/parser/inline/ok/0011_field_expr.rast index a1efb3a9fb2..19fab593fab 100644 --- a/crates/parser/test_data/parser/inline/ok/0011_field_expr.rast +++ b/crates/parser/test_data/parser/inline/ok/0011_field_expr.rast @@ -50,7 +50,7 @@ SOURCE_FILE IDENT "x" DOT "." NAME_REF - FLOAT_NUMBER_PART "0" + INT_NUMBER "0" DOT "." WHITESPACE " " NAME_REF @@ -67,10 +67,10 @@ SOURCE_FILE IDENT "x" DOT "." NAME_REF - FLOAT_NUMBER_PART "0" + INT_NUMBER "0" DOT "." NAME_REF - FLOAT_NUMBER_PART "1" + INT_NUMBER "1" SEMICOLON ";" WHITESPACE "\n " EXPR_STMT |
