Allow FFI-unsafe warnings for u128/i128 (#323)

* Allow FFI-unsafe warnings for u128/i128

Handle new warnings on nightly, and we shouldn't need to worry about
these with compiler-builtins since this is tied to a particular compiler.

* Clean up crate attributes

* No need for stability marker
* Rustdoc docs not used for this crate
* Remove old build-system related cruft from rustc itself.

* Run `cargo fmt`
This commit is contained in:
Alex Crichton 2019-11-11 12:19:10 -06:00 committed by GitHub
parent a533ae9c5a
commit 40ef6cb749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 44 deletions

View File

@ -7,7 +7,6 @@
#![cfg_attr(thumb, no_main)] #![cfg_attr(thumb, no_main)]
#![deny(dead_code)] #![deny(dead_code)]
#![feature(asm)] #![feature(asm)]
#![feature(compiler_builtins_lib)]
#![feature(lang_items)] #![feature(lang_items)]
#![feature(start)] #![feature(start)]
#![feature(allocator_api)] #![feature(allocator_api)]

View File

@ -1,34 +1,19 @@
#![cfg_attr(not(stage0), deny(warnings))]
#![cfg_attr(not(test), no_std)]
#![cfg_attr(feature = "compiler-builtins", compiler_builtins)] #![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
#![crate_name = "compiler_builtins"] #![feature(abi_unadjusted)]
#![crate_type = "rlib"]
#![doc(
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings)))
)]
#![feature(asm)] #![feature(asm)]
#![feature(compiler_builtins)] #![feature(compiler_builtins)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(linkage)]
#![feature(naked_functions)] #![feature(naked_functions)]
#![feature(repr_simd)] #![feature(repr_simd)]
#![feature(abi_unadjusted)]
#![feature(linkage)]
#![feature(lang_items)]
#![allow(unused_features)]
#![no_builtins] #![no_builtins]
#![cfg_attr(feature = "compiler-builtins", feature(staged_api))] #![no_std]
#![cfg_attr( #![allow(unused_features)]
feature = "compiler-builtins", // We use `u128` in a whole bunch of places which we currently agree with the
unstable( // compiler on ABIs and such, so we should be "good enough" for now and changes
feature = "compiler_builtins_lib", // to the `u128` ABI will be reflected here.
reason = "Compiler builtins. Will never become stable.", #![allow(improper_ctypes)]
issue = "0"
)
)]
// We disable #[no_mangle] for tests so that we can verify the test results // We disable #[no_mangle] for tests so that we can verify the test results
// against the native compiler-rt implementations of the builtins. // against the native compiler-rt implementations of the builtins.

View File

@ -46,7 +46,7 @@ impl Aligned {
#[test] #[test]
fn memclr4() { fn memclr4() {
let mut aligned = Aligned::new();; let mut aligned = Aligned::new();
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;

View File

@ -45,7 +45,7 @@ impl Aligned {
#[test] #[test]
fn zero() { fn zero() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -54,7 +54,7 @@ fn zero() {
assert_eq!(*xs, [0; 8]); assert_eq!(*xs, [0; 8]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -66,7 +66,7 @@ fn zero() {
#[test] #[test]
fn one() { fn one() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 1; let n = 1;
@ -76,7 +76,7 @@ fn one() {
assert_eq!(*xs, [0xef, 0, 0, 0, 0, 0, 0, 0]); assert_eq!(*xs, [0xef, 0, 0, 0, 0, 0, 0, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -88,7 +88,7 @@ fn one() {
#[test] #[test]
fn two() { fn two() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 2; let n = 2;
@ -98,7 +98,7 @@ fn two() {
assert_eq!(*xs, [0xef, 0xef, 0, 0, 0, 0, 0, 0]); assert_eq!(*xs, [0xef, 0xef, 0, 0, 0, 0, 0, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -110,7 +110,7 @@ fn two() {
#[test] #[test]
fn three() { fn three() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 3; let n = 3;
@ -120,7 +120,7 @@ fn three() {
assert_eq!(*xs, [0xef, 0xef, 0xef, 0, 0, 0, 0, 0]); assert_eq!(*xs, [0xef, 0xef, 0xef, 0, 0, 0, 0, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -132,7 +132,7 @@ fn three() {
#[test] #[test]
fn four() { fn four() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 4; let n = 4;
@ -142,7 +142,7 @@ fn four() {
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0, 0, 0, 0]); assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0, 0, 0, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -154,7 +154,7 @@ fn four() {
#[test] #[test]
fn five() { fn five() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 5; let n = 5;
@ -164,7 +164,7 @@ fn five() {
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0, 0, 0]); assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0, 0, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -176,7 +176,7 @@ fn five() {
#[test] #[test]
fn six() { fn six() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 6; let n = 6;
@ -186,7 +186,7 @@ fn six() {
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0, 0]); assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -198,7 +198,7 @@ fn six() {
#[test] #[test]
fn seven() { fn seven() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 7; let n = 7;
@ -208,7 +208,7 @@ fn seven() {
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0]); assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;
@ -220,7 +220,7 @@ fn seven() {
#[test] #[test]
fn eight() { fn eight() {
let mut aligned = Aligned::new([0u8; 8]);; let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let n = 8; let n = 8;
@ -230,7 +230,7 @@ fn eight() {
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef]); assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef]);
let mut aligned = Aligned::new([1u8; 8]);; let mut aligned = Aligned::new([1u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4); assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array; let xs = &mut aligned.array;
let c = 0xdeadbeef; let c = 0xdeadbeef;