diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-11-23 14:41:06 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-12-15 16:54:00 +0000 |
| commit | 2d89027fac84d7ba95cf2d66b49136d3f0d08ba2 (patch) | |
| tree | 9552b53b0663e74acd3f45d8941f716983d68e44 | |
| parent | 5a06b1e67c746b5cdcaa03116dcc869b7b8fc2dd (diff) | |
| download | rust-2d89027fac84d7ba95cf2d66b49136d3f0d08ba2.tar.gz rust-2d89027fac84d7ba95cf2d66b49136d3f0d08ba2.zip | |
Make the test actually emit the future incompat lint
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 848906e29d5..33cb35e60eb 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1026,10 +1026,11 @@ declare_lint! { /// ### 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`. /// }; /// ``` |
