[breaking-change] don't glob import/export syntax::abi enum variants
This commit is contained in:
@@ -8,27 +8,23 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub use self::Os::*;
|
||||
pub use self::Abi::*;
|
||||
pub use self::Architecture::*;
|
||||
pub use self::AbiArchitecture::*;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum Os {
|
||||
OsWindows,
|
||||
OsMacos,
|
||||
OsLinux,
|
||||
OsAndroid,
|
||||
OsFreebsd,
|
||||
OsiOS,
|
||||
OsDragonfly,
|
||||
OsBitrig,
|
||||
OsNetbsd,
|
||||
OsOpenbsd,
|
||||
OsNaCl,
|
||||
OsSolaris,
|
||||
Windows,
|
||||
Macos,
|
||||
Linux,
|
||||
Android,
|
||||
Freebsd,
|
||||
iOS,
|
||||
Dragonfly,
|
||||
Bitrig,
|
||||
Netbsd,
|
||||
Openbsd,
|
||||
NaCl,
|
||||
Solaris,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)]
|
||||
@@ -74,9 +70,9 @@ pub struct AbiData {
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum AbiArchitecture {
|
||||
/// Not a real ABI (e.g., intrinsic)
|
||||
RustArch,
|
||||
Rust,
|
||||
/// An ABI that specifies cross-platform defaults (e.g., "C")
|
||||
AllArch,
|
||||
All,
|
||||
/// Multiple architectures (bitset)
|
||||
Archs(u32)
|
||||
}
|
||||
@@ -84,23 +80,23 @@ pub enum AbiArchitecture {
|
||||
#[allow(non_upper_case_globals)]
|
||||
const AbiDatas: &'static [AbiData] = &[
|
||||
// Platform-specific ABIs
|
||||
AbiData {abi: Cdecl, name: "cdecl" },
|
||||
AbiData {abi: Stdcall, name: "stdcall" },
|
||||
AbiData {abi: Fastcall, name: "fastcall" },
|
||||
AbiData {abi: Vectorcall, name: "vectorcall"},
|
||||
AbiData {abi: Aapcs, name: "aapcs" },
|
||||
AbiData {abi: Win64, name: "win64" },
|
||||
AbiData {abi: Abi::Cdecl, name: "cdecl" },
|
||||
AbiData {abi: Abi::Stdcall, name: "stdcall" },
|
||||
AbiData {abi: Abi::Fastcall, name: "fastcall" },
|
||||
AbiData {abi: Abi::Vectorcall, name: "vectorcall"},
|
||||
AbiData {abi: Abi::Aapcs, name: "aapcs" },
|
||||
AbiData {abi: Abi::Win64, name: "win64" },
|
||||
|
||||
// Cross-platform ABIs
|
||||
//
|
||||
// NB: Do not adjust this ordering without
|
||||
// adjusting the indices below.
|
||||
AbiData {abi: Rust, name: "Rust" },
|
||||
AbiData {abi: C, name: "C" },
|
||||
AbiData {abi: System, name: "system" },
|
||||
AbiData {abi: RustIntrinsic, name: "rust-intrinsic" },
|
||||
AbiData {abi: RustCall, name: "rust-call" },
|
||||
AbiData {abi: PlatformIntrinsic, name: "platform-intrinsic" }
|
||||
AbiData {abi: Abi::Rust, name: "Rust" },
|
||||
AbiData {abi: Abi::C, name: "C" },
|
||||
AbiData {abi: Abi::System, name: "system" },
|
||||
AbiData {abi: Abi::RustIntrinsic, name: "rust-intrinsic" },
|
||||
AbiData {abi: Abi::RustCall, name: "rust-call" },
|
||||
AbiData {abi: Abi::PlatformIntrinsic, name: "platform-intrinsic" }
|
||||
];
|
||||
|
||||
/// Returns the ABI with the given name (if any).
|
||||
@@ -137,18 +133,18 @@ impl fmt::Display for Abi {
|
||||
impl fmt::Display for Os {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
OsLinux => "linux".fmt(f),
|
||||
OsWindows => "windows".fmt(f),
|
||||
OsMacos => "macos".fmt(f),
|
||||
OsiOS => "ios".fmt(f),
|
||||
OsAndroid => "android".fmt(f),
|
||||
OsFreebsd => "freebsd".fmt(f),
|
||||
OsDragonfly => "dragonfly".fmt(f),
|
||||
OsBitrig => "bitrig".fmt(f),
|
||||
OsNetbsd => "netbsd".fmt(f),
|
||||
OsOpenbsd => "openbsd".fmt(f),
|
||||
OsNaCl => "nacl".fmt(f),
|
||||
OsSolaris => "solaris".fmt(f),
|
||||
Os::Linux => "linux".fmt(f),
|
||||
Os::Windows => "windows".fmt(f),
|
||||
Os::Macos => "macos".fmt(f),
|
||||
Os::iOS => "ios".fmt(f),
|
||||
Os::Android => "android".fmt(f),
|
||||
Os::Freebsd => "freebsd".fmt(f),
|
||||
Os::Dragonfly => "dragonfly".fmt(f),
|
||||
Os::Bitrig => "bitrig".fmt(f),
|
||||
Os::Netbsd => "netbsd".fmt(f),
|
||||
Os::Openbsd => "openbsd".fmt(f),
|
||||
Os::NaCl => "nacl".fmt(f),
|
||||
Os::Solaris => "solaris".fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use abi;
|
||||
use abi::Abi;
|
||||
use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp};
|
||||
use attr;
|
||||
use codemap::{Span, respan, Spanned, DUMMY_SP, Pos};
|
||||
@@ -971,7 +971,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
ast::ItemFn(self.fn_decl(inputs, output),
|
||||
ast::Unsafety::Normal,
|
||||
ast::Constness::NotConst,
|
||||
abi::Rust,
|
||||
Abi::Rust,
|
||||
generics,
|
||||
body))
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ mod tests {
|
||||
use std::rc::Rc;
|
||||
use codemap::{Span, BytePos, Pos, Spanned, NO_EXPANSION};
|
||||
use ast::{self, TokenTree};
|
||||
use abi;
|
||||
use abi::Abi;
|
||||
use attr::{first_attr_value_str_by_name, AttrMetaMethods};
|
||||
use parse;
|
||||
use parse::parser::Parser;
|
||||
@@ -955,7 +955,7 @@ mod tests {
|
||||
}),
|
||||
ast::Unsafety::Normal,
|
||||
ast::Constness::NotConst,
|
||||
abi::Rust,
|
||||
Abi::Rust,
|
||||
ast::Generics{ // no idea on either of these:
|
||||
lifetimes: Vec::new(),
|
||||
ty_params: P::empty(),
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
pub use self::PathParsingMode::*;
|
||||
|
||||
use abi;
|
||||
use abi::{self, Abi};
|
||||
use ast::BareFnTy;
|
||||
use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
|
||||
use ast::{Public, Unsafety};
|
||||
@@ -1127,9 +1127,9 @@ impl<'a> Parser<'a> {
|
||||
|
||||
let unsafety = try!(self.parse_unsafety());
|
||||
let abi = if self.eat_keyword(keywords::Extern) {
|
||||
try!(self.parse_opt_abi()).unwrap_or(abi::C)
|
||||
try!(self.parse_opt_abi()).unwrap_or(Abi::C)
|
||||
} else {
|
||||
abi::Rust
|
||||
Abi::Rust
|
||||
};
|
||||
|
||||
try!(self.expect_keyword(keywords::Fn));
|
||||
@@ -4647,12 +4647,12 @@ impl<'a> Parser<'a> {
|
||||
let is_const_fn = self.eat_keyword(keywords::Const);
|
||||
let unsafety = try!(self.parse_unsafety());
|
||||
let (constness, unsafety, abi) = if is_const_fn {
|
||||
(Constness::Const, unsafety, abi::Rust)
|
||||
(Constness::Const, unsafety, Abi::Rust)
|
||||
} else {
|
||||
let abi = if self.eat_keyword(keywords::Extern) {
|
||||
try!(self.parse_opt_abi()).unwrap_or(abi::C)
|
||||
try!(self.parse_opt_abi()).unwrap_or(Abi::C)
|
||||
} else {
|
||||
abi::Rust
|
||||
Abi::Rust
|
||||
};
|
||||
(Constness::NotConst, unsafety, abi)
|
||||
};
|
||||
@@ -5350,7 +5350,7 @@ impl<'a> Parser<'a> {
|
||||
-> PResult<'a, P<Item>> {
|
||||
try!(self.expect(&token::OpenDelim(token::Brace)));
|
||||
|
||||
let abi = opt_abi.unwrap_or(abi::C);
|
||||
let abi = opt_abi.unwrap_or(Abi::C);
|
||||
|
||||
attrs.extend(try!(self.parse_inner_attributes()));
|
||||
|
||||
@@ -5522,7 +5522,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
if self.eat_keyword(keywords::Fn) {
|
||||
// EXTERN FUNCTION ITEM
|
||||
let abi = opt_abi.unwrap_or(abi::C);
|
||||
let abi = opt_abi.unwrap_or(Abi::C);
|
||||
let (ident, item_, extra_attrs) =
|
||||
try!(self.parse_item_fn(Unsafety::Normal, Constness::NotConst, abi));
|
||||
let last_span = self.last_span;
|
||||
@@ -5565,7 +5565,7 @@ impl<'a> Parser<'a> {
|
||||
};
|
||||
self.bump();
|
||||
let (ident, item_, extra_attrs) =
|
||||
try!(self.parse_item_fn(unsafety, Constness::Const, abi::Rust));
|
||||
try!(self.parse_item_fn(unsafety, Constness::Const, Abi::Rust));
|
||||
let last_span = self.last_span;
|
||||
let item = self.mk_item(lo,
|
||||
last_span.hi,
|
||||
@@ -5630,7 +5630,7 @@ impl<'a> Parser<'a> {
|
||||
// FUNCTION ITEM
|
||||
self.bump();
|
||||
let (ident, item_, extra_attrs) =
|
||||
try!(self.parse_item_fn(Unsafety::Normal, Constness::NotConst, abi::Rust));
|
||||
try!(self.parse_item_fn(Unsafety::Normal, Constness::NotConst, Abi::Rust));
|
||||
let last_span = self.last_span;
|
||||
let item = self.mk_item(lo,
|
||||
last_span.hi,
|
||||
@@ -5645,9 +5645,9 @@ impl<'a> Parser<'a> {
|
||||
// UNSAFE FUNCTION ITEM
|
||||
self.bump();
|
||||
let abi = if self.eat_keyword(keywords::Extern) {
|
||||
try!(self.parse_opt_abi()).unwrap_or(abi::C)
|
||||
try!(self.parse_opt_abi()).unwrap_or(Abi::C)
|
||||
} else {
|
||||
abi::Rust
|
||||
Abi::Rust
|
||||
};
|
||||
try!(self.expect_keyword(keywords::Fn));
|
||||
let (ident, item_, extra_attrs) =
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
pub use self::AnnNode::*;
|
||||
|
||||
use abi;
|
||||
use abi::{self, Abi};
|
||||
use ast::{self, TokenTree, BlockCheckMode};
|
||||
use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
|
||||
use ast::Attribute;
|
||||
@@ -387,7 +387,7 @@ pub fn fun_to_string(decl: &ast::FnDecl,
|
||||
-> String {
|
||||
to_string(|s| {
|
||||
try!(s.head(""));
|
||||
try!(s.print_fn(decl, unsafety, constness, abi::Rust, Some(name),
|
||||
try!(s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name),
|
||||
generics, opt_explicit_self, ast::Inherited));
|
||||
try!(s.end()); // Close the head box
|
||||
s.end() // Close the outer box
|
||||
@@ -1058,7 +1058,7 @@ impl<'a> State<'a> {
|
||||
try!(self.head(""));
|
||||
try!(self.print_fn(decl, ast::Unsafety::Normal,
|
||||
ast::Constness::NotConst,
|
||||
abi::Rust, Some(item.ident),
|
||||
Abi::Rust, Some(item.ident),
|
||||
generics, None, item.vis));
|
||||
try!(self.end()); // end head-ibox
|
||||
try!(word(&mut self.s, ";"));
|
||||
@@ -3086,10 +3086,10 @@ impl<'a> State<'a> {
|
||||
}
|
||||
|
||||
pub fn print_opt_abi_and_extern_if_nondefault(&mut self,
|
||||
opt_abi: Option<abi::Abi>)
|
||||
opt_abi: Option<Abi>)
|
||||
-> io::Result<()> {
|
||||
match opt_abi {
|
||||
Some(abi::Rust) => Ok(()),
|
||||
Some(Abi::Rust) => Ok(()),
|
||||
Some(abi) => {
|
||||
try!(self.word_nbsp("extern"));
|
||||
self.word_nbsp(&abi.to_string())
|
||||
@@ -3099,7 +3099,7 @@ impl<'a> State<'a> {
|
||||
}
|
||||
|
||||
pub fn print_extern_opt_abi(&mut self,
|
||||
opt_abi: Option<abi::Abi>) -> io::Result<()> {
|
||||
opt_abi: Option<Abi>) -> io::Result<()> {
|
||||
match opt_abi {
|
||||
Some(abi) => {
|
||||
try!(self.word_nbsp("extern"));
|
||||
@@ -3112,7 +3112,7 @@ impl<'a> State<'a> {
|
||||
pub fn print_fn_header_info(&mut self,
|
||||
unsafety: ast::Unsafety,
|
||||
constness: ast::Constness,
|
||||
abi: abi::Abi,
|
||||
abi: Abi,
|
||||
vis: ast::Visibility) -> io::Result<()> {
|
||||
try!(word(&mut self.s, &visibility_qualified(vis, "")));
|
||||
|
||||
@@ -3123,7 +3123,7 @@ impl<'a> State<'a> {
|
||||
|
||||
try!(self.print_unsafety(unsafety));
|
||||
|
||||
if abi != abi::Rust {
|
||||
if abi != Abi::Rust {
|
||||
try!(self.word_nbsp("extern"));
|
||||
try!(self.word_nbsp(&abi.to_string()));
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
|
||||
let main = ast::ItemFn(ecx.fn_decl(vec![], main_ret_ty),
|
||||
ast::Unsafety::Normal,
|
||||
ast::Constness::NotConst,
|
||||
::abi::Rust, ast::Generics::default(), main_body);
|
||||
::abi::Abi::Rust, ast::Generics::default(), main_body);
|
||||
let main = P(ast::Item {
|
||||
ident: token::str_to_ident("main"),
|
||||
attrs: vec![main_attr],
|
||||
|
||||
Reference in New Issue
Block a user