Skip to content

Commit 1ac9bf6

Browse files
committed
auto merge of #11738 : dmanescu/rust/11721, r=alexcrichton
Fixes #11721
2 parents d21b183 + 28b987b commit 1ac9bf6

File tree

8 files changed

+61
-1
lines changed

8 files changed

+61
-1
lines changed

src/librustc/front/feature_gate.rs

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
4747
("macro_registrar", Active),
4848
("log_syntax", Active),
4949
("trace_macros", Active),
50+
("simd", Active),
5051

5152
// These are used to test this portion of the compiler, they don't actually
5253
// mean anything
@@ -171,6 +172,13 @@ impl Visitor<()> for Context {
171172
}
172173
}
173174

175+
ast::ItemStruct(..) => {
176+
if attr::contains_name(i.attrs, "simd") {
177+
self.gate_feature("simd", i.span,
178+
"SIMD types are experimental and possibly buggy");
179+
}
180+
}
181+
174182
_ => {}
175183
}
176184

src/libstd/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@
5252
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
5353
html_root_url = "http://static.rust-lang.org/doc/master")];
5454

55-
#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args)];
55+
#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args, simd)];
5656

5757
// Don't link to std. We are std.
5858
#[no_std];
5959

6060
#[deny(non_camel_case_types)];
6161
#[deny(missing_doc)];
62+
#[allow(unknown_features)];
6263

6364
// When testing libstd, bring in libuv as the I/O backend so tests can print
6465
// things and all of the std::io tests have an I/O interface to run on top

src/libstd/unstable/simd.rs

+10
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,42 @@
1212
1313
#[allow(non_camel_case_types)];
1414

15+
#[experimental]
1516
#[simd]
1617
pub struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
1718

19+
#[experimental]
1820
#[simd]
1921
pub struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
2022

23+
#[experimental]
2124
#[simd]
2225
pub struct i32x4(i32, i32, i32, i32);
2326

27+
#[experimental]
2428
#[simd]
2529
pub struct i64x2(i64, i64);
2630

31+
#[experimental]
2732
#[simd]
2833
pub struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
2934

35+
#[experimental]
3036
#[simd]
3137
pub struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
3238

39+
#[experimental]
3340
#[simd]
3441
pub struct u32x4(u32, u32, u32, u32);
3542

43+
#[experimental]
3644
#[simd]
3745
pub struct u64x2(u64, u64);
3846

47+
#[experimental]
3948
#[simd]
4049
pub struct f32x4(f32, f32, f32, f32);
4150

51+
#[experimental]
4252
#[simd]
4353
pub struct f64x2(f64, f64);

src/test/compile-fail/gated-simd.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[simd]
12+
pub struct i64x2(i64, i64); //~ ERROR: SIMD types are experimental
13+
14+
fn main() {}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// xfail-test FIXME #11741 tuple structs ignore stability attributes
12+
13+
#[deny(experimental)];
14+
15+
use std::unstable::simd;
16+
17+
fn main() {
18+
let _ = simd::i64x2(0, 0); //~ ERROR: experimental
19+
}

src/test/compile-fail/simd-type.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[feature(simd)];
2+
13
#[simd]
24
struct vec4<T>(T, T, T, T); //~ ERROR SIMD vector cannot be generic
35

src/test/run-pass/simd-binop.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[allow(experimental)];
12+
1113
use std::unstable::simd::{i32x4, f32x4};
1214

1315
fn test_int(e: i32) -> i32 {

src/test/run-pass/simd-type.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// xfail-fast feature doesn't work
2+
3+
#[feature(simd)];
4+
15
#[simd]
26
struct RGBA {
37
r: f32,

0 commit comments

Comments
 (0)