Repository: rust-lang/rust-analyzer
Pull request #18968 (2025-01-18 11:06:09)

fix: `cargo rustc --print` needs `unstable-options`


Patch:
diff --git a/crates/hir-def/src/body/lower.rs b/crates/hir-def/src/body/lower.rs
index 1327bb3ab5..d7e28da644 100644
--- a/crates/hir-def/src/body/lower.rs
+++ b/crates/hir-def/src/body/lower.rs
@@ -581,7 +581,10 @@ impl ExprCollector<'_> {
                 let mutability = if raw_tok {
                     if e.mut_token().is_some() {
                         Mutability::Mut
+                    } else if e.const_token().is_some() {
+                        Mutability::Shared
                     } else {
+                        never!("parser only remaps to raw_token() if matching mutability token follows");
                         Mutability::Shared
                     }
                 } else {
diff --git a/crates/ide-completion/src/completions/expr.rs b/crates/ide-completion/src/completions/expr.rs
index db18b531d7..c2e5eefe10 100644
--- a/crates/ide-completion/src/completions/expr.rs
+++ b/crates/ide-completion/src/completions/expr.rs
@@ -62,7 +62,6 @@ pub(crate) fn complete_expr_path(
         in_condition,
         incomplete_let,
         ref ref_expr_parent,
-        after_amp,
         ref is_func_update,
         ref innermost_ret_ty,
         ref impl_,
@@ -70,23 +69,8 @@ pub(crate) fn complete_expr_path(
         ..
     } = expr_ctx;
 
-    let (has_raw_token, has_const_token, has_mut_token) = ref_expr_parent
-        .as_ref()
-        .map(|it| (it.raw_token().is_some(), it.const_token().is_some(), it.mut_token().is_some()))
-        .unwrap_or((false, false, false));
-
-    let wants_raw_token = ref_expr_parent.is_some() && !has_raw_token && after_amp;
-    let wants_const_token =
-        ref_expr_parent.is_some() && has_raw_token && !has_const_token && !has_mut_token;
-    let wants_mut_token = if ref_expr_parent.is_some() {
-        if has_raw_token {
-            !has_const_token && !has_mut_token
-        } else {
-            !has_mut_token
-        }
-    } else {
-        false
-    };
+    let wants_mut_token =
+        ref_expr_parent.as_ref().map(|it| it.mut_token().is_none()).unwrap_or(false);
 
     let scope_def_applicable = |def| match def {
         ScopeDef::GenericParam(hir::GenericParam::LifetimeParam(_)) | ScopeDef::Label(_) => false,
@@ -370,12 +354,6 @@ pub(crate) fn complete_expr_path(
                         add_keyword("else if", "else if $1 {\n    $0\n}");
                     }
 
-                    if wants_raw_token {
-                        add_keyword("raw", "raw ");
-                    }
-                    if wants_const_token {
-                        add_keyword("const", "const ");
-                    }
                     if wants_mut_token {
                         add_keyword("mut", "mut ");
                     }
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index 3a2a4a23a1..461b1dc036 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -146,7 +146,6 @@ pub(crate) struct PathExprCtx {
     pub(crate) in_condition: bool,
     pub(crate) incomplete_let: bool,
     pub(crate) ref_expr_parent: Option<ast::RefExpr>,
-    pub(crate) after_amp: bool,
     /// The surrounding RecordExpression we are completing a functional update
     pub(crate) is_func_update: Option<ast::RecordExpr>,
     pub(crate) self_param: Option<hir::SelfParam>,
diff --git a/crates/ide-completion/src/context/analysis.rs b/crates/ide-completion/src/context/analysis.rs
index 3c4d489c0f..1a5609baf9 100644
--- a/crates/ide-completion/src/context/analysis.rs
+++ b/crates/ide-completion/src/context/analysis.rs
@@ -1151,9 +1151,6 @@ fn classify_name_ref(
         let after_if_expr = after_if_expr(it.clone());
         let ref_expr_parent =
             path.as_single_name_ref().and_then(|_| it.parent()).and_then(ast::RefExpr::cast);
-        let after_amp = non_trivia_sibling(it.clone().into(), Direction::Prev)
-            .map(|it| it.kind() == SyntaxKind::AMP)
-            .unwrap_or(false);
         let (innermost_ret_ty, self_param) = {
             let find_ret_ty = |it: SyntaxNode| {
                 if let Some(item) = ast::Item::cast(it.clone()) {
@@ -1223,7 +1220,6 @@ fn classify_name_ref(
                 after_if_expr,
                 in_condition,
                 ref_expr_parent,
-                after_amp,
                 is_func_update,
                 innermost_ret_ty,
                 self_param,
diff --git a/crates/parser/src/event.rs b/crates/parser/src/event.rs
index b197b086f3..e38571dd3e 100644
--- a/crates/parser/src/event.rs
+++ b/crates/parser/src/event.rs
@@ -12,7 +12,7 @@ use crate::{
 /// `Parser` produces a flat list of `Event`s.
 /// They are converted to a tree-structure in
 /// a separate pass, via `TreeBuilder`.
-#[derive(Debug, PartialEq)]
+#[derive(Debug)]
 pub(crate) enum Event {
     /// This event signifies the start of the node.
     /// It should be either abandoned (in which case the
diff --git a/crates/parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs
index 389c01933c..3b3f11be13 100644
--- a/crates/parser/src/grammar/expressions.rs
+++ b/crates/parser/src/grammar/expressions.rs
@@ -134,12 +134,10 @@ pub(super) fn let_stmt(p: &mut Parser<'_>, with_semi: Semicolon) {
         // test_err let_else_right_curly_brace
         // fn func() { let Some(_) = {Some(1)} else { panic!("h") };}
         if let Some(expr) = expr_after_eq {
-            if let Some(token) = expr.last_token(p) {
-                if token == T!['}'] {
-                    p.error(
-                        "right curly brace `}` before `else` in a `let...else` statement not allowed"
-                    )
-                }
+            if BlockLike::is_blocklike(expr.kind()) {
+                p.error(
+                    "right curly brace `}` before `else` in a `let...else` statement not allowed",
+                )
             }
         }
 
@@ -341,20 +339,13 @@ fn lhs(p: &mut Parser<'_>, r: Restrictions) -> Option<(CompletedMarker, BlockLik
         //     // raw reference operator
         //     let _ = &raw mut foo;
         //     let _ = &raw const foo;
-        //     let _ = &raw foo;
         // }
         T![&] => {
             m = p.start();
             p.bump(T![&]);
-            if p.at_contextual_kw(T![raw]) {
-                if [T![mut], T![const]].contains(&p.nth(1)) {
-                    p.bump_remap(T![raw]);
-                    p.bump_any();
-                } else if p.nth_at(1, SyntaxKind::IDENT) {
-                    // we treat raw as keyword in this case
-                    // &raw foo;
-                    p.bump_remap(T![raw]);
-                }
+            if p.at_contextual_kw(T![raw]) && [T![mut], T![const]].contains(&p.nth(1)) {
+                p.bump_remap(T![raw]);
+                p.bump_any();
             } else {
                 p.eat(T![mut]);
             }
diff --git a/crates/parser/src/parser.rs b/crates/parser/src/parser.rs
index 2f6ba52574..75a75f601c 100644
--- a/crates/parser/src/parser.rs
+++ b/crates/parser/src/parser.rs
@@ -318,8 +318,7 @@ impl Marker {
             _ => unreachable!(),
         }
         p.push_event(Event::Finish);
-        let end_pos = p.events.len() as u32;
-        CompletedMarker::new(self.pos, end_pos, kind)
+        CompletedMarker::new(self.pos, kind)
     }
 
     /// Abandons the syntax tree node. All its children
@@ -337,14 +336,13 @@ impl Marker {
 }
 
 pub(crate) struct CompletedMarker {
-    start_pos: u32,
-    end_pos: u32,
+    pos: u32,
     kind: SyntaxKind,
 }
 
 impl CompletedMarker {
-    fn new(start_pos: u32, end_pos: u32, kind: SyntaxKind) -> Self {
-        CompletedMarker { start_pos, end_pos, kind }
+    fn new(pos: u32, kind: SyntaxKind) -> Self {
+        CompletedMarker { pos, kind }
     }
 
     /// This method allows to create a new node which starts
@@ -362,10 +360,10 @@ impl CompletedMarker {
     /// distance to `NEWSTART` into forward_parent(=2 in this case);
     pub(crate) fn precede(self, p: &mut Parser<'_>) -> Marker {
         let new_pos = p.start();
-        let idx = self.start_pos as usize;
+        let idx = self.pos as usize;
         match &mut p.events[idx] {
             Event::Start { forward_parent, .. } => {
-                *forward_parent = Some(new_pos.pos - self.start_pos);
+                *forward_parent = Some(new_pos.pos - self.pos);
             }
             _ => unreachable!(),
         }
@@ -378,7 +376,7 @@ impl CompletedMarker {
         let idx = m.pos as usize;
         match &mut p.events[idx] {
             Event::Start { forward_parent, .. } => {
-                *forward_parent = Some(self.start_pos - m.pos);
+                *forward_parent = Some(self.pos - m.pos);
             }
             _ => unreachable!(),
         }
@@ -388,13 +386,4 @@ impl CompletedMarker {
     pub(crate) fn kind(&self) -> SyntaxKind {
         self.kind
     }
-
-    pub(crate) fn last_token(&self, p: &Parser<'_>) -> Option<SyntaxKind> {
-        let end_pos = self.end_pos as usize;
-        debug_assert_eq!(p.events[end_pos - 1], Event::Finish);
-        p.events[..end_pos].iter().rev().find_map(|event| match event {
-            Event::Token { kind, .. } => Some(*kind),
-            _ => None,
-        })
-    }
 }
diff --git a/crates/profile/Cargo.toml b/crates/profile/Cargo.toml
index 5eb746f86a..2e3413f339 100644
--- a/crates/profile/Cargo.toml
+++ b/crates/profile/Cargo.toml
@@ -21,11 +21,7 @@ jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = tr
 perf-event = "=0.4.7"
 
 [target.'cfg(windows)'.dependencies]
-windows-sys = { version = "0.52", features = [
-    "Win32_Foundation",
-    "Win32_System_Threading",
-    "Win32_System_ProcessStatus",
-] }
+windows-sys = { version = "0.52", features = ["Win32_System_Threading", "Win32_System_ProcessStatus"] }
 
 [features]
 cpu_profiler = []
diff --git a/crates/project-model/src/toolchain_info/rustc_cfg.rs b/crates/project-model/src/toolchain_info/rustc_cfg.rs
index afcc812079..4bf9b59e7d 100644
--- a/crates/project-model/src/toolchain_info/rustc_cfg.rs
+++ b/crates/project-model/src/toolchain_info/rustc_cfg.rs
@@ -66,7 +66,7 @@ fn rustc_print_cfg(
         QueryConfig::Cargo(sysroot, cargo_toml) => {
             let mut cmd = sysroot.tool(Tool::Cargo, cargo_toml.parent());
             cmd.envs(extra_env);
-            cmd.args(["rustc"]).args(RUSTC_ARGS);
+            cmd.args(["rustc", "-Z", "unstable-options"]).args(RUSTC_ARGS);
             if let Some(target) = target {
                 cmd.args(["--target", target]);
             }
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 3dc4379258..9d8dbfc7a4 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -582,7 +582,7 @@ config_data! {
         cargo_buildScripts_useRustcWrapper: bool = true,
         /// List of cfg options to enable with the given values.
         cargo_cfgs: Vec<String> = {
-            vec!["debug_assertions".into(), "miri".into()]
+            vec!["debug_assertion".into(), "miri".into()]
         },
         /// Extra arguments that are passed to every cargo invocation.
         cargo_extraArgs: Vec<String> = vec![],
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index bd091db58d..2b518e0609 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -95,7 +95,7 @@ avoid checking unnecessary things.
 Default:
 ----
 [
-  "debug_assertions",
+  "debug_assertion",
   "miri"
 ]
 ----
diff --git a/editors/code/package.json b/editors/code/package.json
index 8b066377f2..48e29a7fe2 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -816,7 +816,7 @@
                     "rust-analyzer.cargo.cfgs": {
                         "markdownDescription": "List of cfg options to enable with the given values.",
                         "default": [
-                            "debug_assertions",
+                            "debug_assertion",
                             "miri"
                         ],
                         "type": "array",


Test patch:
diff --git a/crates/ide-completion/src/tests/expression.rs b/crates/ide-completion/src/tests/expression.rs
index e117dbf4bd..d0dc6206f4 100644
--- a/crates/ide-completion/src/tests/expression.rs
+++ b/crates/ide-completion/src/tests/expression.rs
@@ -66,7 +66,6 @@ fn baz() {
             kw loop
             kw match
             kw mut
-            kw raw
             kw return
             kw self::
             kw true
@@ -437,114 +436,6 @@ fn completes_in_let_initializer() {
     )
 }
 
-#[test]
-fn completes_after_ref_expr() {
-    check(
-        r#"fn main() { let _ = &$0 }"#,
-        expect![[r#"
-            fn main() fn()
-            bt u32     u32
-            kw crate::
-            kw false
-            kw for
-            kw if
-            kw if let
-            kw loop
-            kw match
-            kw mut
-            kw raw
-            kw return
-            kw self::
-            kw true
-            kw unsafe
-            kw while
-            kw while let
-        "#]],
-    );
-    check(
-        r#"fn main() { let _ = &raw $0 }"#,
-        expect![[r#"
-            fn main() fn()
-            bt u32     u32
-            kw const
-            kw crate::
-            kw false
-            kw for
-            kw if
-            kw if let
-            kw loop
-            kw match
-            kw mut
-            kw return
-            kw self::
-            kw true
-            kw unsafe
-            kw while
-            kw while let
-        "#]],
-    );
-    check(
-        r#"fn main() { let _ = &raw const $0 }"#,
-        expect![[r#"
-            fn main() fn()
-            bt u32     u32
-            kw crate::
-            kw false
-            kw for
-            kw if
-            kw if let
-            kw loop
-            kw match
-            kw return
-            kw self::
-            kw true
-            kw unsafe
-            kw while
-            kw while let
-        "#]],
-    );
-    check(
-        r#"fn main() { let _ = &raw mut $0 }"#,
-        expect![[r#"
-            fn main() fn()
-            bt u32     u32
-            kw crate::
-            kw false
-            kw for
-            kw if
-            kw if let
-            kw loop
-            kw match
-            kw return
-            kw self::
-            kw true
-            kw unsafe
-            kw while
-            kw while let
-        "#]],
-    );
-    check(
-        r#"fn main() { let _ = &mut $0 }"#,
-        expect![[r#"
-            fn main() fn()
-            bt u32     u32
-            kw crate::
-            kw false
-            kw for
-            kw if
-            kw if let
-            kw loop
-            kw match
-            kw return
-            kw self::
-            kw true
-            kw unsafe
-            kw while
-            kw while let
-        "#]],
-    )
-}
-
 #[test]
 fn struct_initializer_field_expr() {
     check(
diff --git a/crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rast b/crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rast
deleted file mode 100644
index 578dc2b0f9..0000000000
--- a/crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rast
+++ /dev/null
@@ -1,79 +0,0 @@
-SOURCE_FILE
-  STRUCT
-    STRUCT_KW "struct"
-    WHITESPACE " "
-    NAME
-      IDENT "X"
-    WHITESPACE " "
-    RECORD_FIELD_LIST
-      L_CURLY "{"
-      RECORD_FIELD
-        NAME
-          IDENT "a"
-        COLON ":"
-        WHITESPACE " "
-        PATH_TYPE
-          PATH
-            PATH_SEGMENT
-              NAME_REF
-                IDENT "i32"
-      R_CURLY "}"
-  WHITESPACE "\n"
-  FN
-    FN_KW "fn"
-    WHITESPACE " "
-    NAME
-      IDENT "f"
-    PARAM_LIST
-      L_PAREN "("
-      R_PAREN ")"
-    WHITESPACE " "
-    BLOCK_EXPR
-      STMT_LIST
-        L_CURLY "{"
-        WHITESPACE "\n    "
-        LET_STMT
-          LET_KW "let"
-          WHITESPACE " "
-          IDENT_PAT
-            NAME
-              IDENT "foo"
-          WHITESPACE " "
-          EQ "="
-          WHITESPACE " "
-          RECORD_EXPR
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "X"
-            WHITESPACE " "
-            RECORD_EXPR_FIELD_LIST
-              L_CURLY "{"
-              WHITESPACE "\n        "
-              RECORD_EXPR_FIELD
-                NAME_REF
-                  IDENT "a"
-                COLON ":"
-                WHITESPACE " "
-                LITERAL
-                  INT_NUMBER "1"
-              WHITESPACE "\n    "
-              R_CURLY "}"
-          WHITESPACE " "
-          LET_ELSE
-            ELSE_KW "else"
-            WHITESPACE " "
-            BLOCK_EXPR
-              STMT_LIST
-                L_CURLY "{"
-                WHITESPACE "\n        "
-                EXPR_STMT
-                  RETURN_EXPR
-                    RETURN_KW "return"
-                  SEMICOLON ";"
-                WHITESPACE "\n    "
-                R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n"
-        R_CURLY "}"
-error 63: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rs b/crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rs
deleted file mode 100644
index c0c0edc983..0000000000
--- a/crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-struct X {a: i32}
-fn f() {
-    let foo = X {
-        a: 1
-    } else {
-        return;
-    };
-}
\ No newline at end of file
diff --git a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rast b/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rast
deleted file mode 100644
index 8e994f22d4..0000000000
--- a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rast
+++ /dev/null
@@ -1,42 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    BIN_EXPR
-      LITERAL
-        INT_NUMBER "1"
-      WHITESPACE " "
-      PLUS "+"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          LITERAL
-            INT_NUMBER "1"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 23: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rs b/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rs
deleted file mode 100644
index c29ddcce1f..0000000000
--- a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = 1 + {
-    1
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rast b/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rast
deleted file mode 100644
index 055b583ace..0000000000
--- a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rast
+++ /dev/null
@@ -1,90 +0,0 @@
-SOURCE_FILE
-  FN
-    FN_KW "fn"
-    WHITESPACE " "
-    NAME
-      IDENT "r"
-    PARAM_LIST
-      L_PAREN "("
-      R_PAREN ")"
-    WHITESPACE " "
-    BLOCK_EXPR
-      STMT_LIST
-        L_CURLY "{"
-        WHITESPACE "\n    "
-        LET_STMT
-          LET_KW "let"
-          WHITESPACE " "
-          IDENT_PAT
-            NAME
-              IDENT "ok"
-          WHITESPACE " "
-          EQ "="
-          WHITESPACE " "
-          MACRO_EXPR
-            MACRO_CALL
-              PATH
-                PATH_SEGMENT
-                  NAME_REF
-                    IDENT "format_args"
-              BANG "!"
-              TOKEN_TREE
-                L_PAREN "("
-                STRING "\"\""
-                R_PAREN ")"
-          WHITESPACE " "
-          LET_ELSE
-            ELSE_KW "else"
-            WHITESPACE " "
-            BLOCK_EXPR
-              STMT_LIST
-                L_CURLY "{"
-                WHITESPACE " "
-                EXPR_STMT
-                  RETURN_EXPR
-                    RETURN_KW "return"
-                  SEMICOLON ";"
-                WHITESPACE " "
-                R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n\n    "
-        LET_STMT
-          LET_KW "let"
-          WHITESPACE " "
-          IDENT_PAT
-            NAME
-              IDENT "bad"
-          WHITESPACE " "
-          EQ "="
-          WHITESPACE " "
-          MACRO_EXPR
-            MACRO_CALL
-              PATH
-                PATH_SEGMENT
-                  NAME_REF
-                    IDENT "format_args"
-              BANG "!"
-              WHITESPACE " "
-              TOKEN_TREE
-                L_CURLY "{"
-                STRING "\"\""
-                R_CURLY "}"
-          WHITESPACE " "
-          LET_ELSE
-            ELSE_KW "else"
-            WHITESPACE " "
-            BLOCK_EXPR
-              STMT_LIST
-                L_CURLY "{"
-                WHITESPACE " "
-                EXPR_STMT
-                  RETURN_EXPR
-                    RETURN_KW "return"
-                  SEMICOLON ";"
-                WHITESPACE " "
-                R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n"
-        R_CURLY "}"
-  WHITESPACE "\n"
-error 89: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rs b/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rs
deleted file mode 100644
index 5916fa07dc..0000000000
--- a/crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn r() {
-    let ok = format_args!("") else { return; };
-
-    let bad = format_args! {""} else { return; };
-}
diff --git a/crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rast b/crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rast
deleted file mode 100644
index 8c7fd8c295..0000000000
--- a/crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rast
+++ /dev/null
@@ -1,40 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    RANGE_EXPR
-      LITERAL
-        INT_NUMBER "1"
-      DOT2 ".."
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          LITERAL
-            INT_NUMBER "1"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 22: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rs b/crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rs
deleted file mode 100644
index 5417131d28..0000000000
--- a/crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = 1..{
-    1
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rast b/crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rast
deleted file mode 100644
index 57925a0d19..0000000000
--- a/crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rast
+++ /dev/null
@@ -1,55 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    CLOSURE_EXPR
-      PARAM_LIST
-        PIPE "|"
-        PARAM
-          IDENT_PAT
-            NAME
-              IDENT "x"
-          COLON ":"
-          WHITESPACE " "
-          PATH_TYPE
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "i32"
-        PIPE "|"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          PATH_EXPR
-            PATH
-              PATH_SEGMENT
-                NAME_REF
-                  IDENT "x"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 28: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rs b/crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rs
deleted file mode 100644
index 89c7579b07..0000000000
--- a/crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = |x: i32| {
-    x
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rast b/crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rast
deleted file mode 100644
index 4fb70bd50e..0000000000
--- a/crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rast
+++ /dev/null
@@ -1,38 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    PREFIX_EXPR
-      MINUS "-"
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          LITERAL
-            INT_NUMBER "1"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 20: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rs b/crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rs
deleted file mode 100644
index 1ba7f7d761..0000000000
--- a/crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = -{
-    1
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/err/0061_let_else_right_curly_brace_do_yeet.rast b/crates/parser/test_data/parser/err/0061_let_else_right_curly_brace_do_yeet.rast
deleted file mode 100644
index e8eeeee695..0000000000
--- a/crates/parser/test_data/parser/err/0061_let_else_right_curly_brace_do_yeet.rast
+++ /dev/null
@@ -1,90 +0,0 @@
-SOURCE_FILE
-  FN
-    FN_KW "fn"
-    WHITESPACE " "
-    NAME
-      IDENT "o"
-    PARAM_LIST
-      L_PAREN "("
-      R_PAREN ")"
-    WHITESPACE " "
-    RET_TYPE
-      THIN_ARROW "->"
-      WHITESPACE " "
-      PATH_TYPE
-        PATH
-          PATH_SEGMENT
-            NAME_REF
-              IDENT "Result"
-            GENERIC_ARG_LIST
-              L_ANGLE "<"
-              TYPE_ARG
-                TUPLE_TYPE
-                  L_PAREN "("
-                  R_PAREN ")"
-              COMMA ","
-              WHITESPACE " "
-              TYPE_ARG
-                TUPLE_TYPE
-                  L_PAREN "("
-                  R_PAREN ")"
-              R_ANGLE ">"
-    WHITESPACE " "
-    BLOCK_EXPR
-      STMT_LIST
-        L_CURLY "{"
-        WHITESPACE "\n    "
-        LET_STMT
-          LET_KW "let"
-          WHITESPACE " "
-          IDENT_PAT
-            NAME
-              IDENT "foo"
-          WHITESPACE " "
-          EQ "="
-          WHITESPACE " "
-          YEET_EXPR
-            DO_KW "do"
-            WHITESPACE " "
-            YEET_KW "yeet"
-            WHITESPACE " "
-            BLOCK_EXPR
-              STMT_LIST
-                L_CURLY "{"
-                WHITESPACE "\n        "
-                TUPLE_EXPR
-                  L_PAREN "("
-                  R_PAREN ")"
-                WHITESPACE "\n    "
-                R_CURLY "}"
-          WHITESPACE " "
-          LET_ELSE
-            ELSE_KW "else"
-            WHITESPACE " "
-            BLOCK_EXPR
-              STMT_LIST
-                L_CURLY "{"
-                WHITESPACE "\n        "
-                EXPR_STMT
-                  RETURN_EXPR
-                    RETURN_KW "return"
-                    WHITESPACE " "
-                    CALL_EXPR
-                      PATH_EXPR
-                        PATH
-                          PATH_SEGMENT
-                            NAME_REF
-                              IDENT "Ok"
-                      ARG_LIST
-                        L_PAREN "("
-                        TUPLE_EXPR
-                          L_PAREN "("
-                          R_PAREN ")"
-                        R_PAREN ")"
-                  SEMICOLON ";"
-                WHITESPACE "\n    "
-                R_CURLY "}"
-          SEMICOLON ";"
-        WHITESPACE "\n"
-        R_CURLY "}"
-error 67: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0061_let_else_right_curly_brace_do_yeet.rs b/crates/parser/test_data/parser/err/0061_let_else_right_curly_brace_do_yeet.rs
deleted file mode 100644
index 188fb07d91..0000000000
--- a/crates/parser/test_data/parser/err/0061_let_else_right_curly_brace_do_yeet.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn o() -> Result<(), ()> {
-    let foo = do yeet {
-        ()
-    } else {
-        return Ok(());
-    };
-}
\ No newline at end of file
diff --git a/crates/parser/test_data/parser/err/0062_let_else_right_curly_brace_become.rast b/crates/parser/test_data/parser/err/0062_let_else_right_curly_brace_become.rast
deleted file mode 100644
index cc5e1278c3..0000000000
--- a/crates/parser/test_data/parser/err/0062_let_else_right_curly_brace_become.rast
+++ /dev/null
@@ -1,40 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    BECOME_EXPR
-      BECOME_KW "become"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          TUPLE_EXPR
-            L_PAREN "("
-            R_PAREN ")"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 27: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0062_let_else_right_curly_brace_become.rs b/crates/parser/test_data/parser/err/0062_let_else_right_curly_brace_become.rs
deleted file mode 100644
index 622548b8f3..0000000000
--- a/crates/parser/test_data/parser/err/0062_let_else_right_curly_brace_become.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = become {
-    ()
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/err/0063_let_else_right_curly_brace_reference.rast b/crates/parser/test_data/parser/err/0063_let_else_right_curly_brace_reference.rast
deleted file mode 100644
index ea2f4f28e2..0000000000
--- a/crates/parser/test_data/parser/err/0063_let_else_right_curly_brace_reference.rast
+++ /dev/null
@@ -1,38 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    REF_EXPR
-      AMP "&"
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          LITERAL
-            INT_NUMBER "1"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 20: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0063_let_else_right_curly_brace_reference.rs b/crates/parser/test_data/parser/err/0063_let_else_right_curly_brace_reference.rs
deleted file mode 100644
index 9a00dca368..0000000000
--- a/crates/parser/test_data/parser/err/0063_let_else_right_curly_brace_reference.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = &{
-    1
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/err/0064_let_else_right_curly_brace_assignment.rast b/crates/parser/test_data/parser/err/0064_let_else_right_curly_brace_assignment.rast
deleted file mode 100644
index 47396140c5..0000000000
--- a/crates/parser/test_data/parser/err/0064_let_else_right_curly_brace_assignment.rast
+++ /dev/null
@@ -1,45 +0,0 @@
-SOURCE_FILE
-  ERROR
-    LET_KW "let"
-    WHITESPACE " "
-    IDENT_PAT
-      NAME
-        IDENT "foo"
-    WHITESPACE " "
-    EQ "="
-    WHITESPACE " "
-    BIN_EXPR
-      PATH_EXPR
-        PATH
-          PATH_SEGMENT
-            NAME_REF
-              IDENT "bar"
-      WHITESPACE " "
-      EQ "="
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          LITERAL
-            INT_NUMBER "1"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    WHITESPACE " "
-    LET_ELSE
-      ELSE_KW "else"
-      WHITESPACE " "
-      BLOCK_EXPR
-        STMT_LIST
-          L_CURLY "{"
-          WHITESPACE "\n    "
-          EXPR_STMT
-            RETURN_EXPR
-              RETURN_KW "return"
-            SEMICOLON ";"
-          WHITESPACE "\n"
-          R_CURLY "}"
-    SEMICOLON ";"
-  WHITESPACE "\n"
-error 0: expected an item
-error 25: right curly brace `}` before `else` in a `let...else` statement not allowed
diff --git a/crates/parser/test_data/parser/err/0064_let_else_right_curly_brace_assignment.rs b/crates/parser/test_data/parser/err/0064_let_else_right_curly_brace_assignment.rs
deleted file mode 100644
index 08e677416f..0000000000
--- a/crates/parser/test_data/parser/err/0064_let_else_right_curly_brace_assignment.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-let foo = bar = {
-    1
-} else {
-    return;
-};
diff --git a/crates/parser/test_data/parser/inline/ok/ref_expr.rast b/crates/parser/test_data/parser/inline/ok/ref_expr.rast
index 8dc916e5cc..108b0802c3 100644
--- a/crates/parser/test_data/parser/inline/ok/ref_expr.rast
+++ b/crates/parser/test_data/parser/inline/ok/ref_expr.rast
@@ -134,25 +134,6 @@ SOURCE_FILE
                   NAME_REF
                     IDENT "foo"
           SEMICOLON ";"
-        WHITESPACE "\n    "
-        LET_STMT
-          LET_KW "let"
-          WHITESPACE " "
-          WILDCARD_PAT
-            UNDERSCORE "_"
-          WHITESPACE " "
-          EQ "="
-          WHITESPACE " "
-          REF_EXPR
-            AMP "&"
-            RAW_KW "raw"
-            WHITESPACE " "
-            PATH_EXPR
-              PATH
-                PATH_SEGMENT
-                  NAME_REF
-                    IDENT "foo"
-          SEMICOLON ";"
         WHITESPACE "\n"
         R_CURLY "}"
   WHITESPACE "\n"
diff --git a/crates/parser/test_data/parser/inline/ok/ref_expr.rs b/crates/parser/test_data/parser/inline/ok/ref_expr.rs
index 31a2485b43..c5262f4469 100644
--- a/crates/parser/test_data/parser/inline/ok/ref_expr.rs
+++ b/crates/parser/test_data/parser/inline/ok/ref_expr.rs
@@ -7,5 +7,4 @@ fn foo() {
     // raw reference operator
     let _ = &raw mut foo;
     let _ = &raw const foo;
-    let _ = &raw foo;
 }