Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow FFI-unsafe warnings for u128/i128 #323

Merged
merged 3 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#![cfg_attr(thumb, no_main)]
#![deny(dead_code)]
#![feature(asm)]
#![feature(compiler_builtins_lib)]
#![feature(lang_items)]
#![feature(start)]
#![feature(allocator_api)]
Expand Down
33 changes: 9 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
#![cfg_attr(not(stage0), deny(warnings))]
#![cfg_attr(not(test), no_std)]
#![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
#![crate_name = "compiler_builtins"]
#![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(abi_unadjusted)]
#![feature(asm)]
#![feature(compiler_builtins)]
#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(linkage)]
#![feature(naked_functions)]
#![feature(repr_simd)]
#![feature(abi_unadjusted)]
#![feature(linkage)]
#![feature(lang_items)]
#![allow(unused_features)]
#![no_builtins]
#![cfg_attr(feature = "compiler-builtins", feature(staged_api))]
#![cfg_attr(
feature = "compiler-builtins",
unstable(
feature = "compiler_builtins_lib",
reason = "Compiler builtins. Will never become stable.",
issue = "0"
)
)]
#![no_std]
#![allow(unused_features)]
// We use `u128` in a whole bunch of places which we currently agree with the
// compiler on ABIs and such, so we should be "good enough" for now and changes
// to the `u128` ABI will be reflected here.
#![allow(improper_ctypes)]

// We disable #[no_mangle] for tests so that we can verify the test results
// against the native compiler-rt implementations of the builtins.
Expand Down
2 changes: 1 addition & 1 deletion testcrate/tests/aeabi_memclr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Aligned {

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

Expand Down
36 changes: 18 additions & 18 deletions testcrate/tests/aeabi_memset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Aligned {

#[test]
fn zero() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -54,7 +54,7 @@ fn zero() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -66,7 +66,7 @@ fn zero() {

#[test]
fn one() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 1;
Expand All @@ -76,7 +76,7 @@ fn one() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -88,7 +88,7 @@ fn one() {

#[test]
fn two() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 2;
Expand All @@ -98,7 +98,7 @@ fn two() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -110,7 +110,7 @@ fn two() {

#[test]
fn three() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 3;
Expand All @@ -120,7 +120,7 @@ fn three() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -132,7 +132,7 @@ fn three() {

#[test]
fn four() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 4;
Expand All @@ -142,7 +142,7 @@ fn four() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -154,7 +154,7 @@ fn four() {

#[test]
fn five() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 5;
Expand All @@ -164,7 +164,7 @@ fn five() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -176,7 +176,7 @@ fn five() {

#[test]
fn six() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 6;
Expand All @@ -186,7 +186,7 @@ fn six() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -198,7 +198,7 @@ fn six() {

#[test]
fn seven() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 7;
Expand All @@ -208,7 +208,7 @@ fn seven() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand All @@ -220,7 +220,7 @@ fn seven() {

#[test]
fn eight() {
let mut aligned = Aligned::new([0u8; 8]);;
let mut aligned = Aligned::new([0u8; 8]);
assert_eq!(mem::align_of_val(&aligned), 4);
let xs = &mut aligned.array;
let n = 8;
Expand All @@ -230,7 +230,7 @@ fn eight() {

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);
let xs = &mut aligned.array;
let c = 0xdeadbeef;
Expand Down