Skip to content

Compileable code still reports an issue in rust-analyzer #18974

Closed
@matzipan

Description

@matzipan

rust-analyzer version: 0.3.2264

rustc version: rustc 1.86.0-nightly (6067b3631 2025-01-17)

editor or extension: VS code

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): https://github.com/lox-space/lox

code snippet to reproduce:

#[derive(PartialEq, Clone, Debug)]
pub enum KvnDeserializerErr<I> {
    InvalidDateTimeFormat { input: I },
    InvalidNumberFormat { input: I },
    InvalidStringFormat { input: I },
    InvalidStateVectorFormat { input: I },
    InvalidCovarianceMatrixFormat { input: I },
    KeywordNotFound { expected: I },
    // Has a second meaning: it stops the iterator for vector type deserializers
    UnexpectedKeyword { found: I, expected: I },
    EmptyKeyword { input: I },
    EmptyValue { input: I },
    UnexpectedEndOfInput { keyword: I },
}

fn bla() -> bool {
    let _x: Result<i32, KvnDeserializerErr<String>> =
        Err(KvnDeserializerErr::<String>::UnexpectedKeyword {
            found: "aa".to_string(),
            expected: "COMMENT_LIST".to_string(),
        });

    return false;
}

The following code compiles fine, but rust-analyzer is finding this issue: "generic arguments are not allowed on modules" https://doc.rust-lang.org/stable/error_codes/E0109.html.

This is even more odd since KvnDeserializerErr is not a module in the first place.

Metadata

Metadata

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions