@@ -65,6 +65,7 @@ macro_rules! assert_unsafe_precondition {
6565 #[ inline]
6666 #[ rustc_nounwind]
6767 #[ rustc_const_unstable( feature = "const_ub_checks" , issue = "none" ) ]
68+ #[ track_caller]
6869 const fn precondition_check( $( $name: $ty) ,* ) {
6970 if !$e {
7071 :: core:: panicking:: panic_nounwind(
@@ -92,8 +93,10 @@ pub use intrinsics::ub_checks as check_library_ub;
9293/// language UB checks which generally produce better errors.
9394#[ rustc_const_unstable( feature = "const_ub_checks" , issue = "none" ) ]
9495#[ inline]
96+ #[ track_caller]
9597pub ( crate ) const fn check_language_ub ( ) -> bool {
9698 #[ inline]
99+ #[ track_caller]
97100 fn runtime ( ) -> bool {
98101 // Disable UB checks in Miri.
99102 !cfg ! ( miri)
@@ -116,11 +119,13 @@ pub(crate) const fn check_language_ub() -> bool {
116119/// for `assert_unsafe_precondition!` with `check_language_ub`, in which case the
117120/// check is anyway not executed in `const`.
118121#[ inline]
122+ #[ track_caller]
119123pub ( crate ) const fn is_aligned_and_not_null ( ptr : * const ( ) , align : usize ) -> bool {
120124 !ptr. is_null ( ) && ptr. is_aligned_to ( align)
121125}
122126
123127#[ inline]
128+ #[ track_caller]
124129pub ( crate ) const fn is_valid_allocation_size ( size : usize , len : usize ) -> bool {
125130 let max_len = if size == 0 { usize:: MAX } else { isize:: MAX as usize / size } ;
126131 len <= max_len
@@ -132,13 +137,15 @@ pub(crate) const fn is_valid_allocation_size(size: usize, len: usize) -> bool {
132137/// Note that in const-eval this function just returns `true` and therefore must
133138/// only be used with `assert_unsafe_precondition!`, similar to `is_aligned_and_not_null`.
134139#[ inline]
140+ #[ track_caller]
135141pub ( crate ) const fn is_nonoverlapping (
136142 src : * const ( ) ,
137143 dst : * const ( ) ,
138144 size : usize ,
139145 count : usize ,
140146) -> bool {
141147 #[ inline]
148+ #[ track_caller]
142149 fn runtime ( src : * const ( ) , dst : * const ( ) , size : usize , count : usize ) -> bool {
143150 let src_usize = src. addr ( ) ;
144151 let dst_usize = dst. addr ( ) ;
0 commit comments