]> git.lizzy.rs Git - rust.git/commitdiff
Make the test actually emit the future incompat lint
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 23 Nov 2022 14:41:06 +0000 (14:41 +0000)
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Thu, 15 Dec 2022 16:54:00 +0000 (16:54 +0000)
compiler/rustc_lint_defs/src/builtin.rs

index 848906e29d5b189172bb1e18ad67d266d196765a..33cb35e60ebb6cfc1edf37d68a4262b57956e19b 100644 (file)
     /// ### Example
     ///
     /// ```rust,compile_fail
+    /// #![feature(const_ptr_read)]
     /// const FOO: () = unsafe {
-    ///     let x = [0_u8; 10];
-    ///     let y = x.as_ptr() as *const u32;
-    ///     *y; // the address of a `u8` array is unknown and thus we don't know if
+    ///     let x = &[0_u8; 4];
+    ///     let y = x.as_ptr().cast::<u32>();
+    ///     y.read(); // the address of a `u8` array is unknown and thus we don't know if
     ///     // it is aligned enough for reading a `u32`.
     /// };
     /// ```