Skip to content

[breaking batch] don't glob-export syntax::abi enums #31485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc/front/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) => {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(_),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

Expand Down
10 changes: 5 additions & 5 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_driver/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
20 changes: 10 additions & 10 deletions src/librustc_front/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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_>,
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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())
Expand All @@ -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"));
Expand All @@ -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, "")));
Expand All @@ -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()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
13 changes: 7 additions & 6 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_trans/trans/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.")
};
Expand All @@ -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) => {
Expand All @@ -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 {
Expand Down
Loading