]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/cast_alignment.rs
tests: fix formatting and update test output
[rust.git] / tests / ui / cast_alignment.rs
index 4985a90bdf561573e774d042b7b86a04e49e5ff2..dba19dfd0238444fa326fcdc079b6fab2b1d9523 100644 (file)
@@ -1,7 +1,19 @@
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 //! Test casts for alignment issues
 
-#[warn(cast_ptr_alignment)]
-#[allow(no_effect, unnecessary_operation, cast_lossless)]
+#![feature(rustc_private)]
+extern crate libc;
+
+#[warn(clippy::cast_ptr_alignment)]
+#[allow(clippy::no_effect, clippy::unnecessary_operation, clippy::cast_lossless)]
 fn main() {
     /* These should be warned against */
 
@@ -16,4 +28,7 @@ fn main() {
     // cast to less-strictly-aligned type
     (&1u16 as *const u16) as *const u8;
     (&mut 1u16 as *mut u16) as *mut u8;
+    // For c_void, we should trust the user. See #2677
+    (&1u32 as *const u32 as *const std::os::raw::c_void) as *const u32;
+    (&1u32 as *const u32 as *const libc::c_void) as *const u32;
 }