about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorIrina Popa <irinagpopa@gmail.com>2018-04-25 19:30:39 +0300
committerIrina Popa <irinagpopa@gmail.com>2018-04-26 17:49:16 +0300
commit04fa0e7bb3e462080be4a6cee45fd94b1c27d287 (patch)
tree13f3f018ba821be9c9375d5d06b3314e7994d7a1 /src/libsyntax
parent030244cd4a76914af7dc2939ed1a16f394ceda48 (diff)
downloadrust-04fa0e7bb3e462080be4a6cee45fd94b1c27d287.tar.gz
rust-04fa0e7bb3e462080be4a6cee45fd94b1c27d287.zip
rustc_target: move in syntax::abi and flip dependency.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/Cargo.toml2
-rw-r--r--src/libsyntax/abi.rs136
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/feature_gate.rs2
-rw-r--r--src/libsyntax/lib.rs6
-rw-r--r--src/libsyntax/parse/mod.rs2
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/libsyntax/test.rs2
-rw-r--r--src/libsyntax/visit.rs2
11 files changed, 10 insertions, 150 deletions
diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml
index 8c24f36615b..d1a5ab0211b 100644
--- a/src/libsyntax/Cargo.toml
+++ b/src/libsyntax/Cargo.toml
@@ -14,6 +14,6 @@ serialize = { path = "../libserialize" }
 log = "0.4"
 scoped-tls = "0.1"
 syntax_pos = { path = "../libsyntax_pos" }
-rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
 rustc_errors = { path = "../librustc_errors" }
 rustc_data_structures = { path = "../librustc_data_structures" }
+rustc_target = { path = "../librustc_target" }
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
deleted file mode 100644
index ed2eb209906..00000000000
--- a/src/libsyntax/abi.rs
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2012-2015 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.
-
-use std::fmt;
-
-#[derive(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)]
-pub enum Abi {
-    // NB: This ordering MUST match the AbiDatas array below.
-    // (This is ensured by the test indices_are_correct().)
-
-    // Single platform ABIs
-    Cdecl,
-    Stdcall,
-    Fastcall,
-    Vectorcall,
-    Thiscall,
-    Aapcs,
-    Win64,
-    SysV64,
-    PtxKernel,
-    Msp430Interrupt,
-    X86Interrupt,
-
-    // Multiplatform / generic ABIs
-    Rust,
-    C,
-    System,
-    RustIntrinsic,
-    RustCall,
-    PlatformIntrinsic,
-    Unadjusted
-}
-
-#[derive(Copy, Clone)]
-pub struct AbiData {
-    abi: Abi,
-
-    /// Name of this ABI as we like it called.
-    name: &'static str,
-
-    /// A generic ABI is supported on all platforms.
-    generic: bool,
-}
-
-#[allow(non_upper_case_globals)]
-const AbiDatas: &'static [AbiData] = &[
-    // Platform-specific ABIs
-    AbiData {abi: Abi::Cdecl, name: "cdecl", generic: false },
-    AbiData {abi: Abi::Stdcall, name: "stdcall", generic: false },
-    AbiData {abi: Abi::Fastcall, name: "fastcall", generic: false },
-    AbiData {abi: Abi::Vectorcall, name: "vectorcall", generic: false},
-    AbiData {abi: Abi::Thiscall, name: "thiscall", generic: false},
-    AbiData {abi: Abi::Aapcs, name: "aapcs", generic: false },
-    AbiData {abi: Abi::Win64, name: "win64", generic: false },
-    AbiData {abi: Abi::SysV64, name: "sysv64", generic: false },
-    AbiData {abi: Abi::PtxKernel, name: "ptx-kernel", generic: false },
-    AbiData {abi: Abi::Msp430Interrupt, name: "msp430-interrupt", generic: false },
-    AbiData {abi: Abi::X86Interrupt, name: "x86-interrupt", generic: false },
-
-    // Cross-platform ABIs
-    AbiData {abi: Abi::Rust, name: "Rust", generic: true },
-    AbiData {abi: Abi::C, name: "C", generic: true },
-    AbiData {abi: Abi::System, name: "system", generic: true },
-    AbiData {abi: Abi::RustIntrinsic, name: "rust-intrinsic", generic: true },
-    AbiData {abi: Abi::RustCall, name: "rust-call", generic: true },
-    AbiData {abi: Abi::PlatformIntrinsic, name: "platform-intrinsic", generic: true },
-    AbiData {abi: Abi::Unadjusted, name: "unadjusted", generic: true },
-];
-
-/// Returns the ABI with the given name (if any).
-pub fn lookup(name: &str) -> Option<Abi> {
-    AbiDatas.iter().find(|abi_data| name == abi_data.name).map(|&x| x.abi)
-}
-
-pub fn all_names() -> Vec<&'static str> {
-    AbiDatas.iter().map(|d| d.name).collect()
-}
-
-impl Abi {
-    #[inline]
-    pub fn index(&self) -> usize {
-        *self as usize
-    }
-
-    #[inline]
-    pub fn data(&self) -> &'static AbiData {
-        &AbiDatas[self.index()]
-    }
-
-    pub fn name(&self) -> &'static str {
-        self.data().name
-    }
-
-    pub fn generic(&self) -> bool {
-        self.data().generic
-    }
-}
-
-impl fmt::Display for Abi {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "\"{}\"", self.name())
-    }
-}
-
-#[allow(non_snake_case)]
-#[test]
-fn lookup_Rust() {
-    let abi = lookup("Rust");
-    assert!(abi.is_some() && abi.unwrap().data().name == "Rust");
-}
-
-#[test]
-fn lookup_cdecl() {
-    let abi = lookup("cdecl");
-    assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
-}
-
-#[test]
-fn lookup_baz() {
-    let abi = lookup("baz");
-    assert!(abi.is_none());
-}
-
-#[test]
-fn indices_are_correct() {
-    for (i, abi_data) in AbiDatas.iter().enumerate() {
-        assert_eq!(i, abi_data.abi.index());
-    }
-}
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 4e3ee241468..cbfcad12f1e 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -19,7 +19,7 @@ pub use util::parser::ExprPrecedence;
 
 use syntax_pos::{Span, DUMMY_SP};
 use codemap::{respan, Spanned};
-use abi::Abi;
+use rustc_target::spec::abi::Abi;
 use ext::hygiene::{Mark, SyntaxContext};
 use print::pprust;
 use ptr::P;
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index a9f48342243..0b64189b2bc 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use abi::Abi;
+use rustc_target::spec::abi::Abi;
 use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp, PatKind};
 use attr;
 use syntax_pos::{Pos, Span, DUMMY_SP};
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 39ddb13d347..0331e90164f 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -25,7 +25,7 @@
 use self::AttributeType::*;
 use self::AttributeGate::*;
 
-use abi::Abi;
+use rustc_target::spec::abi::Abi;
 use ast::{self, NodeId, PatKind, RangeEnd};
 use attr;
 use edition::{ALL_EDITIONS, Edition};
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index ad98e2a6b71..870ce1926ad 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -28,10 +28,6 @@
 
 #![recursion_limit="256"]
 
-// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
-#[allow(unused_extern_crates)]
-extern crate rustc_cratesio_shim;
-
 #[macro_use] extern crate bitflags;
 extern crate core;
 extern crate serialize;
@@ -39,6 +35,7 @@ extern crate serialize;
 pub extern crate rustc_errors as errors;
 extern crate syntax_pos;
 extern crate rustc_data_structures;
+extern crate rustc_target;
 #[macro_use] extern crate scoped_tls;
 
 extern crate serialize as rustc_serialize; // used by deriving
@@ -138,7 +135,6 @@ pub mod syntax {
     pub use ast;
 }
 
-pub mod abi;
 pub mod ast;
 pub mod attr;
 pub mod codemap;
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 0397c3297db..ff09c6aa2f0 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -678,7 +678,7 @@ mod tests {
     use syntax_pos::{self, Span, BytePos, Pos, NO_EXPANSION};
     use codemap::{respan, Spanned};
     use ast::{self, Ident, PatKind};
-    use abi::Abi;
+    use rustc_target::spec::abi::Abi;
     use attr::first_attr_value_str_by_name;
     use parse;
     use parse::parser::Parser;
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 9fa3952ca80..324cadc84e8 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use abi::{self, Abi};
+use rustc_target::spec::abi::{self, Abi};
 use ast::{AngleBracketedParameterData, ParenthesizedParameterData, AttrStyle, BareFnTy};
 use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
 use ast::Unsafety;
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index bd06ae8c1a9..88860df10e2 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -10,7 +10,7 @@
 
 pub use self::AnnNode::*;
 
-use abi::{self, Abi};
+use rustc_target::spec::abi::{self, Abi};
 use ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax};
 use ast::{SelfKind, RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
 use ast::Attribute;
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 325927ed832..e2a9f8715e2 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -563,7 +563,7 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
     let main = ast::ItemKind::Fn(ecx.fn_decl(vec![], ast::FunctionRetTy::Ty(main_ret_ty)),
                            ast::Unsafety::Normal,
                            dummy_spanned(ast::Constness::NotConst),
-                           ::abi::Abi::Rust, ast::Generics::default(), main_body);
+                           ::rustc_target::spec::abi::Abi::Rust, ast::Generics::default(), main_body);
     P(ast::Item {
         ident: Ident::from_str("main"),
         attrs: vec![main_attr],
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 8743840e443..40d59d3ff8b 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -23,7 +23,7 @@
 //! instance, a walker looking for item names in a module will miss all of
 //! those that are created by the expansion of a macro.
 
-use abi::Abi;
+use rustc_target::spec::abi::Abi;
 use ast::*;
 use syntax_pos::Span;
 use codemap::Spanned;