[breaking-change] don't glob import/export syntax::abi enum variants
This commit is contained in:
parent
47b0784ba8
commit
243a30c931
|
@ -20,7 +20,7 @@ use middle::cstore::InlinedItem;
|
|||
use middle::cstore::InlinedItem as II;
|
||||
use middle::def_id::DefId;
|
||||
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast::{self, Name, NodeId, DUMMY_NODE_ID};
|
||||
use syntax::codemap::{Span, Spanned};
|
||||
use syntax::parse::token;
|
||||
|
@ -512,7 +512,7 @@ impl<'ast> Map<'ast> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_foreign_abi(&self, id: NodeId) -> abi::Abi {
|
||||
pub fn get_foreign_abi(&self, id: NodeId) -> Abi {
|
||||
let parent = self.get_parent(id);
|
||||
let abi = match self.find_entry(parent) {
|
||||
Some(EntryItem(_, i)) => {
|
||||
|
@ -522,7 +522,7 @@ impl<'ast> Map<'ast> {
|
|||
}
|
||||
}
|
||||
/// Wrong but OK, because the only inlined foreign items are intrinsics.
|
||||
Some(RootInlinedParent(_)) => Some(abi::RustIntrinsic),
|
||||
Some(RootInlinedParent(_)) => Some(Abi::RustIntrinsic),
|
||||
_ => None
|
||||
};
|
||||
match abi {
|
||||
|
|
|
@ -17,7 +17,7 @@ use middle::ty::{self, Ty, TypeFoldable};
|
|||
|
||||
use std::fmt;
|
||||
|
||||
use syntax::abi::RustIntrinsic;
|
||||
use syntax::abi::Abi::RustIntrinsic;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use rustc_front::intravisit::{self, Visitor, FnKind};
|
||||
|
|
|
@ -25,7 +25,7 @@ use session::config;
|
|||
use util::nodemap::NodeSet;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use rustc_front::hir;
|
||||
|
@ -236,7 +236,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
|||
// participate in linkage after this product is produced)
|
||||
if let ast_map::NodeItem(item) = *node {
|
||||
if let hir::ItemFn(_, _, _, abi, _, _) = item.node {
|
||||
if abi != abi::Rust {
|
||||
if abi != Abi::Rust {
|
||||
self.reachable_symbols.insert(search_item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ use middle::ty::relate::TypeRelation;
|
|||
use std::cell::RefCell;
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use rustc_front::hir;
|
||||
use util::common::ErrorReported;
|
||||
use util::nodemap::FnvHashMap;
|
||||
|
@ -1288,7 +1288,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// provide an impl, but only for suitable `fn` pointers
|
||||
ty::TyBareFn(_, &ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: _,
|
||||
output: ty::FnConverging(_),
|
||||
|
|
|
@ -44,7 +44,7 @@ use std::borrow::Borrow;
|
|||
use std::cell::{Cell, RefCell, Ref};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::rc::Rc;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast::{self, Name, NodeId};
|
||||
use syntax::attr;
|
||||
use syntax::parse::token::special_idents;
|
||||
|
@ -943,7 +943,7 @@ impl<'tcx> ctxt<'tcx> {
|
|||
let input_args = input_tys.iter().cloned().collect();
|
||||
self.mk_fn(Some(def_id), self.mk_bare_fn(BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: input_args,
|
||||
output: ty::FnConverging(output),
|
||||
|
|
|
@ -20,7 +20,7 @@ use middle::ty::{TyBox, TyTrait, TyInt, TyUint, TyInfer};
|
|||
use middle::ty::{self, Ty, TypeFoldable};
|
||||
|
||||
use std::fmt;
|
||||
use syntax::{abi};
|
||||
use syntax::abi::Abi;
|
||||
use syntax::parse::token;
|
||||
use syntax::ast::CRATE_NODE_ID;
|
||||
use rustc_front::hir;
|
||||
|
@ -814,7 +814,7 @@ impl<'tcx> fmt::Display for ty::TypeVariants<'tcx> {
|
|||
try!(write!(f, "unsafe "));
|
||||
}
|
||||
|
||||
if bare_fn.abi != abi::Rust {
|
||||
if bare_fn.abi != Abi::Rust {
|
||||
try!(write!(f, "extern {} ", bare_fn.abi));
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
use serialize::json::Json;
|
||||
use std::default::Default;
|
||||
use std::io::prelude::*;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
|
||||
mod android_base;
|
||||
mod apple_base;
|
||||
|
@ -262,13 +262,13 @@ impl Default for TargetOptions {
|
|||
|
||||
impl Target {
|
||||
/// Given a function ABI, turn "System" into the correct ABI for this target.
|
||||
pub fn adjust_abi(&self, abi: abi::Abi) -> abi::Abi {
|
||||
pub fn adjust_abi(&self, abi: Abi) -> Abi {
|
||||
match abi {
|
||||
abi::System => {
|
||||
Abi::System => {
|
||||
if self.options.is_like_windows && self.arch == "x86" {
|
||||
abi::Stdcall
|
||||
Abi::Stdcall
|
||||
} else {
|
||||
abi::C
|
||||
Abi::C
|
||||
}
|
||||
},
|
||||
abi => abi
|
||||
|
|
|
@ -32,7 +32,8 @@ use rustc_metadata::cstore::CStore;
|
|||
use rustc::front::map as hir_map;
|
||||
use rustc::session::{self, config};
|
||||
use std::rc::Rc;
|
||||
use syntax::{abi, ast};
|
||||
use syntax::ast;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::codemap::{MultiSpan, CodeMap, DUMMY_SP};
|
||||
use syntax::errors;
|
||||
use syntax::errors::emitter::Emitter;
|
||||
|
@ -263,7 +264,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
|
|||
self.infcx.tcx.mk_fn(None,
|
||||
self.infcx.tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: input_args,
|
||||
output: ty::FnConverging(output_ty),
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
pub use self::AnnNode::*;
|
||||
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::{self, CodeMap, BytePos, Spanned};
|
||||
use syntax::errors;
|
||||
|
@ -290,7 +290,7 @@ pub fn fun_to_string(decl: &hir::FnDecl,
|
|||
try!(s.print_fn(decl,
|
||||
unsafety,
|
||||
constness,
|
||||
abi::Rust,
|
||||
Abi::Rust,
|
||||
Some(name),
|
||||
generics,
|
||||
opt_explicit_self,
|
||||
|
@ -569,7 +569,7 @@ impl<'a> State<'a> {
|
|||
try!(self.print_fn(decl,
|
||||
hir::Unsafety::Normal,
|
||||
hir::Constness::NotConst,
|
||||
abi::Rust,
|
||||
Abi::Rust,
|
||||
Some(item.name),
|
||||
generics,
|
||||
None,
|
||||
|
@ -1916,7 +1916,7 @@ impl<'a> State<'a> {
|
|||
decl: &hir::FnDecl,
|
||||
unsafety: hir::Unsafety,
|
||||
constness: hir::Constness,
|
||||
abi: abi::Abi,
|
||||
abi: Abi,
|
||||
name: Option<ast::Name>,
|
||||
generics: &hir::Generics,
|
||||
opt_explicit_self: Option<&hir::ExplicitSelf_>,
|
||||
|
@ -2250,7 +2250,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
|
||||
pub fn print_ty_fn(&mut self,
|
||||
abi: abi::Abi,
|
||||
abi: Abi,
|
||||
unsafety: hir::Unsafety,
|
||||
decl: &hir::FnDecl,
|
||||
name: Option<ast::Name>,
|
||||
|
@ -2331,10 +2331,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())
|
||||
|
@ -2343,7 +2343,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn print_extern_opt_abi(&mut self, opt_abi: Option<abi::Abi>) -> io::Result<()> {
|
||||
pub fn print_extern_opt_abi(&mut self, opt_abi: Option<Abi>) -> io::Result<()> {
|
||||
match opt_abi {
|
||||
Some(abi) => {
|
||||
try!(self.word_nbsp("extern"));
|
||||
|
@ -2356,7 +2356,7 @@ impl<'a> State<'a> {
|
|||
pub fn print_fn_header_info(&mut self,
|
||||
unsafety: hir::Unsafety,
|
||||
constness: hir::Constness,
|
||||
abi: abi::Abi,
|
||||
abi: Abi,
|
||||
vis: hir::Visibility)
|
||||
-> io::Result<()> {
|
||||
try!(word(&mut self.s, &visibility_qualified(vis, "")));
|
||||
|
@ -2367,7 +2367,7 @@ impl<'a> State<'a> {
|
|||
hir::Constness::Const => try!(self.word_nbsp("const")),
|
||||
}
|
||||
|
||||
if abi != abi::Rust {
|
||||
if abi != Abi::Rust {
|
||||
try!(self.word_nbsp("extern"));
|
||||
try!(self.word_nbsp(&abi.to_string()));
|
||||
}
|
||||
|
|
|
@ -1039,7 +1039,7 @@ impl LintPass for MutableTransmutes {
|
|||
|
||||
impl LateLintPass for MutableTransmutes {
|
||||
fn check_expr(&mut self, cx: &LateContext, expr: &hir::Expr) {
|
||||
use syntax::abi::RustIntrinsic;
|
||||
use syntax::abi::Abi::RustIntrinsic;
|
||||
|
||||
let msg = "mutating transmuted &mut T from &T may cause undefined behavior,\
|
||||
consider instead using an UnsafeCell";
|
||||
|
|
|
@ -23,7 +23,8 @@ use lint::{LintPass, LateLintPass};
|
|||
use std::cmp;
|
||||
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
|
||||
|
||||
use syntax::{abi, ast};
|
||||
use syntax::ast;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::attr::{self, AttrMetaMethods};
|
||||
use syntax::codemap::{self, Span};
|
||||
|
||||
|
@ -558,10 +559,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
|
||||
ty::TyBareFn(None, bare_fn) => {
|
||||
match bare_fn.abi {
|
||||
abi::Rust |
|
||||
abi::RustIntrinsic |
|
||||
abi::PlatformIntrinsic |
|
||||
abi::RustCall => {
|
||||
Abi::Rust |
|
||||
Abi::RustIntrinsic |
|
||||
Abi::PlatformIntrinsic |
|
||||
Abi::RustCall => {
|
||||
return FfiUnsafe(
|
||||
"found function pointer with Rust calling \
|
||||
convention in foreign module; consider using an \
|
||||
|
@ -677,7 +678,7 @@ impl LateLintPass for ImproperCTypes {
|
|||
}
|
||||
|
||||
if let hir::ItemForeignMod(ref nmod) = it.node {
|
||||
if nmod.abi != abi::RustIntrinsic && nmod.abi != abi::PlatformIntrinsic {
|
||||
if nmod.abi != Abi::RustIntrinsic && nmod.abi != Abi::PlatformIntrinsic {
|
||||
for ni in &nmod.items {
|
||||
match ni.node {
|
||||
hir::ForeignItemFn(ref decl, _) => check_foreign_fn(cx, &**decl),
|
||||
|
|
|
@ -31,7 +31,7 @@ use std::rc::Rc;
|
|||
use std::fs;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::codemap::{self, Span, mk_sp, Pos};
|
||||
use syntax::parse;
|
||||
use syntax::attr;
|
||||
|
@ -784,7 +784,7 @@ impl<'a, 'b> LocalCrateReader<'a, 'b> {
|
|||
}
|
||||
|
||||
fn process_foreign_mod(&mut self, i: &hir::Item, fm: &hir::ForeignMod) {
|
||||
if fm.abi == abi::Rust || fm.abi == abi::RustIntrinsic || fm.abi == abi::PlatformIntrinsic {
|
||||
if fm.abi == Abi::Rust || fm.abi == Abi::RustIntrinsic || fm.abi == Abi::PlatformIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ use syntax::attr;
|
|||
use syntax::parse::token::{IdentInterner, special_idents};
|
||||
use syntax::parse::token;
|
||||
use syntax::ast;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::codemap::{self, Span, BytePos, NO_EXPANSION};
|
||||
use syntax::print::pprust;
|
||||
use syntax::ptr::P;
|
||||
|
@ -1701,7 +1701,7 @@ pub fn is_extern_fn(cdata: Cmd, id: DefIndex, tcx: &ty::ctxt) -> bool {
|
|||
if let Fn = item_family(item_doc) {
|
||||
let ty::TypeScheme { generics, ty } = get_type(cdata, id, tcx);
|
||||
generics.types.is_empty() && match ty.sty {
|
||||
ty::TyBareFn(_, fn_ty) => fn_ty.abi != abi::Rust,
|
||||
ty::TyBareFn(_, fn_ty) => fn_ty.abi != Abi::Rust,
|
||||
_ => false,
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ use std::io::prelude::*;
|
|||
use std::io::{Cursor, SeekFrom};
|
||||
use std::rc::Rc;
|
||||
use std::u32;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast::{self, NodeId, Name, CRATE_NODE_ID, CrateNum};
|
||||
use syntax::codemap::BytePos;
|
||||
use syntax::attr;
|
||||
|
@ -1381,7 +1381,7 @@ fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
|||
nitem: &hir::ForeignItem,
|
||||
index: &mut CrateIndex<'tcx>,
|
||||
path: PathElems,
|
||||
abi: abi::Abi) {
|
||||
abi: Abi) {
|
||||
let def_id = ecx.tcx.map.local_def_id(nitem.id);
|
||||
|
||||
index.record(def_id, rbml_w);
|
||||
|
@ -1393,7 +1393,7 @@ fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
|||
encode_family(rbml_w, FN_FAMILY);
|
||||
encode_bounds_and_type_for_item(rbml_w, ecx, index, nitem.id);
|
||||
encode_name(rbml_w, nitem.name);
|
||||
if abi == abi::RustIntrinsic || abi == abi::PlatformIntrinsic {
|
||||
if abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic {
|
||||
encode_inlined_item(ecx, rbml_w, InlinedItemRef::Foreign(nitem));
|
||||
}
|
||||
encode_attributes(rbml_w, &*nitem.attrs);
|
||||
|
|
|
@ -14,7 +14,7 @@ use llvm::{self, ValueRef, AttrHelper};
|
|||
use middle::ty;
|
||||
use middle::infer;
|
||||
use session::config::NoDebugInfo;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
pub use syntax::attr::InlineAttr;
|
||||
use syntax::ast;
|
||||
use rustc_front::hir;
|
||||
|
@ -136,7 +136,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
let infcx = infer::normalizing_infer_ctxt(ccx.tcx(), &ccx.tcx().tables);
|
||||
function_type = infcx.closure_type(closure_did, substs);
|
||||
let self_type = base::self_type_for_closure(ccx, closure_did, fn_type);
|
||||
(&function_type.sig, abi::RustCall, Some(self_type))
|
||||
(&function_type.sig, Abi::RustCall, Some(self_type))
|
||||
}
|
||||
_ => ccx.sess().bug("expected closure or function.")
|
||||
};
|
||||
|
@ -151,7 +151,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
// unpack the input ty's
|
||||
let input_tys = match fn_type.sty {
|
||||
ty::TyClosure(..) => {
|
||||
assert!(abi == abi::RustCall);
|
||||
assert!(abi == Abi::RustCall);
|
||||
|
||||
match fn_sig.inputs[0].sty {
|
||||
ty::TyTuple(ref inputs) => {
|
||||
|
@ -162,7 +162,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
_ => ccx.sess().bug("expected tuple'd inputs")
|
||||
}
|
||||
},
|
||||
ty::TyBareFn(..) if abi == abi::RustCall => {
|
||||
ty::TyBareFn(..) if abi == Abi::RustCall => {
|
||||
let mut inputs = vec![fn_sig.inputs[0]];
|
||||
|
||||
match fn_sig.inputs[1].sty {
|
||||
|
|
|
@ -100,7 +100,7 @@ use std::cell::{Cell, RefCell};
|
|||
use std::collections::{HashMap, HashSet};
|
||||
use std::str;
|
||||
use std::{i8, i16, i32, i64};
|
||||
use syntax::abi::{Rust, RustCall, RustIntrinsic, PlatformIntrinsic, Abi};
|
||||
use syntax::abi::Abi;
|
||||
use syntax::codemap::{Span, DUMMY_SP};
|
||||
use syntax::parse::token::InternedString;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
|
@ -911,10 +911,10 @@ pub fn trans_external_path<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
match t.sty {
|
||||
ty::TyBareFn(_, ref fn_ty) => {
|
||||
match ccx.sess().target.target.adjust_abi(fn_ty.abi) {
|
||||
Rust | RustCall => {
|
||||
Abi::Rust | Abi::RustCall => {
|
||||
get_extern_rust_fn(ccx, t, &name[..], did)
|
||||
}
|
||||
RustIntrinsic | PlatformIntrinsic => {
|
||||
Abi::RustIntrinsic | Abi::PlatformIntrinsic => {
|
||||
ccx.sess().bug("unexpected intrinsic in trans_external_path")
|
||||
}
|
||||
_ => {
|
||||
|
@ -2031,7 +2031,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
bcx.fcx.ccx.tn().val_to_string(bcx.fcx.llfn));
|
||||
|
||||
let has_tupled_arg = match closure_env {
|
||||
closure::ClosureEnv::NotClosure => abi == RustCall,
|
||||
closure::ClosureEnv::NotClosure => abi == Abi::RustCall,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
|
@ -2503,7 +2503,7 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
|
|||
for (ref ccx, is_origin) in ccx.maybe_iter(!from_external && trans_everywhere) {
|
||||
let llfn = get_item_val(ccx, item.id);
|
||||
let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
|
||||
if abi != Rust {
|
||||
if abi != Abi::Rust {
|
||||
foreign::trans_rust_fn_with_foreign_abi(ccx,
|
||||
&**decl,
|
||||
&**body,
|
||||
|
@ -2607,12 +2607,12 @@ fn register_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
node_type: Ty<'tcx>)
|
||||
-> ValueRef {
|
||||
if let ty::TyBareFn(_, ref f) = node_type.sty {
|
||||
if f.abi != Rust && f.abi != RustCall {
|
||||
if f.abi != Abi::Rust && f.abi != Abi::RustCall {
|
||||
ccx.sess().span_bug(sp,
|
||||
&format!("only the `{}` or `{}` calling conventions are valid \
|
||||
for this function; `{}` was specified",
|
||||
Rust.name(),
|
||||
RustCall.name(),
|
||||
Abi::Rust.name(),
|
||||
Abi::RustCall.name(),
|
||||
f.abi.name()));
|
||||
}
|
||||
} else {
|
||||
|
@ -2790,7 +2790,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
|
|||
|
||||
hir::ItemFn(_, _, _, abi, _, _) => {
|
||||
let sym = sym();
|
||||
let llfn = if abi == Rust {
|
||||
let llfn = if abi == Abi::Rust {
|
||||
register_fn(ccx, i.span, sym, i.id, ty)
|
||||
} else {
|
||||
foreign::register_rust_fn_with_foreign_abi(ccx, i.span, sym, i.id)
|
||||
|
@ -2913,7 +2913,7 @@ fn register_method(ccx: &CrateContext,
|
|||
let sym = exported_name(ccx, id, mty, &attrs);
|
||||
|
||||
if let ty::TyBareFn(_, ref f) = mty.sty {
|
||||
let llfn = if f.abi == Rust || f.abi == RustCall {
|
||||
let llfn = if f.abi == Abi::Rust || f.abi == Abi::RustCall {
|
||||
register_fn(ccx, span, sym, id, mty)
|
||||
} else {
|
||||
foreign::register_rust_fn_with_foreign_abi(ccx, span, sym, id)
|
||||
|
|
|
@ -55,7 +55,7 @@ use middle::ty::{self, Ty, TypeFoldable};
|
|||
use middle::ty::MethodCall;
|
||||
use rustc_front::hir;
|
||||
|
||||
use syntax::abi as synabi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::errors;
|
||||
use syntax::ptr::P;
|
||||
|
@ -157,8 +157,8 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &hir::Expr)
|
|||
}
|
||||
}
|
||||
Def::Fn(did) if match expr_ty.sty {
|
||||
ty::TyBareFn(_, ref f) => f.abi == synabi::RustIntrinsic ||
|
||||
f.abi == synabi::PlatformIntrinsic,
|
||||
ty::TyBareFn(_, ref f) => f.abi == Abi::RustIntrinsic ||
|
||||
f.abi == Abi::PlatformIntrinsic,
|
||||
_ => false
|
||||
} => {
|
||||
let substs = common::node_id_substs(bcx.ccx(),
|
||||
|
@ -294,7 +294,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
|
|||
match bare_fn_ty.sty {
|
||||
ty::TyBareFn(opt_def_id,
|
||||
&ty::BareFnTy { unsafety: hir::Unsafety::Normal,
|
||||
abi: synabi::Rust,
|
||||
abi: Abi::Rust,
|
||||
ref sig }) => {
|
||||
(opt_def_id, sig)
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>(
|
|||
let tuple_fn_ty = tcx.mk_fn(opt_def_id,
|
||||
tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: synabi::RustCall,
|
||||
abi: Abi::RustCall,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: vec![bare_fn_ty_maybe_ref,
|
||||
tuple_input_ty],
|
||||
|
@ -622,7 +622,7 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
|
|||
(d.llfn, Some(d.llself))
|
||||
}
|
||||
Intrinsic(node, substs) => {
|
||||
assert!(abi == synabi::RustIntrinsic || abi == synabi::PlatformIntrinsic);
|
||||
assert!(abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic);
|
||||
assert!(dest.is_some());
|
||||
|
||||
let call_info = match debug_loc {
|
||||
|
@ -652,9 +652,9 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
|
|||
|
||||
// Intrinsics should not become actual functions.
|
||||
// We trans them in place in `trans_intrinsic_call`
|
||||
assert!(abi != synabi::RustIntrinsic && abi != synabi::PlatformIntrinsic);
|
||||
assert!(abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic);
|
||||
|
||||
let is_rust_fn = abi == synabi::Rust || abi == synabi::RustCall;
|
||||
let is_rust_fn = abi == Abi::Rust || abi == Abi::RustCall;
|
||||
|
||||
// Generate a location to store the result. If the user does
|
||||
// not care about the result, just make a stack slot.
|
||||
|
@ -936,7 +936,7 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
|
|||
llargs: &mut Vec<ValueRef>,
|
||||
arg_cleanup_scope: cleanup::ScopeId,
|
||||
ignore_self: bool,
|
||||
abi: synabi::Abi)
|
||||
abi: Abi)
|
||||
-> Block<'blk, 'tcx> {
|
||||
debug!("trans_args(abi={})", abi);
|
||||
|
||||
|
@ -953,7 +953,7 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
|
|||
// to cast her view of the arguments to the caller's view.
|
||||
match args {
|
||||
ArgExprs(arg_exprs) => {
|
||||
if abi == synabi::RustCall {
|
||||
if abi == Abi::RustCall {
|
||||
// This is only used for direct calls to the `call`,
|
||||
// `call_mut` or `call_once` functions.
|
||||
return trans_args_under_call_abi(cx,
|
||||
|
|
|
@ -30,7 +30,7 @@ use trans::Disr;
|
|||
use middle::ty;
|
||||
use session::config::FullDebugInfo;
|
||||
|
||||
use syntax::abi::RustCall;
|
||||
use syntax::abi::Abi::RustCall;
|
||||
use syntax::ast;
|
||||
use syntax::attr::{ThinAttributes, ThinAttributesExt};
|
||||
|
||||
|
|
|
@ -1294,7 +1294,7 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
output.push_str("unsafe ");
|
||||
}
|
||||
|
||||
if abi != ::syntax::abi::Rust {
|
||||
if abi != ::syntax::abi::Abi::Rust {
|
||||
output.push_str("extern \"");
|
||||
output.push_str(abi.name());
|
||||
output.push_str("\" ");
|
||||
|
|
|
@ -48,7 +48,8 @@ use std::ptr;
|
|||
use std::rc::Rc;
|
||||
|
||||
use syntax::codemap::{Span, Pos};
|
||||
use syntax::{abi, ast, codemap};
|
||||
use syntax::{ast, codemap};
|
||||
use syntax::abi::Abi;
|
||||
use syntax::attr::IntType;
|
||||
use syntax::parse::token::{self, special_idents};
|
||||
|
||||
|
@ -455,7 +456,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
ty::FnDiverging => diverging_type_metadata(cx)
|
||||
});
|
||||
|
||||
let inputs = &if abi == abi::RustCall {
|
||||
let inputs = &if abi == Abi::RustCall {
|
||||
type_of::untuple_arguments(cx, &sig.inputs)
|
||||
} else {
|
||||
sig.inputs
|
||||
|
|
|
@ -106,7 +106,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
output.push_str("unsafe ");
|
||||
}
|
||||
|
||||
if abi != ::syntax::abi::Rust {
|
||||
if abi != ::syntax::abi::Abi::Rust {
|
||||
output.push_str("extern \"");
|
||||
output.push_str(abi.name());
|
||||
output.push_str("\" ");
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
use llvm::{self, ValueRef};
|
||||
use middle::ty;
|
||||
use middle::infer;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use trans::attributes;
|
||||
use trans::base;
|
||||
use trans::context::CrateContext;
|
||||
|
@ -116,7 +116,7 @@ pub fn declare_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
|
|||
let llenvironment_type = type_of::type_of_explicit_arg(ccx, self_type);
|
||||
debug!("declare_rust_fn function_type={:?} self_type={:?}",
|
||||
function_type, self_type);
|
||||
(&function_type.sig, abi::RustCall, Some(llenvironment_type))
|
||||
(&function_type.sig, Abi::RustCall, Some(llenvironment_type))
|
||||
}
|
||||
_ => ccx.sess().bug("expected closure or fn")
|
||||
};
|
||||
|
|
|
@ -34,9 +34,7 @@ use middle::subst::Substs;
|
|||
use std::cmp;
|
||||
use std::iter::once;
|
||||
use libc::c_uint;
|
||||
use syntax::abi::{Cdecl, Aapcs, C, Win64, Abi};
|
||||
use syntax::abi::{PlatformIntrinsic, RustIntrinsic, Rust, RustCall, Stdcall};
|
||||
use syntax::abi::{Fastcall, Vectorcall, System};
|
||||
use syntax::abi::Abi;
|
||||
use syntax::attr;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::parse::token::{InternedString, special_idents};
|
||||
|
@ -80,6 +78,7 @@ struct LlvmSignature {
|
|||
|
||||
pub fn llvm_calling_convention(ccx: &CrateContext,
|
||||
abi: Abi) -> CallConv {
|
||||
use syntax::abi::Abi::*;
|
||||
match ccx.sess().target.target.adjust_abi(abi) {
|
||||
RustIntrinsic => {
|
||||
// Intrinsics are emitted at the call site
|
||||
|
@ -488,7 +487,7 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &hir::ForeignMod) {
|
|||
|
||||
if let hir::ForeignItemFn(ref decl, _) = foreign_item.node {
|
||||
match foreign_mod.abi {
|
||||
Rust | RustIntrinsic | PlatformIntrinsic => {}
|
||||
Abi::Rust | Abi::RustIntrinsic | Abi::PlatformIntrinsic => {}
|
||||
abi => {
|
||||
let ty = ccx.tcx().node_id_to_type(foreign_item.id);
|
||||
match ty.sty {
|
||||
|
@ -626,7 +625,9 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
// normal Rust function. This will be the type of the wrappee fn.
|
||||
match t.sty {
|
||||
ty::TyBareFn(_, ref f) => {
|
||||
assert!(f.abi != Rust && f.abi != RustIntrinsic && f.abi != PlatformIntrinsic);
|
||||
assert!(f.abi != Abi::Rust);
|
||||
assert!(f.abi != Abi::RustIntrinsic);
|
||||
assert!(f.abi != Abi::PlatformIntrinsic);
|
||||
}
|
||||
_ => {
|
||||
ccx.sess().bug(&format!("build_rust_fn: extern fn {} has ty {:?}, \
|
||||
|
|
|
@ -40,7 +40,7 @@ use trans::Disr;
|
|||
use middle::subst::Substs;
|
||||
use rustc::dep_graph::DepNode;
|
||||
use rustc_front::hir;
|
||||
use syntax::abi::{self, RustIntrinsic};
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::ptr::P;
|
||||
use syntax::parse::token;
|
||||
|
@ -365,7 +365,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
|
|||
&mut llargs,
|
||||
cleanup::CustomScope(cleanup_scope),
|
||||
false,
|
||||
RustIntrinsic);
|
||||
Abi::RustIntrinsic);
|
||||
|
||||
fcx.scopes.borrow_mut().last_mut().unwrap().drop_non_lifetime_clean();
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ fn get_rust_try_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
|
|||
let i8p = tcx.mk_mut_ptr(tcx.types.i8);
|
||||
let fn_ty = tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Unsafe,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: vec![i8p],
|
||||
output: ty::FnOutput::FnConverging(tcx.mk_nil()),
|
||||
|
@ -1272,7 +1272,7 @@ fn get_rust_try_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
|
|||
let output = ty::FnOutput::FnConverging(tcx.types.i32);
|
||||
let try_fn_ty = tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Unsafe,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: vec![fn_ty, i8p, i8p],
|
||||
output: output,
|
||||
|
@ -1350,7 +1350,7 @@ fn generate_filter_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
|
|||
// just do the same.
|
||||
let filter_fn_ty = tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Unsafe,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: vec![],
|
||||
output: output,
|
||||
|
@ -1370,7 +1370,7 @@ fn generate_filter_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
|
|||
// those along.
|
||||
let filter_fn_ty = tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Unsafe,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: vec![i8p, i8p],
|
||||
output: output,
|
||||
|
|
|
@ -29,7 +29,7 @@ use rustc::front::map as hir_map;
|
|||
|
||||
use rustc_front::hir;
|
||||
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::errors;
|
||||
|
@ -96,7 +96,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
|
||||
if let hir_map::NodeForeignItem(_) = map_node {
|
||||
let abi = ccx.tcx().map.get_foreign_abi(fn_node_id);
|
||||
if abi != abi::RustIntrinsic && abi != abi::PlatformIntrinsic {
|
||||
if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic {
|
||||
// Foreign externs don't have to be monomorphized.
|
||||
return (get_item_val(ccx, fn_node_id), mono_ty, true);
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
|
||||
// This shouldn't need to option dance.
|
||||
let mut hash_id = Some(hash_id);
|
||||
let mut mk_lldecl = |abi: abi::Abi| {
|
||||
let lldecl = if abi != abi::Rust {
|
||||
let mut mk_lldecl = |abi: Abi| {
|
||||
let lldecl = if abi != Abi::Rust {
|
||||
foreign::decl_rust_fn_with_foreign_abi(ccx, mono_ty, &s)
|
||||
} else {
|
||||
// FIXME(nagisa): perhaps needs a more fine grained selection? See
|
||||
|
@ -181,7 +181,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
let d = mk_lldecl(abi);
|
||||
let needs_body = setup_lldecl(d, &i.attrs);
|
||||
if needs_body {
|
||||
if abi != abi::Rust {
|
||||
if abi != Abi::Rust {
|
||||
foreign::trans_rust_fn_with_foreign_abi(
|
||||
ccx, &**decl, &**body, &[], d, psubsts, fn_node_id,
|
||||
Some(&hash[..]));
|
||||
|
@ -206,7 +206,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
hir_map::NodeVariant(v) => {
|
||||
let variant = inlined_variant_def(ccx, fn_node_id);
|
||||
assert_eq!(v.node.name, variant.name);
|
||||
let d = mk_lldecl(abi::Rust);
|
||||
let d = mk_lldecl(Abi::Rust);
|
||||
attributes::inline(d, attributes::InlineAttr::Hint);
|
||||
trans_enum_variant(ccx, fn_node_id, Disr::from(variant.disr_val), psubsts, d);
|
||||
d
|
||||
|
@ -214,7 +214,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
hir_map::NodeImplItem(impl_item) => {
|
||||
match impl_item.node {
|
||||
hir::ImplItemKind::Method(ref sig, ref body) => {
|
||||
let d = mk_lldecl(abi::Rust);
|
||||
let d = mk_lldecl(Abi::Rust);
|
||||
let needs_body = setup_lldecl(d, &impl_item.attrs);
|
||||
if needs_body {
|
||||
trans_fn(ccx,
|
||||
|
@ -236,7 +236,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
hir_map::NodeTraitItem(trait_item) => {
|
||||
match trait_item.node {
|
||||
hir::MethodTraitItem(ref sig, Some(ref body)) => {
|
||||
let d = mk_lldecl(abi::Rust);
|
||||
let d = mk_lldecl(Abi::Rust);
|
||||
let needs_body = setup_lldecl(d, &trait_item.attrs);
|
||||
if needs_body {
|
||||
trans_fn(ccx,
|
||||
|
@ -256,7 +256,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
}
|
||||
}
|
||||
hir_map::NodeStructCtor(struct_def) => {
|
||||
let d = mk_lldecl(abi::Rust);
|
||||
let d = mk_lldecl(Abi::Rust);
|
||||
attributes::inline(d, attributes::InlineAttr::Hint);
|
||||
if struct_def.is_struct() {
|
||||
panic!("ast-mapped struct didn't have a ctor id")
|
||||
|
|
|
@ -21,7 +21,7 @@ use middle::ty::{self, Ty, TypeFoldable};
|
|||
|
||||
use trans::type_::Type;
|
||||
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
|
||||
// LLVM doesn't like objects that are too big. Issue #17913
|
||||
|
@ -91,7 +91,7 @@ pub fn untuple_arguments<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||
llenvironment_type: Option<Type>,
|
||||
sig: &ty::FnSig<'tcx>,
|
||||
abi: abi::Abi)
|
||||
abi: Abi)
|
||||
-> Type
|
||||
{
|
||||
debug!("type_of_rust_fn(sig={:?},abi={:?})",
|
||||
|
@ -104,7 +104,7 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
|||
|
||||
// First, munge the inputs, if this has the `rust-call` ABI.
|
||||
let inputs_temp;
|
||||
let inputs = if abi == abi::RustCall {
|
||||
let inputs = if abi == Abi::RustCall {
|
||||
inputs_temp = untuple_arguments(cx, &sig.inputs);
|
||||
&inputs_temp
|
||||
} else {
|
||||
|
@ -156,7 +156,7 @@ pub fn type_of_fn_from_ty<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, fty: Ty<'tcx>)
|
|||
ty::TyBareFn(_, ref f) => {
|
||||
// FIXME(#19925) once fn item types are
|
||||
// zero-sized, we'll need to do something here
|
||||
if f.abi == abi::Rust || f.abi == abi::RustCall {
|
||||
if f.abi == Abi::Rust || f.abi == Abi::RustCall {
|
||||
let sig = cx.tcx().erase_late_bound_regions(&f.sig);
|
||||
let sig = infer::normalize_associated_type(cx.tcx(), &sig);
|
||||
type_of_rust_fn(cx, None, &sig, f.abi)
|
||||
|
|
|
@ -16,7 +16,7 @@ use astconv;
|
|||
use middle::subst;
|
||||
use middle::ty::{self, ToPolyTraitRef, Ty};
|
||||
use std::cmp;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use rustc_front::hir;
|
||||
|
||||
pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
|
||||
|
@ -54,7 +54,7 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
|
|||
let mut fn_ty = astconv::ty_of_closure(fcx,
|
||||
hir::Unsafety::Normal,
|
||||
decl,
|
||||
abi::RustCall,
|
||||
Abi::RustCall,
|
||||
expected_sig);
|
||||
|
||||
// Create type variables (for now) to represent the transformed
|
||||
|
|
|
@ -20,7 +20,7 @@ use middle::ty::fold::TypeFolder;
|
|||
use {CrateCtxt, require_same_types};
|
||||
|
||||
use std::collections::{HashMap};
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::codemap::Span;
|
||||
|
@ -30,7 +30,7 @@ use rustc_front::hir;
|
|||
|
||||
fn equate_intrinsic_type<'a, 'tcx>(tcx: &ty::ctxt<'tcx>, it: &hir::ForeignItem,
|
||||
n_tps: usize,
|
||||
abi: abi::Abi,
|
||||
abi: Abi,
|
||||
inputs: Vec<ty::Ty<'tcx>>,
|
||||
output: ty::FnOutput<'tcx>) {
|
||||
let fty = tcx.mk_fn(None, tcx.mk_bare_fn(ty::BareFnTy {
|
||||
|
@ -285,7 +285,7 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
|||
let mut_u8 = tcx.mk_mut_ptr(tcx.types.u8);
|
||||
let fn_ty = ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(FnSig {
|
||||
inputs: vec![mut_u8],
|
||||
output: ty::FnOutput::FnConverging(tcx.mk_nil()),
|
||||
|
@ -308,7 +308,7 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) {
|
|||
tcx,
|
||||
it,
|
||||
n_tps,
|
||||
abi::RustIntrinsic,
|
||||
Abi::RustIntrinsic,
|
||||
inputs,
|
||||
output
|
||||
)
|
||||
|
@ -398,7 +398,7 @@ pub fn check_platform_intrinsic_type(ccx: &CrateCtxt,
|
|||
tcx,
|
||||
it,
|
||||
n_tps,
|
||||
abi::PlatformIntrinsic,
|
||||
Abi::PlatformIntrinsic,
|
||||
inputs,
|
||||
ty::FnConverging(output)
|
||||
)
|
||||
|
|
|
@ -115,7 +115,7 @@ use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
|
|||
use std::cell::{Cell, Ref, RefCell};
|
||||
use std::collections::{HashSet};
|
||||
use std::mem::replace;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
|
@ -691,11 +691,11 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
|
|||
check_bounds_are_used(ccx, &generics.ty_params, pty_ty);
|
||||
}
|
||||
hir::ItemForeignMod(ref m) => {
|
||||
if m.abi == abi::RustIntrinsic {
|
||||
if m.abi == Abi::RustIntrinsic {
|
||||
for item in &m.items {
|
||||
intrinsic::check_intrinsic_type(ccx, item);
|
||||
}
|
||||
} else if m.abi == abi::PlatformIntrinsic {
|
||||
} else if m.abi == Abi::PlatformIntrinsic {
|
||||
for item in &m.items {
|
||||
intrinsic::check_platform_intrinsic_type(ccx, item);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,8 @@ use util::common::time;
|
|||
use rustc_front::hir;
|
||||
|
||||
use syntax::codemap::Span;
|
||||
use syntax::{ast, abi};
|
||||
use syntax::ast;
|
||||
use syntax::abi::Abi;
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
|
@ -175,9 +176,9 @@ fn lookup_full_def(tcx: &ty::ctxt, sp: Span, id: ast::NodeId) -> Def {
|
|||
|
||||
fn require_c_abi_if_variadic(tcx: &ty::ctxt,
|
||||
decl: &hir::FnDecl,
|
||||
abi: abi::Abi,
|
||||
abi: Abi,
|
||||
span: Span) {
|
||||
if decl.variadic && abi != abi::C {
|
||||
if decl.variadic && abi != Abi::C {
|
||||
span_err!(tcx.sess, span, E0045,
|
||||
"variadic function must have C calling convention");
|
||||
}
|
||||
|
@ -238,7 +239,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
|
|||
let main_def_id = tcx.map.local_def_id(main_id);
|
||||
let se_ty = tcx.mk_fn(Some(main_def_id), tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: Vec::new(),
|
||||
output: ty::FnConverging(tcx.mk_nil()),
|
||||
|
@ -285,7 +286,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
|
|||
let se_ty = tcx.mk_fn(Some(ccx.tcx.map.local_def_id(start_id)),
|
||||
tcx.mk_bare_fn(ty::BareFnTy {
|
||||
unsafety: hir::Unsafety::Normal,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
sig: ty::Binder(ty::FnSig {
|
||||
inputs: vec!(
|
||||
tcx.types.isize,
|
||||
|
|
|
@ -25,7 +25,7 @@ pub use self::SelfTy::*;
|
|||
pub use self::FunctionRetTy::*;
|
||||
|
||||
use syntax;
|
||||
use syntax::abi;
|
||||
use syntax::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::attr::{AttributeMethods, AttrMetaMethods};
|
||||
|
@ -993,7 +993,7 @@ pub struct Method {
|
|||
pub unsafety: hir::Unsafety,
|
||||
pub constness: hir::Constness,
|
||||
pub decl: FnDecl,
|
||||
pub abi: abi::Abi
|
||||
pub abi: Abi,
|
||||
}
|
||||
|
||||
impl Clean<Method> for hir::MethodSig {
|
||||
|
@ -1028,7 +1028,7 @@ pub struct TyMethod {
|
|||
pub decl: FnDecl,
|
||||
pub generics: Generics,
|
||||
pub self_: SelfTy,
|
||||
pub abi: abi::Abi
|
||||
pub abi: Abi,
|
||||
}
|
||||
|
||||
impl Clean<TyMethod> for hir::MethodSig {
|
||||
|
@ -1082,7 +1082,7 @@ pub struct Function {
|
|||
pub generics: Generics,
|
||||
pub unsafety: hir::Unsafety,
|
||||
pub constness: hir::Constness,
|
||||
pub abi: abi::Abi,
|
||||
pub abi: Abi,
|
||||
}
|
||||
|
||||
impl Clean<Item> for doctree::Function {
|
||||
|
@ -2486,7 +2486,7 @@ impl Clean<Item> for hir::ForeignItem {
|
|||
decl: decl.clean(cx),
|
||||
generics: generics.clean(cx),
|
||||
unsafety: hir::Unsafety::Unsafe,
|
||||
abi: abi::Rust,
|
||||
abi: Abi::Rust,
|
||||
constness: hir::Constness::NotConst,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -193,7 +193,6 @@ use std::collections::HashSet;
|
|||
use std::vec;
|
||||
|
||||
use syntax::abi::Abi;
|
||||
use syntax::abi;
|
||||
use syntax::ast::{EnumDef, Expr, Ident, Generics, VariantData, BinOpKind, self};
|
||||
use syntax::ast_util;
|
||||
use syntax::attr;
|
||||
|
@ -681,7 +680,7 @@ impl<'a> TraitDef<'a> {
|
|||
self,
|
||||
type_ident,
|
||||
generics,
|
||||
abi::Rust,
|
||||
Abi::Rust,
|
||||
explicit_self,
|
||||
tys,
|
||||
body)
|
||||
|
@ -730,7 +729,7 @@ impl<'a> TraitDef<'a> {
|
|||
self,
|
||||
type_ident,
|
||||
generics,
|
||||
abi::Rust,
|
||||
Abi::Rust,
|
||||
explicit_self,
|
||||
tys,
|
||||
body)
|
||||
|
|
Loading…
Reference in New Issue