Skip to content

Commit 40ef6cb

Browse files
authored
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`
1 parent a533ae9 commit 40ef6cb

File tree

4 files changed

+28
-44
lines changed

4 files changed

+28
-44
lines changed

examples/intrinsics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![cfg_attr(thumb, no_main)]
88
#![deny(dead_code)]
99
#![feature(asm)]
10-
#![feature(compiler_builtins_lib)]
1110
#![feature(lang_items)]
1211
#![feature(start)]
1312
#![feature(allocator_api)]

src/lib.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
1-
#![cfg_attr(not(stage0), deny(warnings))]
2-
#![cfg_attr(not(test), no_std)]
31
#![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
4-
#![crate_name = "compiler_builtins"]
5-
#![crate_type = "rlib"]
6-
#![doc(
7-
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
8-
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
9-
html_root_url = "https://doc.rust-lang.org/nightly/",
10-
html_playground_url = "https://play.rust-lang.org/",
11-
test(attr(deny(warnings)))
12-
)]
2+
#![feature(abi_unadjusted)]
133
#![feature(asm)]
144
#![feature(compiler_builtins)]
155
#![feature(core_intrinsics)]
6+
#![feature(lang_items)]
7+
#![feature(linkage)]
168
#![feature(naked_functions)]
179
#![feature(repr_simd)]
18-
#![feature(abi_unadjusted)]
19-
#![feature(linkage)]
20-
#![feature(lang_items)]
21-
#![allow(unused_features)]
2210
#![no_builtins]
23-
#![cfg_attr(feature = "compiler-builtins", feature(staged_api))]
24-
#![cfg_attr(
25-
feature = "compiler-builtins",
26-
unstable(
27-
feature = "compiler_builtins_lib",
28-
reason = "Compiler builtins. Will never become stable.",
29-
issue = "0"
30-
)
31-
)]
11+
#![no_std]
12+
#![allow(unused_features)]
13+
// We use `u128` in a whole bunch of places which we currently agree with the
14+
// compiler on ABIs and such, so we should be "good enough" for now and changes
15+
// to the `u128` ABI will be reflected here.
16+
#![allow(improper_ctypes)]
3217

3318
// We disable #[no_mangle] for tests so that we can verify the test results
3419
// against the native compiler-rt implementations of the builtins.

testcrate/tests/aeabi_memclr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Aligned {
4646

4747
#[test]
4848
fn memclr4() {
49-
let mut aligned = Aligned::new();;
49+
let mut aligned = Aligned::new();
5050
assert_eq!(mem::align_of_val(&aligned), 4);
5151
let xs = &mut aligned.array;
5252

testcrate/tests/aeabi_memset.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl Aligned {
4545

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

5555
assert_eq!(*xs, [0; 8]);
5656

57-
let mut aligned = Aligned::new([1u8; 8]);;
57+
let mut aligned = Aligned::new([1u8; 8]);
5858
assert_eq!(mem::align_of_val(&aligned), 4);
5959
let xs = &mut aligned.array;
6060
let c = 0xdeadbeef;
@@ -66,7 +66,7 @@ fn zero() {
6666

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

7777
assert_eq!(*xs, [0xef, 0, 0, 0, 0, 0, 0, 0]);
7878

79-
let mut aligned = Aligned::new([1u8; 8]);;
79+
let mut aligned = Aligned::new([1u8; 8]);
8080
assert_eq!(mem::align_of_val(&aligned), 4);
8181
let xs = &mut aligned.array;
8282
let c = 0xdeadbeef;
@@ -88,7 +88,7 @@ fn one() {
8888

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

9999
assert_eq!(*xs, [0xef, 0xef, 0, 0, 0, 0, 0, 0]);
100100

101-
let mut aligned = Aligned::new([1u8; 8]);;
101+
let mut aligned = Aligned::new([1u8; 8]);
102102
assert_eq!(mem::align_of_val(&aligned), 4);
103103
let xs = &mut aligned.array;
104104
let c = 0xdeadbeef;
@@ -110,7 +110,7 @@ fn two() {
110110

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

121121
assert_eq!(*xs, [0xef, 0xef, 0xef, 0, 0, 0, 0, 0]);
122122

123-
let mut aligned = Aligned::new([1u8; 8]);;
123+
let mut aligned = Aligned::new([1u8; 8]);
124124
assert_eq!(mem::align_of_val(&aligned), 4);
125125
let xs = &mut aligned.array;
126126
let c = 0xdeadbeef;
@@ -132,7 +132,7 @@ fn three() {
132132

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

143143
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0, 0, 0, 0]);
144144

145-
let mut aligned = Aligned::new([1u8; 8]);;
145+
let mut aligned = Aligned::new([1u8; 8]);
146146
assert_eq!(mem::align_of_val(&aligned), 4);
147147
let xs = &mut aligned.array;
148148
let c = 0xdeadbeef;
@@ -154,7 +154,7 @@ fn four() {
154154

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

165165
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0, 0, 0]);
166166

167-
let mut aligned = Aligned::new([1u8; 8]);;
167+
let mut aligned = Aligned::new([1u8; 8]);
168168
assert_eq!(mem::align_of_val(&aligned), 4);
169169
let xs = &mut aligned.array;
170170
let c = 0xdeadbeef;
@@ -176,7 +176,7 @@ fn five() {
176176

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

187187
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0, 0]);
188188

189-
let mut aligned = Aligned::new([1u8; 8]);;
189+
let mut aligned = Aligned::new([1u8; 8]);
190190
assert_eq!(mem::align_of_val(&aligned), 4);
191191
let xs = &mut aligned.array;
192192
let c = 0xdeadbeef;
@@ -198,7 +198,7 @@ fn six() {
198198

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

209209
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0]);
210210

211-
let mut aligned = Aligned::new([1u8; 8]);;
211+
let mut aligned = Aligned::new([1u8; 8]);
212212
assert_eq!(mem::align_of_val(&aligned), 4);
213213
let xs = &mut aligned.array;
214214
let c = 0xdeadbeef;
@@ -220,7 +220,7 @@ fn seven() {
220220

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

231231
assert_eq!(*xs, [0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef]);
232232

233-
let mut aligned = Aligned::new([1u8; 8]);;
233+
let mut aligned = Aligned::new([1u8; 8]);
234234
assert_eq!(mem::align_of_val(&aligned), 4);
235235
let xs = &mut aligned.array;
236236
let c = 0xdeadbeef;

0 commit comments

Comments
 (0)