@@ -140,6 +140,7 @@ pub use crate::intrinsics::transmute;
140
140
#[ inline]
141
141
#[ rustc_const_stable( feature = "const_forget" , since = "1.46.0" ) ]
142
142
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
143
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_forget" ) ]
143
144
pub const fn forget < T > ( t : T ) {
144
145
let _ = ManuallyDrop :: new ( t) ;
145
146
}
@@ -298,6 +299,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
298
299
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
299
300
#[ rustc_promotable]
300
301
#[ rustc_const_stable( feature = "const_size_of" , since = "1.24.0" ) ]
302
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_size_of" ) ]
301
303
pub const fn size_of < T > ( ) -> usize {
302
304
intrinsics:: size_of :: < T > ( )
303
305
}
@@ -324,6 +326,7 @@ pub const fn size_of<T>() -> usize {
324
326
#[ inline]
325
327
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
326
328
#[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
329
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_size_of_val" ) ]
327
330
pub const fn size_of_val < T : ?Sized > ( val : & T ) -> usize {
328
331
// SAFETY: `val` is a reference, so it's a valid raw pointer
329
332
unsafe { intrinsics:: size_of_val ( val) }
@@ -814,6 +817,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
814
817
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
815
818
#[ must_use = "if you don't need the old value, you can just assign the new value directly" ]
816
819
#[ rustc_const_unstable( feature = "const_replace" , issue = "83164" ) ]
820
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_replace" ) ]
817
821
pub const fn replace < T > ( dest : & mut T , src : T ) -> T {
818
822
// SAFETY: We read from `dest` but directly write `src` into it afterwards,
819
823
// such that the old value is not duplicated. Nothing is dropped and
@@ -888,6 +892,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
888
892
/// [`RefCell`]: crate::cell::RefCell
889
893
#[ inline]
890
894
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
895
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_drop" ) ]
891
896
pub fn drop < T > ( _x : T ) { }
892
897
893
898
/// Interprets `src` as having type `&U`, and then reads `src` without moving
@@ -1015,6 +1020,7 @@ impl<T> fmt::Debug for Discriminant<T> {
1015
1020
/// ```
1016
1021
#[ stable( feature = "discriminant_value" , since = "1.21.0" ) ]
1017
1022
#[ rustc_const_unstable( feature = "const_discriminant" , issue = "69821" ) ]
1023
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_discriminant" ) ]
1018
1024
pub const fn discriminant < T > ( v : & T ) -> Discriminant < T > {
1019
1025
Discriminant ( intrinsics:: discriminant_value ( v) )
1020
1026
}
0 commit comments