Skip to content

TypeMismatch quickfix position error #22152

Closed

Description

@A4-Tacks

rust-analyzer version: rust-analyzer 0.3.2870-standalone

rustc version: rustc 1.97.0-nightly (913e4bea8 2026-04-22)

editor or extension: Vim

code snippet to reproduce:

fn main() {
    if true { "".to_owned() } else { "" };
    if true { "".to_owned() } else { "" }.to_owned(); // fixed
    if false { "" } else { "".to_owned() };
    if false { "" } else &{ "".to_owned() }; // fixed
    if false { Some(2) } else { 2 };
    if false { Some(2) } else Some({ 2 }); // fixed
}

Similar to #19428, but not a macro, which may be easier to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingC-bugCategory: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions