Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RA fails to resolve type of match arm identifier #19046

Open
facefaceless opened this issue Jan 27, 2025 · 3 comments
Open

RA fails to resolve type of match arm identifier #19046

facefaceless opened this issue Jan 27, 2025 · 3 comments
Labels
C-bug Category: bug

Comments

@facefaceless
Copy link

rust-analyzer version: 0.3.2282-standalone (2df4ecf 2025-01-26)

rustc version: rustc 1.83.0 (90b35a623 2024-11-26)

editor or extension: VSCode extension version 0.3.2282

code snippet to reproduce:

fn need_bytes_mut(_: &mut [u8]) {}

fn main() {
    let mut string = String::new();
    match unsafe { string.as_bytes_mut() } {
        [] => {}
        bytes => {
            need_bytes_mut(bytes);
        }
    }
}

The code compiles, but type hint for bytes is unkown and RA reports an error. If line 6 is deleted, everything will be fine.

Image

And str's method as_bytes_mut is not resolved, no auto-comple, no quick doc lookup.

@facefaceless facefaceless added the C-bug Category: bug label Jan 27, 2025
@ChayimFriedman2
Copy link
Contributor

It works fine for me. Perhaps you have a corrupted sysroot? Try rustup component remove rust-src then rustup component install rust-src.

@Veykril

This comment has been minimized.

@facefaceless
Copy link
Author

It works fine for me. Perhaps you have a corrupted sysroot? Try rustup component remove rust-src then rustup component install rust-src.

Thanks for your advice. I tried and it doesn't work. The earlier version of vscode RA extension
0.3.2273 works fine.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants