mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-01 18:58:38 +00:00
This change implements the #[sanitize(..)] attribute, which opts to
replace the currently unstable #[no_sanitize]. Essentially the new
attribute works similar as #[no_sanitize], just with more flexible
options regarding where it is applied. E.g. it is possible to turn
a certain sanitizer either on or off:
`#[sanitize(address = "on|off")]`
This attribute now also applies to more places, e.g. it is possible
to turn off a sanitizer for an entire module or impl block:
```rust
\#[sanitize(address = "off")]
mod foo {
fn unsanitized(..) {}
#[sanitize(address = "on")]
fn sanitized(..) {}
}
\#[sanitize(thread = "off")]
impl MyTrait for () {
...
}
```
This attribute is enabled behind the unstable `sanitize` feature.
16 lines
392 B
Plaintext
16 lines
392 B
Plaintext
warning: setting `sanitize` off will have no effect after inlining
|
|
--> $DIR/inline-always-sanitize.rs:7:1
|
|
|
|
|
LL | #[sanitize(address = "off")]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: inlining requested here
|
|
--> $DIR/inline-always-sanitize.rs:5:1
|
|
|
|
|
LL | #[inline(always)]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
= note: `#[warn(inline_no_sanitize)]` on by default
|
|
|
|
warning: 1 warning emitted
|
|
|