Skip to content

Commit f65fd43

Browse files
committed
sanitizers: Stabilize the no_sanitize attribute
Stabilize the `no_sanitize` attribute so stable sanitizers can also be selectively disabled for annotated functions.
1 parent ad86f3b commit f65fd43

File tree

18 files changed

+15
-76
lines changed

18 files changed

+15
-76
lines changed

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ declare_features! (
318318
(accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490)),
319319
/// Allows using non lexical lifetimes (RFC 2094).
320320
(accepted, nll, "1.63.0", Some(43234)),
321+
/// Allows the use of `no_sanitize` attribute.
322+
(accepted, no_sanitize, "CURRENT_RUSTC_VERSION", Some(39699)),
321323
/// Allows using `#![no_std]`.
322324
(accepted, no_std, "1.6.0", None),
323325
/// Allows defining identifiers beyond ASCII.

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,10 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
539539
),
540540
ungated!(track_caller, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes),
541541
ungated!(instruction_set, Normal, template!(List: "set"), ErrorPreceding, EncodeCrossCrate::No),
542-
gated!(
542+
ungated!(
543543
no_sanitize, Normal,
544544
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
545-
EncodeCrossCrate::No, experimental!(no_sanitize)
545+
EncodeCrossCrate::No
546546
),
547547
gated!(
548548
coverage, Normal, template!(OneOf: &[sym::off, sym::on]),

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,6 @@ declare_features! (
595595
(unstable, new_range, "1.86.0", Some(123741)),
596596
/// Allows `#![no_core]`.
597597
(unstable, no_core, "1.3.0", Some(29639)),
598-
/// Allows the use of `no_sanitize` attribute.
599-
(unstable, no_sanitize, "1.42.0", Some(39699)),
600598
/// Allows using the `non_exhaustive_omitted_patterns` lint.
601599
(unstable, non_exhaustive_omitted_patterns_lint, "1.57.0", Some(89554)),
602600
/// Allows `for<T>` binders in where-clauses

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,8 +2303,6 @@ declare_lint! {
23032303
/// ### Example
23042304
///
23052305
/// ```rust
2306-
/// #![feature(no_sanitize)]
2307-
///
23082306
/// #[inline(always)]
23092307
/// #[no_sanitize(address)]
23102308
/// fn x() {}

src/doc/unstable-book/src/language-features/no-sanitize.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zunstable-options -Csanitize=cfi -Copt-level=0
55

66
#![crate_type = "lib"]
7-
#![feature(no_sanitize)]
87

98
#[no_sanitize(cfi)]
109
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {

tests/codegen/sanitizer/no-sanitize-inlining.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
//@[LSAN] compile-flags: -Zunstable-options -Csanitize=leak
1010

1111
#![crate_type = "lib"]
12-
#![feature(no_sanitize)]
13-
1412
// ASAN-LABEL: define void @test
1513
// ASAN: call {{.*}} @random_inline
1614
// ASAN: }

tests/codegen/sanitizer/scs-attr-check.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
//@ compile-flags: -Zunstable-options -Csanitize=shadow-call-stack
66

77
#![crate_type = "lib"]
8-
#![feature(no_sanitize)]
9-
108
// CHECK: ; sanitizer_scs_attr_check::scs
119
// CHECK-NEXT: ; Function Attrs:{{.*}}shadowcallstack
1210
pub fn scs() {}

tests/mir-opt/inline/inline_compatibility.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#![crate_type = "lib"]
66
#![feature(no_sanitize)]
7+
#![feature(target_feature_11)]
78
#![feature(c_variadic)]
89

910
#[inline]

tests/ui/attributes/no-sanitize.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(no_sanitize)]
21
#![feature(stmt_expr_attributes)]
32
#![deny(unused_attributes)]
43
#![allow(dead_code)]

0 commit comments

Comments
 (0)