Skip to content

Matching against byte ranges produces error #21112

@stefnotch

Description

@stefnotch

Since the new r-a nightly, the following code snippet

match 0u8 {
        b'0'..=b'9' => true,
        _ => false,
    };

produces

expected u8, found RangeInclusive<u8> rust-analyzer[E0308](https://doc.rust-lang.org/stable/error_codes/E0308.html)

rust-analyzer version: rust-analyzer version: 0.4.2689-standalone (eaaa2da 2025-11-20) [c:\Users\Stefnotch.vscode\extensions\rust-lang.rust-analyzer-0.4.2689\server\rust-analyzer.exe]

rustc version: rustc 1.91.1 (ed61e7d7e 2025-11-07)

editor or extension VSCode

This is a very recent regression. It did not happen with rust-lang.rust-analyzer-0.4.2688-win32-x64.vsix. It only started happening with rust-lang.rust-analyzer-0.4.2689-win32-x64.vsix

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

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

fn main() {
    let byte: u8 = 0u8;
    let b = match byte {
        b'0'..=b'9' => true,
        _ => false,
    };
    println!("{b}");
}

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