File tree 4 files changed +11
-6
lines changed
4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 176
176
// Language features:
177
177
// tidy-alphabetical-start
178
178
#![ cfg_attr( bootstrap, feature( associated_type_bounds) ) ]
179
+ #![ cfg_attr( not( bootstrap) , rustc_preserve_ub_checks) ]
179
180
#![ cfg_attr( not( test) , feature( coroutine_trait) ) ]
180
181
#![ cfg_attr( test, feature( panic_update_hook) ) ]
181
182
#![ cfg_attr( test, feature( test) ) ]
Original file line number Diff line number Diff line change @@ -2686,12 +2686,14 @@ pub const unsafe fn typed_swap<T>(x: *mut T, y: *mut T) {
2686
2686
unsafe { ptr:: swap_nonoverlapping ( x, y, 1 ) } ;
2687
2687
}
2688
2688
2689
- /// Returns whether we should perform some UB-checking at runtime. This evaluate to the value of
2690
- /// `cfg!(debug_assertions)` during monomorphization.
2691
- ///
2692
- /// This intrinsic is evaluated after monomorphization, which is relevant when mixing crates
2693
- /// compiled with and without debug_assertions. The common case here is a user program built with
2694
- /// debug_assertions linked against the distributed sysroot which is built without debug_assertions.
2689
+ /// Returns whether we should perform some UB-checking at runtime. This eventually evaluates to
2690
+ /// `cfg!(debug_assertions)`, but behaves different from `cfg!` when mixing crates built with different
2691
+ /// flags: if the crate has debug assertions enabled or carries the `#[rustc_preserve_ub_checks]`
2692
+ /// attribute, evaluation is delayed until monomorphization (or until the call gets inlined into
2693
+ /// a crate that does not delay evaluation further); otherwise it can happen any time.
2694
+ ///
2695
+ /// The common case here is a user program built with debug_assertions linked against the distributed
2696
+ /// sysroot which is built without debug_assertions but with `#[rustc_preserve_ub_checks]`.
2695
2697
/// For code that gets monomorphized in the user crate (i.e., generic functions and functions with
2696
2698
/// `#[inline]`), gating assertions on `ub_checks()` rather than `cfg!(debug_assertions)` means that
2697
2699
/// assertions are enabled whenever the *user crate* has debug assertions enabled. However if the
Original file line number Diff line number Diff line change 94
94
) ) ]
95
95
#![ no_core]
96
96
#![ rustc_coherence_is_core]
97
+ #![ cfg_attr( not( bootstrap) , rustc_preserve_ub_checks) ]
97
98
//
98
99
// Lints:
99
100
#![ deny( rust_2021_incompatible_or_patterns) ]
Original file line number Diff line number Diff line change 221
221
//
222
222
#![ cfg_attr( not( feature = "restricted-std" ) , stable( feature = "rust1" , since = "1.0.0" ) ) ]
223
223
#![ cfg_attr( feature = "restricted-std" , unstable( feature = "restricted_std" , issue = "none" ) ) ]
224
+ #![ cfg_attr( not( bootstrap) , rustc_preserve_ub_checks) ]
224
225
#![ doc(
225
226
html_playground_url = "https://play.rust-lang.org/" ,
226
227
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/" ,
You can’t perform that action at this time.
0 commit comments