about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-20 12:59:02 +0000
committerbors <bors@rust-lang.org>2024-06-20 12:59:02 +0000
commit9b8b6f92b21e27d26ae334f091cab90f9f9678e5 (patch)
tree98928555d409e669f80030cd854a2d1d11bc2323
parent48b6f28b0e1051b6e525d7e6cc32c6bfe983cef2 (diff)
parentedd66a754e646a9b17a5b2a71632b4e933a7dafe (diff)
downloadrust-9b8b6f92b21e27d26ae334f091cab90f9f9678e5.tar.gz
rust-9b8b6f92b21e27d26ae334f091cab90f9f9678e5.zip
Auto merge of #17464 - wyatt-herkamp:fix-actix-macro, r=lnicola
Check that Expr is none before adding fixup

Closes #17463
-rw-r--r--src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs b/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs
index eadb2e19d12..9fdf4aa4f7c 100644
--- a/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs
+++ b/src/tools/rust-analyzer/crates/hir-expand/src/fixup.rs
@@ -277,7 +277,7 @@ pub(crate) fn fixup_syntax(
                 },
                 ast::RecordExprField(it) => {
                     if let Some(colon) = it.colon_token() {
-                        if it.name_ref().is_some() {
+                        if it.name_ref().is_some() && it.expr().is_none() {
                             append.insert(colon.into(), vec![
                                 Leaf::Ident(Ident {
                                     text: "__ra_fixup".into(),
@@ -844,6 +844,20 @@ fn foo () {R {f : __ra_fixup}}
     }
 
     #[test]
+    fn no_fixup_record_ctor_field() {
+        check(
+            r#"
+fn foo() {
+    R { f: a }
+}
+"#,
+            expect![[r#"
+fn foo () {R {f : a}}
+"#]],
+        )
+    }
+
+    #[test]
     fn fixup_arg_list() {
         check(
             r#"