Skip to content

Odd rust-analyzer syntax error #4829

Closed
Closed
@RalfJung

Description

@RalfJung

Right now, rust-analyzer is complaining about the syntax in this function that is totally fine for cargo check:

    fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
        if let StatementKind::Assign(box (into, _)) = &statement.kind {
            debug!(
                "visit_statement: statement={:?} local={:?} \
                    never_initialized_mut_locals={:?}",
                statement, into.local, self.never_initialized_mut_locals
            );
            self.remove_never_initialized_mut_locals(*into);
        }

        self.super_statement(statement, location);
    }

In the super_statement line, it says

{
	"resource": "/home/r/src/rust/rustc.3/src/librustc_mir/borrow_check/used_muts.rs",
	"owner": "_generated_diagnostic_collection_name_#0",
	"severity": 8,
	"message": "Syntax Error: expected field name or number",
	"source": "rust-analyzer",
	"startLineNumber": 92,
	"startColumn": 14,
	"endLineNumber": 92,
	"endColumn": 14
}
{
	"resource": "/home/r/src/rust/rustc.3/src/librustc_mir/borrow_check/used_muts.rs",
	"owner": "_generated_diagnostic_collection_name_#0",
	"severity": 8,
	"message": "Syntax Error: expected SEMICOLON",
	"source": "rust-analyzer",
	"startLineNumber": 92,
	"startColumn": 14,
	"endLineNumber": 92,
	"endColumn": 14
}

I presume this has something to do with it getting confused while I was typing, and then not properly recovering when I was done typing... the error appeared while I was adding that super_statement line, and it went away after I did "reload window".

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-unknownIt's unclear if the issue is E-hard or E-easy without digging inS-unactionableIssue requires feedback, design decisions or is blocked on other work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions