Skip to content

Commit

Permalink
Make the test actually emit the future incompat lint
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 15, 2022
1 parent 5a06b1e commit 2d89027
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
/// };
/// ```
Expand Down

0 comments on commit 2d89027

Please sign in to comment.