]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/consts/const-ptr-nonnull.rs
remove useless ident() functions in const tests and replace the useful ones by black_...
[rust.git] / src / test / run-pass / consts / const-ptr-nonnull.rs
index 91624e92fbe753ad0801e589095e72f008ab8465..4cdc8c7942359d02744b7e8d32166966dbc9573d 100644 (file)
@@ -1,17 +1,16 @@
 // run-pass
 
-#![feature(const_ptr_nonnull)]
+#![feature(ptr_internals, test)]
+
+extern crate test;
+use test::black_box as b; // prevent promotion of the argument and const-propagation of the result
 
 use std::ptr::NonNull;
 
 const DANGLING: NonNull<u32> = NonNull::dangling();
 const CASTED: NonNull<u32> = NonNull::cast(NonNull::<i32>::dangling());
 
-fn ident<T>(ident: T) -> T {
-    ident
-}
-
 pub fn main() {
-    assert_eq!(DANGLING, ident(NonNull::dangling()));
-    assert_eq!(CASTED, ident(NonNull::dangling()));
+    assert_eq!(DANGLING, b(NonNull::dangling()));
+    assert_eq!(CASTED, b(NonNull::dangling()));
 }