Skip to content

Commit fec397d

Browse files
committed
move strict provenance lints to new feature gate, remove old feature gates
1 parent 2333394 commit fec397d

File tree

88 files changed

+38
-123
lines changed

Some content is hidden

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

88 files changed

+38
-123
lines changed

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

compiler/rustc_codegen_ssa/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![feature(let_chains)]
1111
#![feature(negative_impls)]
1212
#![feature(rustdoc_internals)]
13-
#![feature(strict_provenance)]
1413
#![feature(try_blocks)]
1514
#![warn(unreachable_pub)]
1615
// tidy-alphabetical-end

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(yeet_expr)]

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#![feature(ptr_alignment_type)]
3333
#![feature(rustc_attrs)]
3434
#![feature(rustdoc_internals)]
35-
#![feature(strict_provenance)]
3635
#![feature(test)]
3736
#![feature(thread_id_value)]
3837
#![feature(type_alias_impl_trait)]

compiler/rustc_feature/src/unstable.rs

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

compiler/rustc_lint_defs/src/builtin.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2721,7 +2721,6 @@ declare_lint! {
27212721
/// ### Example
27222722
///
27232723
/// ```rust
2724-
/// #![feature(strict_provenance)]
27252724
/// #![warn(fuzzy_provenance_casts)]
27262725
///
27272726
/// fn main() {
@@ -2755,7 +2754,7 @@ declare_lint! {
27552754
pub FUZZY_PROVENANCE_CASTS,
27562755
Allow,
27572756
"a fuzzy integer to pointer cast is used",
2758-
@feature_gate = strict_provenance;
2757+
@feature_gate = strict_provenance_lints;
27592758
}
27602759

27612760
declare_lint! {
@@ -2765,7 +2764,6 @@ declare_lint! {
27652764
/// ### Example
27662765
///
27672766
/// ```rust
2768-
/// #![feature(strict_provenance)]
27692767
/// #![warn(lossy_provenance_casts)]
27702768
///
27712769
/// fn main() {
@@ -2801,7 +2799,7 @@ declare_lint! {
28012799
pub LOSSY_PROVENANCE_CASTS,
28022800
Allow,
28032801
"a lossy pointer to integer cast is used",
2804-
@feature_gate = strict_provenance;
2802+
@feature_gate = strict_provenance_lints;
28052803
}
28062804

28072805
declare_lint! {

compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#![feature(ptr_alignment_type)]
5656
#![feature(rustc_attrs)]
5757
#![feature(rustdoc_internals)]
58-
#![feature(strict_provenance)]
5958
#![feature(trait_upcasting)]
6059
#![feature(trusted_len)]
6160
#![feature(try_blocks)]

compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ symbols! {
18571857
str_trim,
18581858
str_trim_end,
18591859
str_trim_start,
1860-
strict_provenance,
1860+
strict_provenance_lints,
18611861
string_deref_patterns,
18621862
stringify,
18631863
struct_field_attributes,

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

library/alloc/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
#![feature(slice_range)]
150150
#![feature(std_internals)]
151151
#![feature(str_internals)]
152-
#![feature(strict_provenance)]
153152
#![feature(trusted_fused)]
154153
#![feature(trusted_len)]
155154
#![feature(trusted_random_access)]
@@ -164,6 +163,8 @@
164163
//
165164
// Language features:
166165
// tidy-alphabetical-start
166+
#![cfg_attr(bootstrap, feature(strict_provenance))]
167+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
167168
#![cfg_attr(not(test), feature(coroutine_trait))]
168169
#![cfg_attr(test, feature(panic_update_hook))]
169170
#![cfg_attr(test, feature(test))]

library/alloc/tests/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
#![feature(panic_update_hook)]
3636
#![feature(pointer_is_aligned_to)]
3737
#![feature(thin_box)]
38-
#![feature(strict_provenance)]
38+
#![cfg_attr(bootstrap, feature(strict_provenance))]
39+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
3940
#![feature(drain_keep_rest)]
4041
#![feature(local_waker)]
4142
#![feature(vec_pop_if)]

library/core/src/intrinsics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2888,7 +2888,6 @@ where
28882888
/// #![feature(is_val_statically_known)]
28892889
/// #![feature(core_intrinsics)]
28902890
/// # #![allow(internal_features)]
2891-
/// #![feature(strict_provenance)]
28922891
/// use std::intrinsics::is_val_statically_known;
28932892
///
28942893
/// fn foo(x: &i32) -> bool {

library/core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@
180180
#![feature(str_internals)]
181181
#![feature(str_split_inclusive_remainder)]
182182
#![feature(str_split_remainder)]
183-
#![feature(strict_provenance)]
184183
#![feature(ub_checks)]
185184
#![feature(unchecked_neg)]
186185
#![feature(unchecked_shifts)]
@@ -191,6 +190,8 @@
191190
//
192191
// Language features:
193192
// tidy-alphabetical-start
193+
#![cfg_attr(bootstrap, feature(strict_provenance))]
194+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
194195
#![feature(abi_unadjusted)]
195196
#![feature(adt_const_params)]
196197
#![feature(allow_internal_unsafe)]

library/core/src/ptr/const_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ impl<T: ?Sized> *const T {
505505
/// ## Examples
506506
///
507507
/// ```
508-
/// #![feature(ptr_mask, strict_provenance)]
508+
/// #![feature(ptr_mask)]
509509
/// let v = 17_u32;
510510
/// let ptr: *const u32 = &v;
511511
///

library/core/src/ptr/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@
249249
//! represent the tagged pointer as an actual pointer and not a `usize`*. For instance:
250250
//!
251251
//! ```
252-
//! #![feature(strict_provenance)]
253-
//!
254252
//! unsafe {
255253
//! // A flag we want to pack into our pointer
256254
//! static HAS_DATA: usize = 0x1;

library/core/src/ptr/non_null.rs

-1
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,6 @@ impl<T: ?Sized> NonNull<T> {
732732
/// *Incorrect* usage:
733733
///
734734
/// ```rust,no_run
735-
/// #![feature(strict_provenance)]
736735
/// use std::ptr::NonNull;
737736
///
738737
/// let ptr1 = NonNull::new(Box::into_raw(Box::new(0u8))).unwrap();

library/core/src/sync/atomic.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ impl<T> AtomicPtr<T> {
17391739
/// # Examples
17401740
///
17411741
/// ```
1742-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1742+
/// #![feature(strict_provenance_atomic_ptr)]
17431743
/// use core::sync::atomic::{AtomicPtr, Ordering};
17441744
///
17451745
/// let atom = AtomicPtr::<i64>::new(core::ptr::null_mut());
@@ -1819,7 +1819,7 @@ impl<T> AtomicPtr<T> {
18191819
/// # Examples
18201820
///
18211821
/// ```
1822-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1822+
/// #![feature(strict_provenance_atomic_ptr)]
18231823
/// use core::sync::atomic::{AtomicPtr, Ordering};
18241824
///
18251825
/// let atom = AtomicPtr::<i64>::new(core::ptr::null_mut());
@@ -1855,7 +1855,7 @@ impl<T> AtomicPtr<T> {
18551855
/// # Examples
18561856
///
18571857
/// ```
1858-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1858+
/// #![feature(strict_provenance_atomic_ptr)]
18591859
/// use core::sync::atomic::{AtomicPtr, Ordering};
18601860
///
18611861
/// let atom = AtomicPtr::<i64>::new(core::ptr::without_provenance_mut(1));
@@ -1900,7 +1900,7 @@ impl<T> AtomicPtr<T> {
19001900
/// # Examples
19011901
///
19021902
/// ```
1903-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1903+
/// #![feature(strict_provenance_atomic_ptr)]
19041904
/// use core::sync::atomic::{AtomicPtr, Ordering};
19051905
///
19061906
/// let pointer = &mut 3i64 as *mut i64;
@@ -1951,7 +1951,7 @@ impl<T> AtomicPtr<T> {
19511951
/// # Examples
19521952
///
19531953
/// ```
1954-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
1954+
/// #![feature(strict_provenance_atomic_ptr)]
19551955
/// use core::sync::atomic::{AtomicPtr, Ordering};
19561956
///
19571957
/// let pointer = &mut 3i64 as *mut i64;
@@ -2001,7 +2001,7 @@ impl<T> AtomicPtr<T> {
20012001
/// # Examples
20022002
///
20032003
/// ```
2004-
/// #![feature(strict_provenance_atomic_ptr, strict_provenance)]
2004+
/// #![feature(strict_provenance_atomic_ptr)]
20052005
/// use core::sync::atomic::{AtomicPtr, Ordering};
20062006
///
20072007
/// let pointer = &mut 3i64 as *mut i64;

library/core/tests/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// tidy-alphabetical-start
2+
#![cfg_attr(bootstrap, feature(strict_provenance))]
3+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
24
#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
35
#![cfg_attr(test, feature(cfg_match))]
46
#![feature(alloc_layout_extra)]
@@ -98,7 +100,6 @@
98100
#![feature(std_internals)]
99101
#![feature(step_trait)]
100102
#![feature(str_internals)]
101-
#![feature(strict_provenance)]
102103
#![feature(strict_provenance_atomic_ptr)]
103104
#![feature(test)]
104105
#![feature(trait_upcasting)]

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)]

library/portable-simd/crates/core_simd/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
repr_simd,
1212
simd_ffi,
1313
staged_api,
14-
strict_provenance,
1514
prelude_import,
1615
ptr_metadata
1716
)]

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},

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)]

library/std/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@
272272
//
273273
// Language features:
274274
// tidy-alphabetical-start
275+
#![cfg_attr(bootstrap, feature(strict_provenance))]
276+
#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))]
275277
#![feature(alloc_error_handler)]
276278
#![feature(allocator_internals)]
277279
#![feature(allow_internal_unsafe)]
@@ -328,7 +330,6 @@
328330
#![feature(error_iter)]
329331
#![feature(exact_size_is_empty)]
330332
#![feature(exclusive_wrapper)]
331-
#![feature(exposed_provenance)]
332333
#![feature(extend_one)]
333334
#![feature(float_gamma)]
334335
#![feature(float_minimum_maximum)]
@@ -352,7 +353,6 @@
352353
#![feature(slice_range)]
353354
#![feature(std_internals)]
354355
#![feature(str_internals)]
355-
#![feature(strict_provenance)]
356356
#![feature(strict_provenance_atomic_ptr)]
357357
#![feature(ub_checks)]
358358
// tidy-alphabetical-end

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(target_arch = "wasm64", feature(simd_wasm64))]
76
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
87
#![cfg_attr(

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
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.
1010
The same feature gate is also used for the experimental strict provenance API in `std` (actually `core`).
1111

1212
## Example
1313

1414
```rust
15-
#![feature(strict_provenance)]
15+
#![feature(strict_provenance_lints)]
1616
#![warn(fuzzy_provenance_casts)]
1717

1818
fn main() {

src/tools/miri/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#![feature(let_chains)]
1313
#![feature(trait_upcasting)]
1414
#![feature(strict_overflow_ops)]
15-
#![feature(strict_provenance)]
16-
#![feature(exposed_provenance)]
1715
#![feature(pointer_is_aligned_to)]
1816
// Configure clippy and other lints
1917
#![allow(

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 {

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.

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.

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() {

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)]

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

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;

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() {

src/tools/miri/tests/fail/provenance/ptr_invalid_offset.rs

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

43
fn main() {
54
let x = 22;

0 commit comments

Comments
 (0)