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

Diagnostics error in interaction between #[optimize(..)] and #[no_sanitize(..)] #137950

Open
jdonszelmann opened this issue Mar 3, 2025 · 0 comments · May be fixed by #138165
Open

Diagnostics error in interaction between #[optimize(..)] and #[no_sanitize(..)] #137950

jdonszelmann opened this issue Mar 3, 2025 · 0 comments · May be fixed by #138165
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jdonszelmann
Copy link
Contributor

jdonszelmann commented Mar 3, 2025

Code

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=eaaf800ea55d5e224c36354bacddc6e3

#![feature(no_sanitize)]
#![feature(optimize_attribute)]

#[no_sanitize(address)]
#[inline(always)]
#[optimize(speed)]
pub fn hello() {
    
}

Current output

Compiling playground v0.0.1 (/playground)
warning: `no_sanitize` will have no effect after inlining
 --> src/lib.rs:4:1
  |
4 | #[no_sanitize(address)]
  | ^^^^^^^^^^^^^^^^^^^^^^^
  |
note: inlining requested here
 --> src/lib.rs:6:1
  |
6 | #[optimize(speed)]
  | ^^^^^^^^^^^^^^^^^^
  = note: `#[warn(inline_no_sanitize)]` on by default

warning: `playground` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.38s

Desired output

Compiling playground v0.0.1 (/playground)
warning: `no_sanitize` will have no effect after inlining
 --> src/lib.rs:4:1
  |
4 | #[no_sanitize(address)]
  | ^^^^^^^^^^^^^^^^^^^^^^^
  |
note: inlining requested here
 --> src/lib.rs:6:1
  |
5 | #[inline(always)]
  | ^^^^^^^^^^^^^^^^^^
  = note: `#[warn(inline_no_sanitize)]` on by default

warning: `playground` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.38s

Rationale and extra context

This is simply a bug. I wasn't even sure if I wanted to report it since I'm working on the code anyway and will simply remove it at some point with a test. No need to do anything, but I wanted something to point to when I fix it.

@rustbot claim
@rustbot label +A-attributes -needs-triage

Other cases

Rust Version

nightly (dw, I'll fix it myself)

Anything else?

No response

@jdonszelmann jdonszelmann added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 3, 2025
@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
2 participants