From d8636a568055e2cd7f37244f83533f9fb6c8c648 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 14 Sep 2024 13:44:02 +0200 Subject: [PATCH] move strict provenance lints to new feature gate, remove old feature gates --- compiler/rustc_arena/src/lib.rs | 1 - compiler/rustc_codegen_ssa/src/lib.rs | 1 - compiler/rustc_const_eval/src/lib.rs | 1 - compiler/rustc_data_structures/src/lib.rs | 1 - compiler/rustc_feature/src/unstable.rs | 2 +- compiler/rustc_lint_defs/src/builtin.rs | 6 ++---- compiler/rustc_middle/src/lib.rs | 1 - compiler/rustc_span/src/symbol.rs | 2 +- library/alloc/benches/lib.rs | 3 ++- library/alloc/src/lib.rs | 3 ++- library/alloc/tests/lib.rs | 3 ++- library/core/src/intrinsics.rs | 1 - library/core/src/lib.rs | 3 ++- library/core/src/ptr/const_ptr.rs | 2 +- library/core/src/ptr/mod.rs | 2 -- library/core/src/ptr/mut_ptr.rs | 2 +- library/core/src/ptr/non_null.rs | 1 - library/core/src/sync/atomic.rs | 12 ++++++------ library/core/tests/lib.rs | 3 ++- library/panic_unwind/src/lib.rs | 2 -- library/portable-simd/crates/core_simd/src/lib.rs | 1 - .../portable-simd/crates/core_simd/tests/pointers.rs | 2 +- library/proc_macro/src/lib.rs | 1 - library/std/src/lib.rs | 4 ++-- library/unwind/src/lib.rs | 1 - ...rict-provenance.md => strict-provenance-lints.md} | 6 +++--- src/tools/miri/src/lib.rs | 2 -- .../dangling_pointer_to_raw_pointer.rs | 1 - .../fail/dangling_pointers/deref_dangling_box.rs | 1 - .../fail/dangling_pointers/deref_dangling_ref.rs | 1 - .../intrinsics/ptr_offset_from_different_ints.rs | 1 - .../fail/provenance/int_copy_looses_provenance3.rs | 1 - .../tests/fail/provenance/provenance_transmute.rs | 1 - .../miri/tests/fail/provenance/ptr_int_unexposed.rs | 1 - src/tools/miri/tests/fail/provenance/ptr_invalid.rs | 1 - .../miri/tests/fail/provenance/ptr_invalid_offset.rs | 1 - .../tests/fail/provenance/strict_provenance_cast.rs | 1 - .../tests/fail/stacked_borrows/exposed_only_ro.rs | 1 - .../fail/unaligned_pointers/promise_alignment.rs | 1 - .../uninit_alloc_diagnostic_with_provenance.rs | 1 - src/tools/miri/tests/pass-dep/libc/libc-affinity.rs | 1 - .../tests/pass-dep/libc/libc-epoll-no-blocking.rs | 1 - src/tools/miri/tests/pass-dep/libc/libc-mem.rs | 2 +- src/tools/miri/tests/pass-dep/libc/libc-misc.rs | 1 - src/tools/miri/tests/pass-dep/libc/mmap.rs | 1 - src/tools/miri/tests/pass/align_offset_symbolic.rs | 1 - src/tools/miri/tests/pass/atomic.rs | 3 ++- .../miri/tests/pass/box-custom-alloc-aliasing.rs | 1 - .../pass/concurrency/address_reuse_happens_before.rs | 1 - src/tools/miri/tests/pass/const-addrs.rs | 1 - .../miri/tests/pass/drop_type_without_drop_glue.rs | 2 +- src/tools/miri/tests/pass/extern_types.rs | 2 +- src/tools/miri/tests/pass/provenance.rs | 1 - src/tools/miri/tests/pass/ptr_int_from_exposed.rs | 1 - src/tools/miri/tests/pass/ptr_raw.rs | 1 - src/tools/miri/tests/pass/shims/ptr_mask.rs | 1 - src/tools/miri/tests/pass/slices.rs | 1 - .../miri/tests/pass/stacked-borrows/int-to-ptr.rs | 1 - .../tests/pass/stacked-borrows/stack-printing.rs | 1 - .../tests/pass/stacked-borrows/unknown-bottom-gc.rs | 1 - src/tools/miri/tests/pass/transmute_ptr.rs | 1 - src/tools/miri/tests/pass/underscore_pattern.rs | 1 - .../tests/pass/zero-sized-accesses-and-offsets.rs | 1 - tests/codegen/atomicptr.rs | 1 - .../issues/issue-103285-ptr-addr-overflow-check.rs | 1 - tests/mir-opt/gvn_ptr_eq_with_constant.rs | 2 -- .../exposed-provenance/basic.rs | 2 -- .../exposed-provenance/function.rs | 2 -- .../exposed-provenance/inline1.rs | 2 -- .../exposed-provenance/inline2.rs | 2 -- .../exposed-provenance/print.rs | 2 -- .../exposed-provenance/print3.rs | 2 -- .../exposed-provenance/segfault.rs | 2 -- .../exposed-provenance/zero.rs | 2 -- .../strict-provenance/basic.rs | 2 -- .../strict-provenance/function.rs | 2 -- .../strict-provenance/inline1.rs | 2 -- .../strict-provenance/inline2.rs | 2 -- .../strict-provenance/print.rs | 2 -- .../strict-provenance/print3.rs | 2 -- .../strict-provenance/segfault.rs | 2 -- .../equal-pointers-unequal/strict-provenance/zero.rs | 2 -- ...ce.rs => feature-gate-strict_provenance_lints.rs} | 0 ...r => feature-gate-strict_provenance_lints.stderr} | 12 ++++++------ tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs | 2 +- tests/ui/lint/lint-strict-provenance-lossy-casts.rs | 2 +- tests/ui/mir/alignment/i686-pc-windows-msvc.rs | 2 -- tests/ui/mir/alignment/packed.rs | 2 -- tests/ui/structs-enums/type-sizes.rs | 1 - 89 files changed, 41 insertions(+), 126 deletions(-) rename src/doc/unstable-book/src/language-features/{strict-provenance.md => strict-provenance-lints.md} (74%) rename tests/ui/feature-gates/{feature-gate-strict_provenance.rs => feature-gate-strict_provenance_lints.rs} (100%) rename tests/ui/feature-gates/{feature-gate-strict_provenance.stderr => feature-gate-strict_provenance_lints.stderr} (57%) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 260c9fe44ba80..4906a2e741b83 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -23,7 +23,6 @@ #![feature(maybe_uninit_slice)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] -#![feature(strict_provenance)] #![warn(unreachable_pub)] // tidy-alphabetical-end diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index c89bfca668789..a0882fbfe25c1 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -10,7 +10,6 @@ #![feature(let_chains)] #![feature(negative_impls)] #![feature(rustdoc_internals)] -#![feature(strict_provenance)] #![feature(try_blocks)] #![warn(unreachable_pub)] // tidy-alphabetical-end diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 73dda81bd298b..c40c69b40f020 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -10,7 +10,6 @@ #![feature(never_type)] #![feature(rustdoc_internals)] #![feature(slice_ptr_get)] -#![feature(strict_provenance)] #![feature(trait_alias)] #![feature(try_blocks)] #![feature(yeet_expr)] diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index a35f5b1f17db4..19b1f2dee3cb0 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -32,7 +32,6 @@ #![feature(ptr_alignment_type)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] -#![feature(strict_provenance)] #![feature(test)] #![feature(thread_id_value)] #![feature(type_alias_impl_trait)] diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 6ed5ea9f8bb0c..18b027f2a0e4e 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -596,7 +596,7 @@ declare_features! ( /// Allows attributes on expressions and non-item statements. (unstable, stmt_expr_attributes, "1.6.0", Some(15701)), /// Allows lints part of the strict provenance effort. - (unstable, strict_provenance, "1.61.0", Some(95228)), + (unstable, strict_provenance_lints, "1.61.0", Some(130351)), /// Allows string patterns to dereference values to match them. (unstable, string_deref_patterns, "1.67.0", Some(87121)), /// Allows the use of `#[target_feature]` on safe functions. diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 25d33126754af..3aeaf0f28f024 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -2721,7 +2721,6 @@ declare_lint! { /// ### Example /// /// ```rust - /// #![feature(strict_provenance)] /// #![warn(fuzzy_provenance_casts)] /// /// fn main() { @@ -2755,7 +2754,7 @@ declare_lint! { pub FUZZY_PROVENANCE_CASTS, Allow, "a fuzzy integer to pointer cast is used", - @feature_gate = strict_provenance; + @feature_gate = strict_provenance_lints; } declare_lint! { @@ -2765,7 +2764,6 @@ declare_lint! { /// ### Example /// /// ```rust - /// #![feature(strict_provenance)] /// #![warn(lossy_provenance_casts)] /// /// fn main() { @@ -2801,7 +2799,7 @@ declare_lint! { pub LOSSY_PROVENANCE_CASTS, Allow, "a lossy pointer to integer cast is used", - @feature_gate = strict_provenance; + @feature_gate = strict_provenance_lints; } declare_lint! { diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index fd6e2ad79b11d..c1bdc08eb0f07 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -55,7 +55,6 @@ #![feature(ptr_alignment_type)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] -#![feature(strict_provenance)] #![feature(trait_upcasting)] #![feature(trusted_len)] #![feature(try_blocks)] diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index cbe2bafef21fd..b81f4eacd64a0 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1857,7 +1857,7 @@ symbols! { str_trim, str_trim_end, str_trim_start, - strict_provenance, + strict_provenance_lints, string_deref_patterns, stringify, struct_field_attributes, diff --git a/library/alloc/benches/lib.rs b/library/alloc/benches/lib.rs index ae9608ec7bd5c..c1907361f93e1 100644 --- a/library/alloc/benches/lib.rs +++ b/library/alloc/benches/lib.rs @@ -4,7 +4,8 @@ #![feature(iter_next_chunk)] #![feature(repr_simd)] #![feature(slice_partition_dedup)] -#![feature(strict_provenance)] +#![cfg_attr(bootstrap, feature(strict_provenance))] +#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))] #![feature(test)] #![deny(fuzzy_provenance_casts)] diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 7aaa4e73df72c..8579d504ba690 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -149,7 +149,6 @@ #![feature(slice_range)] #![feature(std_internals)] #![feature(str_internals)] -#![feature(strict_provenance)] #![feature(trusted_fused)] #![feature(trusted_len)] #![feature(trusted_random_access)] @@ -164,6 +163,8 @@ // // Language features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(strict_provenance))] +#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))] #![cfg_attr(not(test), feature(coroutine_trait))] #![cfg_attr(test, feature(panic_update_hook))] #![cfg_attr(test, feature(test))] diff --git a/library/alloc/tests/lib.rs b/library/alloc/tests/lib.rs index c5c6a122cfec8..43dc47d766e6a 100644 --- a/library/alloc/tests/lib.rs +++ b/library/alloc/tests/lib.rs @@ -35,7 +35,8 @@ #![feature(panic_update_hook)] #![feature(pointer_is_aligned_to)] #![feature(thin_box)] -#![feature(strict_provenance)] +#![cfg_attr(bootstrap, feature(strict_provenance))] +#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))] #![feature(drain_keep_rest)] #![feature(local_waker)] #![feature(vec_pop_if)] diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 7870a62ea81cd..21c1fd809a4d6 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -2888,7 +2888,6 @@ where /// #![feature(is_val_statically_known)] /// #![feature(core_intrinsics)] /// # #![allow(internal_features)] -/// #![feature(strict_provenance)] /// use std::intrinsics::is_val_statically_known; /// /// fn foo(x: &i32) -> bool { diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 5b5d5d1a9610e..1bd6e996f4a38 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -180,7 +180,6 @@ #![feature(str_internals)] #![feature(str_split_inclusive_remainder)] #![feature(str_split_remainder)] -#![feature(strict_provenance)] #![feature(ub_checks)] #![feature(unchecked_neg)] #![feature(unchecked_shifts)] @@ -191,6 +190,8 @@ // // Language features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(strict_provenance))] +#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))] #![feature(abi_unadjusted)] #![feature(adt_const_params)] #![feature(allow_internal_unsafe)] diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index cda133d77890f..b6532c2bb1d7a 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -505,7 +505,7 @@ impl *const T { /// ## Examples /// /// ``` - /// #![feature(ptr_mask, strict_provenance)] + /// #![feature(ptr_mask)] /// let v = 17_u32; /// let ptr: *const u32 = &v; /// diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index c0bc0cbdb653d..090f143a462ca 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -249,8 +249,6 @@ //! represent the tagged pointer as an actual pointer and not a `usize`*. For instance: //! //! ``` -//! #![feature(strict_provenance)] -//! //! unsafe { //! // A flag we want to pack into our pointer //! static HAS_DATA: usize = 0x1; diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 648f9138d2dff..e76a8d1c07ffb 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -501,7 +501,7 @@ impl *mut T { /// ## Examples /// /// ``` - /// #![feature(ptr_mask, strict_provenance)] + /// #![feature(ptr_mask)] /// let mut v = 17_u32; /// let ptr: *mut u32 = &mut v; /// diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index d438b67672555..bb7087375cc1b 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -732,7 +732,6 @@ impl NonNull { /// *Incorrect* usage: /// /// ```rust,no_run - /// #![feature(strict_provenance)] /// use std::ptr::NonNull; /// /// let ptr1 = NonNull::new(Box::into_raw(Box::new(0u8))).unwrap(); diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index b06a3bd4487d3..4cd3b0aa617fc 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -1739,7 +1739,7 @@ impl AtomicPtr { /// # Examples /// /// ``` - /// #![feature(strict_provenance_atomic_ptr, strict_provenance)] + /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// /// let atom = AtomicPtr::::new(core::ptr::null_mut()); @@ -1819,7 +1819,7 @@ impl AtomicPtr { /// # Examples /// /// ``` - /// #![feature(strict_provenance_atomic_ptr, strict_provenance)] + /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// /// let atom = AtomicPtr::::new(core::ptr::null_mut()); @@ -1855,7 +1855,7 @@ impl AtomicPtr { /// # Examples /// /// ``` - /// #![feature(strict_provenance_atomic_ptr, strict_provenance)] + /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// /// let atom = AtomicPtr::::new(core::ptr::without_provenance_mut(1)); @@ -1900,7 +1900,7 @@ impl AtomicPtr { /// # Examples /// /// ``` - /// #![feature(strict_provenance_atomic_ptr, strict_provenance)] + /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// /// let pointer = &mut 3i64 as *mut i64; @@ -1951,7 +1951,7 @@ impl AtomicPtr { /// # Examples /// /// ``` - /// #![feature(strict_provenance_atomic_ptr, strict_provenance)] + /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// /// let pointer = &mut 3i64 as *mut i64; @@ -2001,7 +2001,7 @@ impl AtomicPtr { /// # Examples /// /// ``` - /// #![feature(strict_provenance_atomic_ptr, strict_provenance)] + /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// /// let pointer = &mut 3i64 as *mut i64; diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index dbceb8abafc84..33bc1daca17d8 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -1,4 +1,6 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(strict_provenance))] +#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))] #![cfg_attr(target_has_atomic = "128", feature(integer_atomics))] #![cfg_attr(test, feature(cfg_match))] #![feature(alloc_layout_extra)] @@ -98,7 +100,6 @@ #![feature(std_internals)] #![feature(step_trait)] #![feature(str_internals)] -#![feature(strict_provenance)] #![feature(strict_provenance_atomic_ptr)] #![feature(test)] #![feature(trait_upcasting)] diff --git a/library/panic_unwind/src/lib.rs b/library/panic_unwind/src/lib.rs index 4552fb68d26d5..f7234ef695b6f 100644 --- a/library/panic_unwind/src/lib.rs +++ b/library/panic_unwind/src/lib.rs @@ -19,8 +19,6 @@ #![feature(panic_unwind)] #![feature(staged_api)] #![feature(std_internals)] -#![feature(strict_provenance)] -#![feature(exposed_provenance)] #![feature(rustc_attrs)] #![panic_runtime] #![feature(panic_runtime)] diff --git a/library/portable-simd/crates/core_simd/src/lib.rs b/library/portable-simd/crates/core_simd/src/lib.rs index 331b66262490c..826ab65f5880e 100644 --- a/library/portable-simd/crates/core_simd/src/lib.rs +++ b/library/portable-simd/crates/core_simd/src/lib.rs @@ -11,7 +11,6 @@ repr_simd, simd_ffi, staged_api, - strict_provenance, prelude_import, ptr_metadata )] diff --git a/library/portable-simd/crates/core_simd/tests/pointers.rs b/library/portable-simd/crates/core_simd/tests/pointers.rs index 90bfc5d5fd6a5..d7db4e82b3ca2 100644 --- a/library/portable-simd/crates/core_simd/tests/pointers.rs +++ b/library/portable-simd/crates/core_simd/tests/pointers.rs @@ -1,4 +1,4 @@ -#![feature(portable_simd, strict_provenance, exposed_provenance)] +#![feature(portable_simd)] use core_simd::simd::{ ptr::{SimdConstPtr, SimdMutPtr}, diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 72b53c60f7439..2321fe01d6a01 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -32,7 +32,6 @@ #![feature(restricted_std)] #![feature(rustc_attrs)] #![feature(min_specialization)] -#![feature(strict_provenance)] #![recursion_limit = "256"] #![allow(internal_features)] #![deny(ffi_unwind_calls)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 60969af3e8541..94a6a8e81c41c 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -272,6 +272,8 @@ // // Language features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(strict_provenance))] +#![cfg_attr(not(bootstrap), feature(strict_provenance_lints))] #![feature(alloc_error_handler)] #![feature(allocator_internals)] #![feature(allow_internal_unsafe)] @@ -328,7 +330,6 @@ #![feature(error_iter)] #![feature(exact_size_is_empty)] #![feature(exclusive_wrapper)] -#![feature(exposed_provenance)] #![feature(extend_one)] #![feature(float_gamma)] #![feature(float_minimum_maximum)] @@ -352,7 +353,6 @@ #![feature(slice_range)] #![feature(std_internals)] #![feature(str_internals)] -#![feature(strict_provenance)] #![feature(strict_provenance_atomic_ptr)] #![feature(ub_checks)] // tidy-alphabetical-end diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 26ed00bfbd53e..5183d421bade8 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -2,7 +2,6 @@ #![unstable(feature = "panic_unwind", issue = "32837")] #![feature(link_cfg)] #![feature(staged_api)] -#![feature(strict_provenance)] #![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))] #![cfg_attr(not(target_env = "msvc"), feature(libc))] #![cfg_attr( diff --git a/src/doc/unstable-book/src/language-features/strict-provenance.md b/src/doc/unstable-book/src/language-features/strict-provenance-lints.md similarity index 74% rename from src/doc/unstable-book/src/language-features/strict-provenance.md rename to src/doc/unstable-book/src/language-features/strict-provenance-lints.md index dc60f3f375d3c..e19e8c34b5be5 100644 --- a/src/doc/unstable-book/src/language-features/strict-provenance.md +++ b/src/doc/unstable-book/src/language-features/strict-provenance-lints.md @@ -1,18 +1,18 @@ -# `strict_provenance` +# `strict_provenance_lints` The tracking issue for this feature is: [#95228] [#95228]: https://github.com/rust-lang/rust/issues/95228 ----- -The `strict_provenance` feature allows to enable the `fuzzy_provenance_casts` and `lossy_provenance_casts` lints. +The `strict_provenance_lints` feature allows to enable the `fuzzy_provenance_casts` and `lossy_provenance_casts` lints. These lint on casts between integers and pointers, that are recommended against or invalid in the strict provenance model. The same feature gate is also used for the experimental strict provenance API in `std` (actually `core`). ## Example ```rust -#![feature(strict_provenance)] +#![feature(strict_provenance_lints)] #![warn(fuzzy_provenance_casts)] fn main() { diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 85b4b02ff5f53..1ff2afd3be1e0 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -12,8 +12,6 @@ #![feature(let_chains)] #![feature(trait_upcasting)] #![feature(strict_overflow_ops)] -#![feature(strict_provenance)] -#![feature(exposed_provenance)] #![feature(pointer_is_aligned_to)] // Configure clippy and other lints #![allow( diff --git a/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_to_raw_pointer.rs b/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_to_raw_pointer.rs index 3e20b8da6223b..c63e926376d45 100644 --- a/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_to_raw_pointer.rs +++ b/src/tools/miri/tests/fail/dangling_pointers/dangling_pointer_to_raw_pointer.rs @@ -1,4 +1,3 @@ -#![feature(strict_provenance)] use std::ptr; fn direct_raw(x: *const (i32, i32)) -> *const i32 { diff --git a/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_box.rs b/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_box.rs index fa40f942b8f2f..b22c1b4c5e81a 100644 --- a/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_box.rs +++ b/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_box.rs @@ -1,6 +1,5 @@ // Should be caught even without retagging //@compile-flags: -Zmiri-disable-stacked-borrows -#![feature(strict_provenance)] use std::ptr::{self, addr_of_mut}; // Deref'ing a dangling raw pointer is fine, but for a dangling box it is not. diff --git a/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_ref.rs b/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_ref.rs index 036ef2580a87f..eeab7c333e597 100644 --- a/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_ref.rs +++ b/src/tools/miri/tests/fail/dangling_pointers/deref_dangling_ref.rs @@ -1,6 +1,5 @@ // Should be caught even without retagging //@compile-flags: -Zmiri-disable-stacked-borrows -#![feature(strict_provenance)] use std::ptr::{self, addr_of_mut}; // Deref'ing a dangling raw pointer is fine, but for a dangling reference it is not. diff --git a/src/tools/miri/tests/fail/intrinsics/ptr_offset_from_different_ints.rs b/src/tools/miri/tests/fail/intrinsics/ptr_offset_from_different_ints.rs index c307dfddb6c1f..0acda559d3a51 100644 --- a/src/tools/miri/tests/fail/intrinsics/ptr_offset_from_different_ints.rs +++ b/src/tools/miri/tests/fail/intrinsics/ptr_offset_from_different_ints.rs @@ -1,4 +1,3 @@ -#![feature(strict_provenance)] use core::ptr; fn main() { diff --git a/src/tools/miri/tests/fail/provenance/int_copy_looses_provenance3.rs b/src/tools/miri/tests/fail/provenance/int_copy_looses_provenance3.rs index 48a48ce4587ee..6390a24eef57e 100644 --- a/src/tools/miri/tests/fail/provenance/int_copy_looses_provenance3.rs +++ b/src/tools/miri/tests/fail/provenance/int_copy_looses_provenance3.rs @@ -1,4 +1,3 @@ -#![feature(strict_provenance)] use std::mem; #[repr(C, usize)] diff --git a/src/tools/miri/tests/fail/provenance/provenance_transmute.rs b/src/tools/miri/tests/fail/provenance/provenance_transmute.rs index bc5dd53dcf5e4..d72f10530d7ab 100644 --- a/src/tools/miri/tests/fail/provenance/provenance_transmute.rs +++ b/src/tools/miri/tests/fail/provenance/provenance_transmute.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-permissive-provenance -#![feature(strict_provenance)] use std::mem; diff --git a/src/tools/miri/tests/fail/provenance/ptr_int_unexposed.rs b/src/tools/miri/tests/fail/provenance/ptr_int_unexposed.rs index f89378fcb3c4c..a43ba13e13d41 100644 --- a/src/tools/miri/tests/fail/provenance/ptr_int_unexposed.rs +++ b/src/tools/miri/tests/fail/provenance/ptr_int_unexposed.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-permissive-provenance -#![feature(strict_provenance, exposed_provenance)] fn main() { let x: i32 = 3; diff --git a/src/tools/miri/tests/fail/provenance/ptr_invalid.rs b/src/tools/miri/tests/fail/provenance/ptr_invalid.rs index 512473cd89450..d4479f32e56fb 100644 --- a/src/tools/miri/tests/fail/provenance/ptr_invalid.rs +++ b/src/tools/miri/tests/fail/provenance/ptr_invalid.rs @@ -1,4 +1,3 @@ -#![feature(strict_provenance, exposed_provenance)] // Ensure that a `ptr::without_provenance` ptr is truly invalid. fn main() { diff --git a/src/tools/miri/tests/fail/provenance/ptr_invalid_offset.rs b/src/tools/miri/tests/fail/provenance/ptr_invalid_offset.rs index c8be521ef823d..53a16ce5d1b4c 100644 --- a/src/tools/miri/tests/fail/provenance/ptr_invalid_offset.rs +++ b/src/tools/miri/tests/fail/provenance/ptr_invalid_offset.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-strict-provenance -#![feature(strict_provenance)] fn main() { let x = 22; diff --git a/src/tools/miri/tests/fail/provenance/strict_provenance_cast.rs b/src/tools/miri/tests/fail/provenance/strict_provenance_cast.rs index d7b54f640f653..4674ba841b445 100644 --- a/src/tools/miri/tests/fail/provenance/strict_provenance_cast.rs +++ b/src/tools/miri/tests/fail/provenance/strict_provenance_cast.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-strict-provenance -#![feature(exposed_provenance)] fn main() { let addr = &0 as *const i32 as usize; diff --git a/src/tools/miri/tests/fail/stacked_borrows/exposed_only_ro.rs b/src/tools/miri/tests/fail/stacked_borrows/exposed_only_ro.rs index 608ab71891942..dfd7d4bb0be92 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/exposed_only_ro.rs +++ b/src/tools/miri/tests/fail/stacked_borrows/exposed_only_ro.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-permissive-provenance -#![feature(exposed_provenance)] // If we have only exposed read-only pointers, doing a write through a wildcard ptr should fail. diff --git a/src/tools/miri/tests/fail/unaligned_pointers/promise_alignment.rs b/src/tools/miri/tests/fail/unaligned_pointers/promise_alignment.rs index e075db66039bc..009ce1eb88262 100644 --- a/src/tools/miri/tests/fail/unaligned_pointers/promise_alignment.rs +++ b/src/tools/miri/tests/fail/unaligned_pointers/promise_alignment.rs @@ -1,6 +1,5 @@ //@compile-flags: -Zmiri-symbolic-alignment-check //@revisions: call_unaligned_ptr read_unaligned_ptr -#![feature(strict_provenance)] #[path = "../../utils/mod.rs"] mod utils; diff --git a/src/tools/miri/tests/fail/uninit/uninit_alloc_diagnostic_with_provenance.rs b/src/tools/miri/tests/fail/uninit/uninit_alloc_diagnostic_with_provenance.rs index adabff4a2cea2..c92cb2a26191e 100644 --- a/src/tools/miri/tests/fail/uninit/uninit_alloc_diagnostic_with_provenance.rs +++ b/src/tools/miri/tests/fail/uninit/uninit_alloc_diagnostic_with_provenance.rs @@ -1,7 +1,6 @@ //@compile-flags: -Zmiri-disable-validation //@error-in-other-file: memory is uninitialized at [0x4..0x8] //@normalize-stderr-test: "a[0-9]+" -> "ALLOC" -#![feature(strict_provenance)] #![allow(dropping_copy_types)] // Test printing allocations that contain single-byte provenance. diff --git a/src/tools/miri/tests/pass-dep/libc/libc-affinity.rs b/src/tools/miri/tests/pass-dep/libc/libc-affinity.rs index 0e482ab26010e..26d82f04817f6 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-affinity.rs +++ b/src/tools/miri/tests/pass-dep/libc/libc-affinity.rs @@ -3,7 +3,6 @@ //@compile-flags: -Zmiri-disable-isolation -Zmiri-num-cpus=4 #![feature(io_error_more)] #![feature(pointer_is_aligned_to)] -#![feature(strict_provenance)] use libc::{cpu_set_t, sched_getaffinity, sched_setaffinity}; use std::mem::{size_of, size_of_val}; diff --git a/src/tools/miri/tests/pass-dep/libc/libc-epoll-no-blocking.rs b/src/tools/miri/tests/pass-dep/libc/libc-epoll-no-blocking.rs index 647b5e60649e8..3d8c61b9128ff 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-epoll-no-blocking.rs +++ b/src/tools/miri/tests/pass-dep/libc/libc-epoll-no-blocking.rs @@ -1,6 +1,5 @@ //@only-target-linux -#![feature(strict_provenance)] use std::convert::TryInto; fn main() { diff --git a/src/tools/miri/tests/pass-dep/libc/libc-mem.rs b/src/tools/miri/tests/pass-dep/libc/libc-mem.rs index aa383a99bc289..42f3a74ce093d 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-mem.rs +++ b/src/tools/miri/tests/pass-dep/libc/libc-mem.rs @@ -1,4 +1,4 @@ -#![feature(strict_provenance, pointer_is_aligned_to)] +#![feature(pointer_is_aligned_to)] use std::{mem, ptr, slice}; fn test_memcpy() { diff --git a/src/tools/miri/tests/pass-dep/libc/libc-misc.rs b/src/tools/miri/tests/pass-dep/libc/libc-misc.rs index a5b944e9d426a..a0a7a0679b03f 100644 --- a/src/tools/miri/tests/pass-dep/libc/libc-misc.rs +++ b/src/tools/miri/tests/pass-dep/libc/libc-misc.rs @@ -2,7 +2,6 @@ //@compile-flags: -Zmiri-disable-isolation #![feature(io_error_more)] #![feature(pointer_is_aligned_to)] -#![feature(strict_provenance)] use std::mem::transmute; diff --git a/src/tools/miri/tests/pass-dep/libc/mmap.rs b/src/tools/miri/tests/pass-dep/libc/mmap.rs index fd874dbe89e55..b8a5e982f12ae 100644 --- a/src/tools/miri/tests/pass-dep/libc/mmap.rs +++ b/src/tools/miri/tests/pass-dep/libc/mmap.rs @@ -1,6 +1,5 @@ //@ignore-target-windows: No mmap on Windows //@compile-flags: -Zmiri-disable-isolation -Zmiri-permissive-provenance -#![feature(strict_provenance)] use std::io::Error; use std::{ptr, slice}; diff --git a/src/tools/miri/tests/pass/align_offset_symbolic.rs b/src/tools/miri/tests/pass/align_offset_symbolic.rs index 9647277821fa1..c836a3b07cbe7 100644 --- a/src/tools/miri/tests/pass/align_offset_symbolic.rs +++ b/src/tools/miri/tests/pass/align_offset_symbolic.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-symbolic-alignment-check -#![feature(strict_provenance)] use std::mem; diff --git a/src/tools/miri/tests/pass/atomic.rs b/src/tools/miri/tests/pass/atomic.rs index dfdc9b42f81fc..65b8675b597e6 100644 --- a/src/tools/miri/tests/pass/atomic.rs +++ b/src/tools/miri/tests/pass/atomic.rs @@ -1,7 +1,8 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows //@compile-flags: -Zmiri-strict-provenance -#![feature(strict_provenance, strict_provenance_atomic_ptr)] +#![feature(strict_provenance_atomic_ptr)] + use std::sync::atomic::{ compiler_fence, fence, AtomicBool, AtomicIsize, AtomicPtr, AtomicU64, Ordering::*, }; diff --git a/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs b/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs index 18980932f31cc..3155ab64f58f2 100644 --- a/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs +++ b/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs @@ -5,7 +5,6 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows #![feature(allocator_api)] -#![feature(strict_provenance)] use std::{ alloc::{AllocError, Allocator, Layout}, diff --git a/src/tools/miri/tests/pass/concurrency/address_reuse_happens_before.rs b/src/tools/miri/tests/pass/concurrency/address_reuse_happens_before.rs index cfc1ef7ae455a..f409a3a4881e6 100644 --- a/src/tools/miri/tests/pass/concurrency/address_reuse_happens_before.rs +++ b/src/tools/miri/tests/pass/concurrency/address_reuse_happens_before.rs @@ -1,7 +1,6 @@ //! Regression test for : //! When the address gets reused, there should be a happens-before relation. //@compile-flags: -Zmiri-address-reuse-cross-thread-rate=1.0 -#![feature(strict_provenance)] #![feature(sync_unsafe_cell)] use std::cell::SyncUnsafeCell; diff --git a/src/tools/miri/tests/pass/const-addrs.rs b/src/tools/miri/tests/pass/const-addrs.rs index 727c67ebfb574..af68b28b2b8cb 100644 --- a/src/tools/miri/tests/pass/const-addrs.rs +++ b/src/tools/miri/tests/pass/const-addrs.rs @@ -7,7 +7,6 @@ // MIR inlining will put every evaluation of the const we're repeatedly evaluating into the same // stack frame, breaking this test. //@compile-flags: -Zinline-mir=no -#![feature(strict_provenance)] const EVALS: usize = 256; diff --git a/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs b/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs index 43ddc8a4d8b55..2f8665e8d62c0 100644 --- a/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs +++ b/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs @@ -1,4 +1,4 @@ -#![feature(custom_mir, core_intrinsics, strict_provenance)] +#![feature(custom_mir, core_intrinsics)] use std::intrinsics::mir::*; // The `Drop` terminator on a type with no drop glue should be a NOP. diff --git a/src/tools/miri/tests/pass/extern_types.rs b/src/tools/miri/tests/pass/extern_types.rs index eade5c6ac0874..08e9caf4f1c11 100644 --- a/src/tools/miri/tests/pass/extern_types.rs +++ b/src/tools/miri/tests/pass/extern_types.rs @@ -1,6 +1,6 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(extern_types, strict_provenance)] +#![feature(extern_types)] use std::ptr; diff --git a/src/tools/miri/tests/pass/provenance.rs b/src/tools/miri/tests/pass/provenance.rs index 2e4d240cc48a1..8c52b703190d2 100644 --- a/src/tools/miri/tests/pass/provenance.rs +++ b/src/tools/miri/tests/pass/provenance.rs @@ -1,6 +1,5 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(strict_provenance)] use std::{mem, ptr}; const PTR_SIZE: usize = mem::size_of::<&i32>(); diff --git a/src/tools/miri/tests/pass/ptr_int_from_exposed.rs b/src/tools/miri/tests/pass/ptr_int_from_exposed.rs index ade5f537785b7..9a76c8dd34972 100644 --- a/src/tools/miri/tests/pass/ptr_int_from_exposed.rs +++ b/src/tools/miri/tests/pass/ptr_int_from_exposed.rs @@ -2,7 +2,6 @@ // Tree Borrows doesn't support int2ptr casts, but let's make sure we don't immediately crash either. //@[tree]compile-flags: -Zmiri-tree-borrows //@[stack]compile-flags: -Zmiri-permissive-provenance -#![feature(strict_provenance, exposed_provenance)] use std::ptr; diff --git a/src/tools/miri/tests/pass/ptr_raw.rs b/src/tools/miri/tests/pass/ptr_raw.rs index dcf13d97ce3d1..c958dfddf6912 100644 --- a/src/tools/miri/tests/pass/ptr_raw.rs +++ b/src/tools/miri/tests/pass/ptr_raw.rs @@ -1,4 +1,3 @@ -#![feature(strict_provenance)] use std::mem; use std::ptr::{self, addr_of}; diff --git a/src/tools/miri/tests/pass/shims/ptr_mask.rs b/src/tools/miri/tests/pass/shims/ptr_mask.rs index fb8bb6b13dbc2..6872ba577d251 100644 --- a/src/tools/miri/tests/pass/shims/ptr_mask.rs +++ b/src/tools/miri/tests/pass/shims/ptr_mask.rs @@ -1,5 +1,4 @@ #![feature(ptr_mask)] -#![feature(strict_provenance)] fn main() { let v: u32 = 0xABCDABCD; diff --git a/src/tools/miri/tests/pass/slices.rs b/src/tools/miri/tests/pass/slices.rs index 459d04d6761c1..86c3d13da4f0b 100644 --- a/src/tools/miri/tests/pass/slices.rs +++ b/src/tools/miri/tests/pass/slices.rs @@ -4,7 +4,6 @@ #![feature(slice_as_chunks)] #![feature(slice_partition_dedup)] #![feature(layout_for_ptr)] -#![feature(strict_provenance)] use std::ptr; use std::slice; diff --git a/src/tools/miri/tests/pass/stacked-borrows/int-to-ptr.rs b/src/tools/miri/tests/pass/stacked-borrows/int-to-ptr.rs index c89d79b42e31e..8a05fca3f312f 100644 --- a/src/tools/miri/tests/pass/stacked-borrows/int-to-ptr.rs +++ b/src/tools/miri/tests/pass/stacked-borrows/int-to-ptr.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-permissive-provenance -#![feature(exposed_provenance)] use std::ptr; // Just to make sure that casting a ref to raw, to int and back to raw diff --git a/src/tools/miri/tests/pass/stacked-borrows/stack-printing.rs b/src/tools/miri/tests/pass/stacked-borrows/stack-printing.rs index 9c9db4d1b3b53..654e24be0183d 100644 --- a/src/tools/miri/tests/pass/stacked-borrows/stack-printing.rs +++ b/src/tools/miri/tests/pass/stacked-borrows/stack-printing.rs @@ -2,7 +2,6 @@ // printing, not how it interacts with the GC. //@compile-flags: -Zmiri-permissive-provenance -Zmiri-provenance-gc=0 -#![feature(strict_provenance)] use std::{ alloc::{self, Layout}, mem::ManuallyDrop, diff --git a/src/tools/miri/tests/pass/stacked-borrows/unknown-bottom-gc.rs b/src/tools/miri/tests/pass/stacked-borrows/unknown-bottom-gc.rs index 55356814a1a03..b0f53283cdaf9 100644 --- a/src/tools/miri/tests/pass/stacked-borrows/unknown-bottom-gc.rs +++ b/src/tools/miri/tests/pass/stacked-borrows/unknown-bottom-gc.rs @@ -1,5 +1,4 @@ //@compile-flags: -Zmiri-permissive-provenance -#![feature(exposed_provenance)] use std::ptr; diff --git a/src/tools/miri/tests/pass/transmute_ptr.rs b/src/tools/miri/tests/pass/transmute_ptr.rs index ce6d86b7068a0..0944781c6defa 100644 --- a/src/tools/miri/tests/pass/transmute_ptr.rs +++ b/src/tools/miri/tests/pass/transmute_ptr.rs @@ -1,6 +1,5 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(strict_provenance)] use std::{mem, ptr}; fn t1() { diff --git a/src/tools/miri/tests/pass/underscore_pattern.rs b/src/tools/miri/tests/pass/underscore_pattern.rs index f0afe5589546e..3d0c9d0e129bf 100644 --- a/src/tools/miri/tests/pass/underscore_pattern.rs +++ b/src/tools/miri/tests/pass/underscore_pattern.rs @@ -1,5 +1,4 @@ // Various tests ensuring that underscore patterns really just construct the place, but don't check its contents. -#![feature(strict_provenance)] use std::ptr; fn main() { diff --git a/src/tools/miri/tests/pass/zero-sized-accesses-and-offsets.rs b/src/tools/miri/tests/pass/zero-sized-accesses-and-offsets.rs index a3356b682a6a5..6c0d9bc253aac 100644 --- a/src/tools/miri/tests/pass/zero-sized-accesses-and-offsets.rs +++ b/src/tools/miri/tests/pass/zero-sized-accesses-and-offsets.rs @@ -1,5 +1,4 @@ //! Tests specific for : zero-sized operations. -#![feature(strict_provenance)] use std::ptr; diff --git a/tests/codegen/atomicptr.rs b/tests/codegen/atomicptr.rs index ea8b382c8fcc7..e8c5e6a674970 100644 --- a/tests/codegen/atomicptr.rs +++ b/tests/codegen/atomicptr.rs @@ -6,7 +6,6 @@ //@ compile-flags: -O -Cno-prepopulate-passes #![crate_type = "lib"] -#![feature(strict_provenance)] #![feature(strict_provenance_atomic_ptr)] use std::ptr::without_provenance_mut; diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs index d4a74b3d78283..122f02fbbc55b 100644 --- a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs +++ b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs @@ -1,7 +1,6 @@ //@ compile-flags: -O -C debug-assertions=yes #![crate_type = "lib"] -#![feature(strict_provenance)] #[no_mangle] pub fn test(src: *const u8, dst: *const u8) -> usize { diff --git a/tests/mir-opt/gvn_ptr_eq_with_constant.rs b/tests/mir-opt/gvn_ptr_eq_with_constant.rs index d8025072ee3d3..05445208e070f 100644 --- a/tests/mir-opt/gvn_ptr_eq_with_constant.rs +++ b/tests/mir-opt/gvn_ptr_eq_with_constant.rs @@ -5,8 +5,6 @@ // Regression for -#![feature(strict_provenance)] - struct Foo(std::marker::PhantomData); impl Foo { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs index 0c9df7ecd7827..b2b4934aa5f18 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs @@ -2,8 +2,6 @@ //@ compile-flags: -Copt-level=2 //@ run-pass -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs index b188b794d1fc7..bf130c9f75982 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908 -#![feature(exposed_provenance)] - use std::ptr; fn f() -> usize { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs index 7f64e23b9c121..cdf07eade8740 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(exposed_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs index 3417296ce125a..f128e1bb0841a 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(exposed_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs index e1e9e3f46b8ae..0baf8886395e8 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs index 8d581e8c9e93e..c7f46318aaef7 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs index 506f114cd2a41..b163c282d9336 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(exposed_provenance)] - use std::{ cell::{Ref, RefCell}, ptr, diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs index 603db5e08f4af..7ccff8d0848e9 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs @@ -4,8 +4,6 @@ // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs index 0243c2bfe9511..4602ec654d107 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs @@ -2,8 +2,6 @@ //@ compile-flags: -Copt-level=2 //@ run-pass -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs index 29758036a21ed..789a78c15b4e2 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908 -#![feature(strict_provenance)] - use std::ptr; fn f() -> usize { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs index 11925261a6529..5f4ee731f7d34 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(strict_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs index e628bb90faac3..0414879804a5a 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(strict_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs index 075e3475a32cc..b7165ce1e5ce3 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs index 6d7b6fa33e026..a02ff30918daf 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs index 67660d285a48a..fea41e0361294 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(strict_provenance)] - use std::{ cell::{Ref, RefCell}, ptr, diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs index a89310f993045..d963e45e4cdf2 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs @@ -4,8 +4,6 @@ // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance.rs b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.rs similarity index 100% rename from tests/ui/feature-gates/feature-gate-strict_provenance.rs rename to tests/ui/feature-gates/feature-gate-strict_provenance_lints.rs diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr similarity index 57% rename from tests/ui/feature-gates/feature-gate-strict_provenance.stderr rename to tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr index 82078d576ad68..15428cbd4be4c 100644 --- a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr +++ b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr @@ -1,24 +1,24 @@ warning: unknown lint: `fuzzy_provenance_casts` - --> $DIR/feature-gate-strict_provenance.rs:3:1 + --> $DIR/feature-gate-strict_provenance_lints.rs:3:1 | LL | #![deny(fuzzy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `fuzzy_provenance_casts` lint is unstable - = note: see issue #95228 for more information - = help: add `#![feature(strict_provenance)]` to the crate attributes to enable + = note: see issue #130351 for more information + = help: add `#![feature(strict_provenance_lints)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `lossy_provenance_casts` - --> $DIR/feature-gate-strict_provenance.rs:5:1 + --> $DIR/feature-gate-strict_provenance_lints.rs:5:1 | LL | #![deny(lossy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `lossy_provenance_casts` lint is unstable - = note: see issue #95228 for more information - = help: add `#![feature(strict_provenance)]` to the crate attributes to enable + = note: see issue #130351 for more information + = help: add `#![feature(strict_provenance_lints)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: 2 warnings emitted diff --git a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs index d2d72a68f1396..187209d4e207e 100644 --- a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs +++ b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs @@ -1,4 +1,4 @@ -#![feature(strict_provenance)] +#![feature(strict_provenance_lints)] #![deny(fuzzy_provenance_casts)] fn main() { diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.rs b/tests/ui/lint/lint-strict-provenance-lossy-casts.rs index 9799a05375682..395dc75f82555 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.rs +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.rs @@ -1,4 +1,4 @@ -#![feature(strict_provenance)] +#![feature(strict_provenance_lints)] #![deny(lossy_provenance_casts)] fn main() { diff --git a/tests/ui/mir/alignment/i686-pc-windows-msvc.rs b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs index 379f61ae818f2..c6b47a6d679fb 100644 --- a/tests/ui/mir/alignment/i686-pc-windows-msvc.rs +++ b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs @@ -7,8 +7,6 @@ // that will fail on dereferencing of a pointer to u64 which is not 8-byte-aligned but is // 4-byte-aligned. -#![feature(strict_provenance)] - fn main() { let mut x = [0u64; 2]; let ptr = x.as_mut_ptr(); diff --git a/tests/ui/mir/alignment/packed.rs b/tests/ui/mir/alignment/packed.rs index 1a12425f11a96..cf908365e1a5d 100644 --- a/tests/ui/mir/alignment/packed.rs +++ b/tests/ui/mir/alignment/packed.rs @@ -1,8 +1,6 @@ //@ run-pass //@ compile-flags: -C debug-assertions -#![feature(strict_provenance)] - #[repr(packed)] struct Misaligner { _head: u8, diff --git a/tests/ui/structs-enums/type-sizes.rs b/tests/ui/structs-enums/type-sizes.rs index 5ca9c8678b790..7bd94551404a7 100644 --- a/tests/ui/structs-enums/type-sizes.rs +++ b/tests/ui/structs-enums/type-sizes.rs @@ -5,7 +5,6 @@ #![allow(dead_code)] #![feature(never_type)] #![feature(pointer_is_aligned_to)] -#![feature(strict_provenance)] use std::mem::size_of; use std::num::NonZero;