diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2015-08-06 11:11:26 -0700 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2015-08-17 14:41:38 -0700 |
| commit | 717da9513f787f6f46726bc62e5d3b173435522e (patch) | |
| tree | 55bd67cfdd8f0c8b6ec444fbfbc3b7c5e6579750 /src/libsyntax | |
| parent | 58891278a322f5e09ea0b9da762e37b57fc39d1f (diff) | |
| download | rust-717da9513f787f6f46726bc62e5d3b173435522e.tar.gz rust-717da9513f787f6f46726bc62e5d3b173435522e.zip | |
Create "platform-intrinsic" ABI for SIMD/platform intrinsics.
This is purposely separate to the "rust-intrinsic" ABI, because these intrinsics are theoretically going to become stable, and should be fine to be independent of the compiler/language internals since they're intimately to the platform.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/abi.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 50c86a80b4a..c0fe541ead5 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -47,6 +47,7 @@ pub enum Abi { System, RustIntrinsic, RustCall, + PlatformIntrinsic, } #[allow(non_camel_case_types)] @@ -95,6 +96,7 @@ const AbiDatas: &'static [AbiData] = &[ AbiData {abi: System, name: "system" }, AbiData {abi: RustIntrinsic, name: "rust-intrinsic" }, AbiData {abi: RustCall, name: "rust-call" }, + AbiData {abi: PlatformIntrinsic, name: "platform-intrinsic" } ]; /// Returns the ABI with the given name (if any). diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 9a1c97a4d29..b0167d75bc0 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -184,6 +184,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ // Allows cfg(target_feature = "..."). ("cfg_target_feature", "1.3.0", Active), + + // allow `extern "platform-intrinsic" { ... }` + ("platform_intrinsics", "1.4.0", Active), ]; // (changing above list without updating src/doc/reference.md makes @cmr sad) @@ -694,10 +697,16 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { across platforms, it is recommended to \ use `#[link(name = \"foo\")]` instead") } - if foreign_module.abi == Abi::RustIntrinsic { - self.gate_feature("intrinsics", - i.span, - "intrinsics are subject to change") + let maybe_feature = match foreign_module.abi { + Abi::RustIntrinsic => Some(("intrinsics", "intrinsics are subject to change")), + Abi::PlatformIntrinsic => { + Some(("platform_intrinsics", + "platform intrinsics are experimental and possibly buggy")) + } + _ => None + }; + if let Some((feature, msg)) = maybe_feature { + self.gate_feature(feature, i.span, msg) } } |
