Skip to content

Commit 21a330e

Browse files
committed
move strict provenance lints to new feature gate, remove old feature gates
1 parent c3e928d commit 21a330e

File tree

89 files changed

+38
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+38
-127
lines changed

Diff for: compiler/rustc_arena/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![feature(maybe_uninit_slice)]
2424
#![feature(rustc_attrs)]
2525
#![feature(rustdoc_internals)]
26-
#![feature(strict_provenance)]
2726
#![warn(unreachable_pub)]
2827
// tidy-alphabetical-end
2928

Diff for: compiler/rustc_codegen_ssa/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(let_chains)]
1212
#![feature(negative_impls)]
1313
#![feature(rustdoc_internals)]
14-
#![feature(strict_provenance)]
1514
#![feature(trait_alias)]
1615
#![feature(try_blocks)]
1716
#![warn(unreachable_pub)]

Diff for: compiler/rustc_const_eval/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![feature(never_type)]
1111
#![feature(rustdoc_internals)]
1212
#![feature(slice_ptr_get)]
13-
#![feature(strict_provenance)]
1413
#![feature(trait_alias)]
1514
#![feature(try_blocks)]
1615
#![feature(unqualified_local_imports)]

Diff for: compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![feature(ptr_alignment_type)]
3434
#![feature(rustc_attrs)]
3535
#![feature(rustdoc_internals)]
36-
#![feature(strict_provenance)]
3736
#![feature(test)]
3837
#![feature(thread_id_value)]
3938
#![feature(type_alias_impl_trait)]

Diff for: compiler/rustc_feature/src/unstable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ declare_features! (
598598
/// Allows attributes on expressions and non-item statements.
599599
(unstable, stmt_expr_attributes, "1.6.0", Some(15701)),
600600
/// Allows lints part of the strict provenance effort.
601-
(unstable, strict_provenance, "1.61.0", Some(95228)),
601+
(unstable, strict_provenance_lints, "1.61.0", Some(130351)),
602602
/// Allows string patterns to dereference values to match them.
603603
(unstable, string_deref_patterns, "1.67.0", Some(87121)),
604604
/// Allows the use of `#[target_feature]` on safe functions.

Diff for: compiler/rustc_lint_defs/src/builtin.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,6 @@ declare_lint! {
26672667
/// ### Example
26682668
///
26692669
/// ```rust
2670-
/// #![feature(strict_provenance)]
26712670
/// #![warn(fuzzy_provenance_casts)]
26722671
///
26732672
/// fn main() {
@@ -2701,7 +2700,7 @@ declare_lint! {
27012700
pub FUZZY_PROVENANCE_CASTS,
27022701
Allow,
27032702
"a fuzzy integer to pointer cast is used",
2704-
@feature_gate = strict_provenance;
2703+
@feature_gate = strict_provenance_lints;
27052704
}
27062705

27072706
declare_lint! {
@@ -2711,7 +2710,6 @@ declare_lint! {
27112710
/// ### Example
27122711
///
27132712
/// ```rust
2714-
/// #![feature(strict_provenance)]
27152713
/// #![warn(lossy_provenance_casts)]
27162714
///
27172715
/// fn main() {
@@ -2747,7 +2745,7 @@ declare_lint! {
27472745
pub LOSSY_PROVENANCE_CASTS,
27482746
Allow,
27492747
"a lossy pointer to integer cast is used",
2750-
@feature_gate = strict_provenance;
2748+
@feature_gate = strict_provenance_lints;
27512749
}
27522750

27532751
declare_lint! {

Diff for: compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#![feature(ptr_alignment_type)]
5757
#![feature(rustc_attrs)]
5858
#![feature(rustdoc_internals)]
59-
#![feature(strict_provenance)]
6059
#![feature(trait_upcasting)]
6160
#![feature(trusted_len)]
6261
#![feature(try_blocks)]

Diff for: compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ symbols! {
19131913
str_trim,
19141914
str_trim_end,
19151915
str_trim_start,
1916-
strict_provenance,
1916+
strict_provenance_lints,
19171917
string_as_mut_str,
19181918
string_as_str,
19191919
string_deref_patterns,

Diff for: library/alloc/benches/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#![feature(iter_next_chunk)]
55
#![feature(repr_simd)]
66
#![feature(slice_partition_dedup)]
7-
#![feature(strict_provenance)]
7+
#![cfg_attr(bootstrap, feature(strict_provenance))]
8+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
89
#![feature(test)]
910
#![deny(fuzzy_provenance_casts)]
1011

Diff for: library/alloc/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
#![feature(slice_range)]
148148
#![feature(std_internals)]
149149
#![feature(str_internals)]
150-
#![feature(strict_provenance)]
151150
#![feature(trusted_fused)]
152151
#![feature(trusted_len)]
153152
#![feature(trusted_random_access)]
@@ -162,6 +161,8 @@
162161
//
163162
// Language features:
164163
// tidy-alphabetical-start
164+
#![cfg_attr(bootstrap, feature(strict_provenance))]
165+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
165166
#![cfg_attr(not(test), feature(coroutine_trait))]
166167
#![cfg_attr(test, feature(panic_update_hook))]
167168
#![cfg_attr(test, feature(test))]

Diff for: library/alloc/tests/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#![feature(panic_update_hook)]
3333
#![feature(pointer_is_aligned_to)]
3434
#![feature(thin_box)]
35-
#![feature(strict_provenance)]
35+
#![cfg_attr(bootstrap, feature(strict_provenance))]
36+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
3637
#![feature(drain_keep_rest)]
3738
#![feature(local_waker)]
3839
#![feature(vec_pop_if)]

Diff for: library/core/src/intrinsics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,6 @@ where
27942794
/// #![feature(is_val_statically_known)]
27952795
/// #![feature(core_intrinsics)]
27962796
/// # #![allow(internal_features)]
2797-
/// #![feature(strict_provenance)]
27982797
/// use std::intrinsics::is_val_statically_known;
27992798
///
28002799
/// fn foo(x: &i32) -> bool {

Diff for: library/core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
#![feature(str_internals)]
164164
#![feature(str_split_inclusive_remainder)]
165165
#![feature(str_split_remainder)]
166-
#![feature(strict_provenance)]
167166
#![feature(ub_checks)]
168167
#![feature(unchecked_neg)]
169168
#![feature(unchecked_shifts)]
@@ -174,6 +173,8 @@
174173
//
175174
// Language features:
176175
// tidy-alphabetical-start
176+
#![cfg_attr(bootstrap, feature(strict_provenance))]
177+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
177178
#![feature(abi_unadjusted)]
178179
#![feature(adt_const_params)]
179180
#![feature(allow_internal_unsafe)]

Diff for: library/core/src/ptr/const_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ impl<T: ?Sized> *const T {
552552
/// ## Examples
553553
///
554554
/// ```
555-
/// #![feature(ptr_mask, strict_provenance)]
555+
/// #![feature(ptr_mask)]
556556
/// let v = 17_u32;
557557
/// let ptr: *const u32 = &v;
558558
///

Diff for: library/core/src/ptr/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@
290290
//! represent the tagged pointer as an actual pointer and not a `usize`*. For instance:
291291
//!
292292
//! ```
293-
//! #![feature(strict_provenance)]
294-
//!
295293
//! unsafe {
296294
//! // A flag we want to pack into our pointer
297295
//! static HAS_DATA: usize = 0x1;

Diff for: library/core/src/ptr/mut_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ impl<T: ?Sized> *mut T {
549549
/// ## Examples
550550
///
551551
/// ```
552-
/// #![feature(ptr_mask, strict_provenance)]
552+
/// #![feature(ptr_mask)]
553553
/// let mut v = 17_u32;
554554
/// let ptr: *mut u32 = &mut v;
555555
///

Diff for: library/core/src/ptr/non_null.rs

-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ impl<T: ?Sized> NonNull<T> {
748748
/// *Incorrect* usage:
749749
///
750750
/// ```rust,no_run
751-
/// #![feature(strict_provenance)]
752751
/// use std::ptr::NonNull;
753752
///
754753
/// let ptr1 = NonNull::new(Box::into_raw(Box::new(0u8))).unwrap();

Diff for: library/core/src/sync/atomic.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ impl<T> AtomicPtr<T> {
17581758
/// # Examples
17591759
///
17601760
/// ```
1761-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1761+
/// #![feature(strict_provenance_atomic_ptr)]
17621762
/// use core::sync::atomic::{AtomicPtr, Ordering};
17631763
///
17641764
/// let atom = AtomicPtr::<i64>::new(core::ptr::null_mut());
@@ -1838,7 +1838,7 @@ impl<T> AtomicPtr<T> {
18381838
/// # Examples
18391839
///
18401840
/// ```
1841-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1841+
/// #![feature(strict_provenance_atomic_ptr)]
18421842
/// use core::sync::atomic::{AtomicPtr, Ordering};
18431843
///
18441844
/// let atom = AtomicPtr::<i64>::new(core::ptr::null_mut());
@@ -1874,7 +1874,7 @@ impl<T> AtomicPtr<T> {
18741874
/// # Examples
18751875
///
18761876
/// ```
1877-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1877+
/// #![feature(strict_provenance_atomic_ptr)]
18781878
/// use core::sync::atomic::{AtomicPtr, Ordering};
18791879
///
18801880
/// let atom = AtomicPtr::<i64>::new(core::ptr::without_provenance_mut(1));
@@ -1919,7 +1919,7 @@ impl<T> AtomicPtr<T> {
19191919
/// # Examples
19201920
///
19211921
/// ```
1922-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1922+
/// #![feature(strict_provenance_atomic_ptr)]
19231923
/// use core::sync::atomic::{AtomicPtr, Ordering};
19241924
///
19251925
/// let pointer = &mut 3i64 as *mut i64;
@@ -1970,7 +1970,7 @@ impl<T> AtomicPtr<T> {
19701970
/// # Examples
19711971
///
19721972
/// ```
1973-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1973+
/// #![feature(strict_provenance_atomic_ptr)]
19741974
/// use core::sync::atomic::{AtomicPtr, Ordering};
19751975
///
19761976
/// let pointer = &mut 3i64 as *mut i64;
@@ -2020,7 +2020,7 @@ impl<T> AtomicPtr<T> {
20202020
/// # Examples
20212021
///
20222022
/// ```
2023-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
2023+
/// #![feature(strict_provenance_atomic_ptr)]
20242024
/// use core::sync::atomic::{AtomicPtr, Ordering};
20252025
///
20262026
/// let pointer = &mut 3i64 as *mut i64;

Diff for: library/core/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// tidy-alphabetical-start
2+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
23
#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
34
#![cfg_attr(test, feature(cfg_match))]
45
#![feature(alloc_layout_extra)]
@@ -85,7 +86,6 @@
8586
#![feature(std_internals)]
8687
#![feature(step_trait)]
8788
#![feature(str_internals)]
88-
#![feature(strict_provenance)]
8989
#![feature(strict_provenance_atomic_ptr)]
9090
#![feature(test)]
9191
#![feature(trait_upcasting)]

Diff for: library/panic_unwind/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#![feature(panic_unwind)]
2020
#![feature(staged_api)]
2121
#![feature(std_internals)]
22-
#![feature(strict_provenance)]
23-
#![feature(exposed_provenance)]
2422
#![feature(rustc_attrs)]
2523
#![panic_runtime]
2624
#![feature(panic_runtime)]

Diff for: library/portable-simd/crates/core_simd/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
repr_simd,
1010
simd_ffi,
1111
staged_api,
12-
strict_provenance,
1312
prelude_import,
1413
ptr_metadata
1514
)]

Diff for: library/portable-simd/crates/core_simd/tests/pointers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(portable_simd, strict_provenance, exposed_provenance)]
1+
#![feature(portable_simd)]
22

33
use core_simd::simd::{
44
ptr::{SimdConstPtr, SimdMutPtr},

Diff for: library/proc_macro/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#![feature(restricted_std)]
3333
#![feature(rustc_attrs)]
3434
#![feature(min_specialization)]
35-
#![feature(strict_provenance)]
3635
#![recursion_limit = "256"]
3736
#![allow(internal_features)]
3837
#![deny(ffi_unwind_calls)]

Diff for: library/std/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@
279279
//
280280
// Language features:
281281
// tidy-alphabetical-start
282+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
282283
#![feature(alloc_error_handler)]
283284
#![feature(allocator_internals)]
284285
#![feature(allow_internal_unsafe)]
@@ -336,7 +337,6 @@
336337
#![feature(error_iter)]
337338
#![feature(exact_size_is_empty)]
338339
#![feature(exclusive_wrapper)]
339-
#![feature(exposed_provenance)]
340340
#![feature(extend_one)]
341341
#![feature(float_gamma)]
342342
#![feature(float_minimum_maximum)]
@@ -362,7 +362,6 @@
362362
#![feature(slice_range)]
363363
#![feature(std_internals)]
364364
#![feature(str_internals)]
365-
#![feature(strict_provenance)]
366365
#![feature(strict_provenance_atomic_ptr)]
367366
#![feature(ub_checks)]
368367
// tidy-alphabetical-end

Diff for: library/unwind/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![unstable(feature = "panic_unwind", issue = "32837")]
33
#![feature(link_cfg)]
44
#![feature(staged_api)]
5-
#![feature(strict_provenance)]
65
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
76
#![cfg_attr(
87
all(target_family = "wasm", not(target_os = "emscripten")),

Diff for: src/doc/unstable-book/src/language-features/strict-provenance.md renamed to src/doc/unstable-book/src/language-features/strict-provenance-lints.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# `strict_provenance`
1+
# `strict_provenance_lints`
22

33
The tracking issue for this feature is: [#95228]
44

55
[#95228]: https://github.com/rust-lang/rust/issues/95228
66
-----
77

8-
The `strict_provenance` feature allows to enable the `fuzzy_provenance_casts` and `lossy_provenance_casts` lints.
8+
The `strict_provenance_lints` feature allows to enable the `fuzzy_provenance_casts` and `lossy_provenance_casts` lints.
99
These lint on casts between integers and pointers, that are recommended against or invalid in the strict provenance model.
10-
The same feature gate is also used for the experimental strict provenance API in `std` (actually `core`).
1110

1211
## Example
1312

1413
```rust
15-
#![feature(strict_provenance)]
14+
#![feature(strict_provenance_lints)]
1615
#![warn(fuzzy_provenance_casts)]
1716

1817
fn main() {

Diff for: src/tools/miri/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#![feature(let_chains)]
1212
#![feature(trait_upcasting)]
1313
#![feature(strict_overflow_ops)]
14-
#![feature(strict_provenance)]
15-
#![feature(exposed_provenance)]
1614
#![feature(pointer_is_aligned_to)]
1715
#![feature(unqualified_local_imports)]
1816
// Configure clippy and other lints

Diff for: src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_to_raw_pointer.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(strict_provenance)]
21
use std::ptr;
32

43
fn direct_raw(x: *const (i32, i32)) -> *const i32 {

Diff for: src/tools/miri/tests/fail/dangling_pointers/deref_dangling_box.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Should be caught even without retagging
22
//@compile-flags: -Zmiri-disable-stacked-borrows
3-
#![feature(strict_provenance)]
43
use std::ptr::{self, addr_of_mut};
54

65
// Deref'ing a dangling raw pointer is fine, but for a dangling box it is not.

Diff for: src/tools/miri/tests/fail/dangling_pointers/deref_dangling_ref.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Should be caught even without retagging
22
//@compile-flags: -Zmiri-disable-stacked-borrows
3-
#![feature(strict_provenance)]
43
use std::ptr::{self, addr_of_mut};
54

65
// Deref'ing a dangling raw pointer is fine, but for a dangling reference it is not.

Diff for: src/tools/miri/tests/fail/intrinsics/ptr_offset_from_different_ints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(strict_provenance)]
21
use core::ptr;
32

43
fn main() {

Diff for: src/tools/miri/tests/fail/provenance/int_copy_looses_provenance3.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(strict_provenance)]
21
use std::mem;
32

43
#[repr(C, usize)]

Diff for: src/tools/miri/tests/fail/provenance/provenance_transmute.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@compile-flags: -Zmiri-permissive-provenance
2-
#![feature(strict_provenance)]
32

43
use std::mem;
54

Diff for: src/tools/miri/tests/fail/provenance/ptr_int_unexposed.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@compile-flags: -Zmiri-permissive-provenance
2-
#![feature(strict_provenance, exposed_provenance)]
32

43
fn main() {
54
let x: i32 = 3;

Diff for: src/tools/miri/tests/fail/provenance/ptr_invalid.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(strict_provenance, exposed_provenance)]
21

32
// Ensure that a `ptr::without_provenance` ptr is truly invalid.
43
fn main() {

0 commit comments

Comments
 (0)