diff --git a/crates/hir-def/src/macro_expansion_tests/mbe.rs b/crates/hir-def/src/macro_expansion_tests/mbe.rs index 8e01920483..befef6547c 100644 --- a/crates/hir-def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir-def/src/macro_expansion_tests/mbe.rs @@ -48,6 +48,8 @@ struct#10 MyTraitMap2#32 {#13 #[test] fn token_mapping_floats() { + // Regression test for https://github.com/rust-lang/rust-analyzer/issues/12216 + // (and related issues) check( r#" // +tokenids @@ -87,9 +89,9 @@ macro_rules! f {#0 // } fn#19 main#20(#21)#21 {#22 1#23;#24 - 1#26.0; - let x#31 =#22 1; -} + 1.0#25;#26 + let#27 x#28 =#29 1#30;#31 +}#22 "##]], 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 a444832920..72c44a0fbc 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,7 @@ macro_rules! id { $($t)* }; } -id! { +id /*+errors*/! { #[proc_macros::identity] impl Foo for WrapBj { async fn foo(&self) { @@ -119,6 +119,7 @@ macro_rules! id { $($t)* }; } +/* parse error: expected SEMICOLON */ #[proc_macros::identity] impl Foo for WrapBj { async fn foo(&self ) { self .0.id().await ; diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs index 4a058ac261..fbf3278ad1 100644 --- a/crates/ide-completion/src/context.rs +++ b/crates/ide-completion/src/context.rs @@ -1062,7 +1062,7 @@ impl<'a> CompletionContext<'a> { let receiver_is_ambiguous_float_literal = match &receiver { Some(ast::Expr::Literal(l)) => matches! { l.kind(), - ast::LiteralKind::FloatNumber { .. } if l.syntax().last_token().map_or(false, |it| it.kind() == T![.]) + ast::LiteralKind::FloatNumber { .. } if l.syntax().last_token().map_or(false, |it| it.text().ends_with('.')) }, _ => false, };