@@ -65,6 +65,7 @@ macro_rules! assert_unsafe_precondition {
65
65
#[ inline]
66
66
#[ rustc_nounwind]
67
67
#[ rustc_const_unstable( feature = "const_ub_checks" , issue = "none" ) ]
68
+ #[ track_caller]
68
69
const fn precondition_check( $( $name: $ty) ,* ) {
69
70
if !$e {
70
71
:: core:: panicking:: panic_nounwind(
@@ -92,8 +93,10 @@ pub use intrinsics::ub_checks as check_library_ub;
92
93
/// language UB checks which generally produce better errors.
93
94
#[ rustc_const_unstable( feature = "const_ub_checks" , issue = "none" ) ]
94
95
#[ inline]
96
+ #[ track_caller]
95
97
pub ( crate ) const fn check_language_ub ( ) -> bool {
96
98
#[ inline]
99
+ #[ track_caller]
97
100
fn runtime ( ) -> bool {
98
101
// Disable UB checks in Miri.
99
102
!cfg ! ( miri)
@@ -116,11 +119,13 @@ pub(crate) const fn check_language_ub() -> bool {
116
119
/// for `assert_unsafe_precondition!` with `check_language_ub`, in which case the
117
120
/// check is anyway not executed in `const`.
118
121
#[ inline]
122
+ #[ track_caller]
119
123
pub ( crate ) const fn is_aligned_and_not_null ( ptr : * const ( ) , align : usize ) -> bool {
120
124
!ptr. is_null ( ) && ptr. is_aligned_to ( align)
121
125
}
122
126
123
127
#[ inline]
128
+ #[ track_caller]
124
129
pub ( crate ) const fn is_valid_allocation_size ( size : usize , len : usize ) -> bool {
125
130
let max_len = if size == 0 { usize:: MAX } else { isize:: MAX as usize / size } ;
126
131
len <= max_len
@@ -132,13 +137,15 @@ pub(crate) const fn is_valid_allocation_size(size: usize, len: usize) -> bool {
132
137
/// Note that in const-eval this function just returns `true` and therefore must
133
138
/// only be used with `assert_unsafe_precondition!`, similar to `is_aligned_and_not_null`.
134
139
#[ inline]
140
+ #[ track_caller]
135
141
pub ( crate ) const fn is_nonoverlapping (
136
142
src : * const ( ) ,
137
143
dst : * const ( ) ,
138
144
size : usize ,
139
145
count : usize ,
140
146
) -> bool {
141
147
#[ inline]
148
+ #[ track_caller]
142
149
fn runtime ( src : * const ( ) , dst : * const ( ) , size : usize , count : usize ) -> bool {
143
150
let src_usize = src. addr ( ) ;
144
151
let dst_usize = dst. addr ( ) ;
0 commit comments