Feature gate #[simd]

Fixes #11721
This commit is contained in:
David Manescu 2014-01-23 12:25:22 +11:00
parent 4176343073
commit 28b987b99a
8 changed files with 61 additions and 1 deletions

View File

@ -47,6 +47,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
("macro_registrar", Active),
("log_syntax", Active),
("trace_macros", Active),
("simd", Active),
// These are used to test this portion of the compiler, they don't actually
// mean anything
@ -171,6 +172,13 @@ impl Visitor<()> for Context {
}
}
ast::ItemStruct(..) => {
if attr::contains_name(i.attrs, "simd") {
self.gate_feature("simd", i.span,
"SIMD types are experimental and possibly buggy");
}
}
_ => {}
}

View File

@ -52,13 +52,14 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://static.rust-lang.org/doc/master")];
#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args)];
#[feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args, simd)];
// Don't link to std. We are std.
#[no_std];
#[deny(non_camel_case_types)];
#[deny(missing_doc)];
#[allow(unknown_features)];
// When testing libstd, bring in libuv as the I/O backend so tests can print
// things and all of the std::io tests have an I/O interface to run on top

View File

@ -12,32 +12,42 @@
#[allow(non_camel_case_types)];
#[experimental]
#[simd]
pub struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
#[experimental]
#[simd]
pub struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
#[experimental]
#[simd]
pub struct i32x4(i32, i32, i32, i32);
#[experimental]
#[simd]
pub struct i64x2(i64, i64);
#[experimental]
#[simd]
pub struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
#[experimental]
#[simd]
pub struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
#[experimental]
#[simd]
pub struct u32x4(u32, u32, u32, u32);
#[experimental]
#[simd]
pub struct u64x2(u64, u64);
#[experimental]
#[simd]
pub struct f32x4(f32, f32, f32, f32);
#[experimental]
#[simd]
pub struct f64x2(f64, f64);

View File

@ -0,0 +1,14 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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.
#[simd]
pub struct i64x2(i64, i64); //~ ERROR: SIMD types are experimental
fn main() {}

View File

@ -0,0 +1,19 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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.
// xfail-test FIXME #11741 tuple structs ignore stability attributes
#[deny(experimental)];
use std::unstable::simd;
fn main() {
let _ = simd::i64x2(0, 0); //~ ERROR: experimental
}

View File

@ -1,3 +1,5 @@
#[feature(simd)];
#[simd]
struct vec4<T>(T, T, T, T); //~ ERROR SIMD vector cannot be generic

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(experimental)];
use std::unstable::simd::{i32x4, f32x4};
fn test_int(e: i32) -> i32 {

View File

@ -1,3 +1,7 @@
// xfail-fast feature doesn't work
#[feature(simd)];
#[simd]
struct RGBA {
r: f32,