@@ -140,6 +140,7 @@ pub use crate::intrinsics::transmute;
140140#[ inline]
141141#[ rustc_const_stable( feature = "const_forget" , since = "1.46.0" ) ]
142142#[ stable( feature = "rust1" , since = "1.0.0" ) ]
143+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_forget" ) ]
143144pub const fn forget < T > ( t : T ) {
144145 let _ = ManuallyDrop :: new ( t) ;
145146}
@@ -298,6 +299,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
298299#[ stable( feature = "rust1" , since = "1.0.0" ) ]
299300#[ rustc_promotable]
300301#[ rustc_const_stable( feature = "const_size_of" , since = "1.24.0" ) ]
302+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_size_of" ) ]
301303pub const fn size_of < T > ( ) -> usize {
302304 intrinsics:: size_of :: < T > ( )
303305}
@@ -324,6 +326,7 @@ pub const fn size_of<T>() -> usize {
324326#[ inline]
325327#[ stable( feature = "rust1" , since = "1.0.0" ) ]
326328#[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
329+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_size_of_val" ) ]
327330pub const fn size_of_val < T : ?Sized > ( val : & T ) -> usize {
328331 // SAFETY: `val` is a reference, so it's a valid raw pointer
329332 unsafe { intrinsics:: size_of_val ( val) }
@@ -814,6 +817,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
814817#[ stable( feature = "rust1" , since = "1.0.0" ) ]
815818#[ must_use = "if you don't need the old value, you can just assign the new value directly" ]
816819#[ rustc_const_unstable( feature = "const_replace" , issue = "83164" ) ]
820+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_replace" ) ]
817821pub const fn replace < T > ( dest : & mut T , src : T ) -> T {
818822 // SAFETY: We read from `dest` but directly write `src` into it afterwards,
819823 // 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 {
888892/// [`RefCell`]: crate::cell::RefCell
889893#[ inline]
890894#[ stable( feature = "rust1" , since = "1.0.0" ) ]
895+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_drop" ) ]
891896pub fn drop < T > ( _x : T ) { }
892897
893898/// Interprets `src` as having type `&U`, and then reads `src` without moving
@@ -1015,6 +1020,7 @@ impl<T> fmt::Debug for Discriminant<T> {
10151020/// ```
10161021#[ stable( feature = "discriminant_value" , since = "1.21.0" ) ]
10171022#[ rustc_const_unstable( feature = "const_discriminant" , issue = "69821" ) ]
1023+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "mem_discriminant" ) ]
10181024pub const fn discriminant < T > ( v : & T ) -> Discriminant < T > {
10191025 Discriminant ( intrinsics:: discriminant_value ( v) )
10201026}
0 commit comments