Skip to content
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

RA doesn't honor Cargo.toml edition #17852

Closed
Rudxain opened this issue Aug 11, 2024 · 3 comments · Fixed by #17859
Closed

RA doesn't honor Cargo.toml edition #17852

Rudxain opened this issue Aug 11, 2024 · 3 comments · Fixed by #17859
Assignees
Labels
A-diagnostics diagnostics / error reporting Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug

Comments

@Rudxain
Copy link

Rudxain commented Aug 11, 2024

rust-analyzer version: 1.80.0 (0514789 2024-07-21)

rustc version: 1.80.0 (051478957 2024-07-21)

editor or extension: hx 24.7 (079f5442), AppImage

relevant settings: None?

repository link (if public, optional): None

code snippet to reproduce:
src/main.rs:

fn main() {
    std::env::set_var("", "");
}

Cargo.toml:

[package]
name = "tmp"
version = "0.1.0"
edition = "2021"

description: RA shows a diagnostic that's valid for Edition 2024 "this operation is unsafe and requires an unsafe function or block (E0133)", but not for 2021. cargo check is successful

@Rudxain Rudxain added the C-bug Category: bug label Aug 11, 2024
@Veykril
Copy link
Member

Veykril commented Aug 11, 2024

We don't have #[rustc_deprecated_safe_2024] implemented

@Veykril Veykril added the A-diagnostics diagnostics / error reporting label Aug 11, 2024
@Rudxain
Copy link
Author

Rudxain commented Aug 11, 2024

I've been thinking, and this bug could be considered a "hacky feature", since it serves as a warning that some code might be undefined-behavior. However, this sort of warnings would be appropriate from Clippy, not RA

@Veykril
Copy link
Member

Veykril commented Aug 11, 2024

The bug here is simply that we dont have the attribute implemented that marks an unsafe function as safe in editions < 2024. So we consider this function unsafe in all editions right now even though its not

@Veykril Veykril added the Broken Window Bugs / technical debt to be addressed immediately label Aug 11, 2024
@Veykril Veykril self-assigned this Aug 12, 2024
@bors bors closed this as completed in e2fd1db Aug 12, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue Aug 13, 2024
…=Veykril

fix: Correctly support `#[rustc_deprecated_safe_2024]`

Fixes rust-lang/rust-analyzer#17852
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants