Skip to content

RA enable miri by default and cannot disable it #16122

New issue

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

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

Already on GitHub? Sign in to your account

Closed
Tracked by #16346
huang-jl opened this issue Dec 14, 2023 · 3 comments · Fixed by #17108
Closed
Tracked by #16346

RA enable miri by default and cannot disable it #16122

huang-jl opened this issue Dec 14, 2023 · 3 comments · Fixed by #17108
Labels
C-support Category: support questions

Comments

@huang-jl
Copy link

I am reading codes of rust-vmm project, there is a code snippet like in the following:

 #[cfg(not(miri))]
if addr == libc::MAP_FAILED {
    return Err(Error::Mmap(io::Error::last_os_error()));
}

#[cfg(miri)]
if self.size == 0 {
    return Err(Error::Mmap(io::Error::from_raw_os_error(libc::EINVAL)));
}

Note that there are both cfg(miri) and cfg(not(miri)).

However, I found that PR #15284 has enabled cfg(miri) in analysis by default.

Currently my editor deactivates all the code blocks annotated with #[cfg(not(miri))], and I do not know how to activate those blocks or disable cfg(miri).

image

Is there any possible method in RA to activate code blocks with #[cfg(not(miri))]?

@huang-jl huang-jl added the C-support Category: support questions label Dec 14, 2023
@mccolljr
Copy link

I just ran into this as well - I don't mind this as a default, but it would be nice to have an escape hatch.

@huang-jl
Copy link
Author

@mccolljr I think currently there is no way to activate the lsp functionality on those blocks with #[cfg(not(miri))]. It is inconvenience for me at least.

@mbyt
Copy link

mbyt commented Apr 19, 2024

I just ran into this as well.

@bors bors closed this as completed in 50bdeaa Apr 19, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue Apr 20, 2024
internal: Cleanup cfg and env handling in project-model

Fixes rust-lang/rust-analyzer#16122 (comment)

`miri` and `debug_assertions` are now enabled via the `cargo.cfgs` config by default, allowing them to be disabled by overwriting the config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants