Skip to content
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

[breaking batch] don't glob export ast::UnOp variants #31487

Merged
merged 29 commits into from
Feb 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f875f4c
[breaking-change] don't glob export ast::UnOp variants
oli-obk Feb 8, 2016
05e25de
[breaking-change] don't glob export ast::BinOp_
oli-obk Feb 8, 2016
3b57d40
[breaking-change] don't glob import ast::FunctionRetTy variants
oli-obk Feb 8, 2016
47b0784
[breaking-change] don't glob export ast::BlockCheckMode variants
oli-obk Feb 8, 2016
243a30c
[breaking-change] don't glob import/export syntax::abi enum variants
oli-obk Feb 5, 2016
8516ba3
[breaking-change] don't glob export ast::CaptureClause variants
oli-obk Feb 8, 2016
79fa657
[breaking-change] don't glob export ast::Decl_ variants
oli-obk Feb 8, 2016
1c4d437
[breaking-change] don't glob export ast::ExplicitSelf_ variants
oli-obk Feb 8, 2016
80bf9ae
[breaking-change] don't glob export ast::Expr_ variants
oli-obk Feb 8, 2016
ccf48bc
[breaking-change] don't glob export ast::FloatTy variants
oli-obk Feb 8, 2016
625e78b
[breaking-change] don't glob export ast::{UintTy, IntTy} variants
oli-obk Feb 8, 2016
bfa66bb
[breaking-change] remove the sign from integer literals in the ast
oli-obk Feb 11, 2016
08e35d4
remove unit test that can't be tested anymore
oli-obk Dec 23, 2015
ec61e63
[breaking-change] remove unused enum ast::PrimTy
oli-obk Feb 8, 2016
05d4cef
[breaking-change] don't pub export ast::Ty_ variants
oli-obk Feb 8, 2016
69072c4
[breaking-change] don't pub export ast::Lit_ variants
oli-obk Feb 8, 2016
498a2e4
[breaking-change] don't pub export ast::IntLitType variants
oli-obk Feb 8, 2016
8290c95
[breaking-change] don't pub export ast::Stmt_ variants
oli-obk Feb 8, 2016
0d6ddd1
[breaking-change] don't glob export ast::ForeignItem_ variants
oli-obk Feb 9, 2016
019614f
[breaking-change] don't glob export ast::Item_ variants
oli-obk Feb 9, 2016
798974c
[breaking-change] don't glob export ast::KleeneOp variants
oli-obk Feb 9, 2016
e797e19
[breaking-change] don't glob export ast::MacStmtStyle
oli-obk Feb 9, 2016
14e09ad
[breaking-change] don't glob export ast::MetaItem_
oli-obk Feb 9, 2016
73fa9b2
[breaking-change] don't glob export ast::Mutablity variants
oli-obk Feb 9, 2016
dfe35da
[breaking-change] don't glob export ast::TraitItemKind variants
oli-obk Feb 9, 2016
d844bfb
[breaking-change] don't glob export ast::Visibility variants
oli-obk Feb 9, 2016
8b3856b
[breaking-change] don't glob export ast::StrStyle variants
oli-obk Feb 9, 2016
2b816b0
[breaking-change] don't glob export ast::PathListItem_ variants
oli-obk Feb 9, 2016
bafea3b
fixup: meta item kind
oli-obk Feb 11, 2016
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/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ enum Target {
impl Target {
fn from_item(item: &ast::Item) -> Target {
match item.node {
ast::ItemFn(..) => Target::Fn,
ast::ItemStruct(..) => Target::Struct,
ast::ItemEnum(..) => Target::Enum,
ast::ItemKind::Fn(..) => Target::Fn,
ast::ItemKind::Struct(..) => Target::Struct,
ast::ItemKind::Enum(..) => Target::Enum,
_ => Target::Other,
}
}
Expand Down
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
4 changes: 2 additions & 2 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub fn gather_attr(attr: &ast::Attribute)

let meta = &attr.node.value;
let metas = match meta.node {
ast::MetaList(_, ref metas) => metas,
ast::MetaItemKind::List(_, ref metas) => metas,
_ => {
out.push(Err(meta.span));
return out;
Expand All @@ -383,7 +383,7 @@ pub fn gather_attr(attr: &ast::Attribute)

for meta in metas {
out.push(match meta.node {
ast::MetaWord(ref lint_name) => Ok((lint_name.clone(), level, meta.span)),
ast::MetaItemKind::Word(ref lint_name) => Ok((lint_name.clone(), level, meta.span)),
_ => Err(meta.span),
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix, source: hir:

fn const_val_to_expr(value: &ConstVal) -> P<hir::Expr> {
let node = match value {
&ConstVal::Bool(b) => ast::LitBool(b),
&ConstVal::Bool(b) => ast::LitKind::Bool(b),
_ => unreachable!()
};
P(hir::Expr {
Expand Down
82 changes: 40 additions & 42 deletions src/librustc/middle/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,34 +545,34 @@ pub enum UintTy { U8, U16, U32, U64 }

impl IntTy {
pub fn from(tcx: &ty::ctxt, t: ast::IntTy) -> IntTy {
let t = if let ast::TyIs = t {
let t = if let ast::IntTy::Is = t {
tcx.sess.target.int_type
} else {
t
};
match t {
ast::TyIs => unreachable!(),
ast::TyI8 => IntTy::I8,
ast::TyI16 => IntTy::I16,
ast::TyI32 => IntTy::I32,
ast::TyI64 => IntTy::I64,
ast::IntTy::Is => unreachable!(),
ast::IntTy::I8 => IntTy::I8,
ast::IntTy::I16 => IntTy::I16,
ast::IntTy::I32 => IntTy::I32,
ast::IntTy::I64 => IntTy::I64,
}
}
}

impl UintTy {
pub fn from(tcx: &ty::ctxt, t: ast::UintTy) -> UintTy {
let t = if let ast::TyUs = t {
let t = if let ast::UintTy::Us = t {
tcx.sess.target.uint_type
} else {
t
};
match t {
ast::TyUs => unreachable!(),
ast::TyU8 => UintTy::U8,
ast::TyU16 => UintTy::U16,
ast::TyU32 => UintTy::U32,
ast::TyU64 => UintTy::U64,
ast::UintTy::Us => unreachable!(),
ast::UintTy::U8 => UintTy::U8,
ast::UintTy::U16 => UintTy::U16,
ast::UintTy::U32 => UintTy::U32,
ast::UintTy::U64 => UintTy::U64,
}
}
}
Expand Down Expand Up @@ -1289,65 +1289,63 @@ fn cast_const<'tcx>(tcx: &ty::ctxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {

// Issue #23890: If isize/usize, then dispatch to appropriate target representation type
match (&ty.sty, tcx.sess.target.int_type, tcx.sess.target.uint_type) {
(&ty::TyInt(ast::TyIs), ast::TyI32, _) => return convert_val!(i32, Int, i64),
(&ty::TyInt(ast::TyIs), ast::TyI64, _) => return convert_val!(i64, Int, i64),
(&ty::TyInt(ast::TyIs), _, _) => panic!("unexpected target.int_type"),
(&ty::TyInt(ast::IntTy::Is), ast::IntTy::I32, _) => return convert_val!(i32, Int, i64),
(&ty::TyInt(ast::IntTy::Is), ast::IntTy::I64, _) => return convert_val!(i64, Int, i64),
(&ty::TyInt(ast::IntTy::Is), _, _) => panic!("unexpected target.int_type"),

(&ty::TyUint(ast::TyUs), _, ast::TyU32) => return convert_val!(u32, Uint, u64),
(&ty::TyUint(ast::TyUs), _, ast::TyU64) => return convert_val!(u64, Uint, u64),
(&ty::TyUint(ast::TyUs), _, _) => panic!("unexpected target.uint_type"),
(&ty::TyUint(ast::UintTy::Us), _, ast::UintTy::U32) => return convert_val!(u32, Uint, u64),
(&ty::TyUint(ast::UintTy::Us), _, ast::UintTy::U64) => return convert_val!(u64, Uint, u64),
(&ty::TyUint(ast::UintTy::Us), _, _) => panic!("unexpected target.uint_type"),

_ => {}
}

match ty.sty {
ty::TyInt(ast::TyIs) => unreachable!(),
ty::TyUint(ast::TyUs) => unreachable!(),
ty::TyInt(ast::IntTy::Is) => unreachable!(),
ty::TyUint(ast::UintTy::Us) => unreachable!(),

ty::TyInt(ast::TyI8) => convert_val!(i8, Int, i64),
ty::TyInt(ast::TyI16) => convert_val!(i16, Int, i64),
ty::TyInt(ast::TyI32) => convert_val!(i32, Int, i64),
ty::TyInt(ast::TyI64) => convert_val!(i64, Int, i64),
ty::TyInt(ast::IntTy::I8) => convert_val!(i8, Int, i64),
ty::TyInt(ast::IntTy::I16) => convert_val!(i16, Int, i64),
ty::TyInt(ast::IntTy::I32) => convert_val!(i32, Int, i64),
ty::TyInt(ast::IntTy::I64) => convert_val!(i64, Int, i64),

ty::TyUint(ast::TyU8) => convert_val!(u8, Uint, u64),
ty::TyUint(ast::TyU16) => convert_val!(u16, Uint, u64),
ty::TyUint(ast::TyU32) => convert_val!(u32, Uint, u64),
ty::TyUint(ast::TyU64) => convert_val!(u64, Uint, u64),
ty::TyUint(ast::UintTy::U8) => convert_val!(u8, Uint, u64),
ty::TyUint(ast::UintTy::U16) => convert_val!(u16, Uint, u64),
ty::TyUint(ast::UintTy::U32) => convert_val!(u32, Uint, u64),
ty::TyUint(ast::UintTy::U64) => convert_val!(u64, Uint, u64),

ty::TyFloat(ast::TyF32) => convert_val!(f32, Float, f64),
ty::TyFloat(ast::TyF64) => convert_val!(f64, Float, f64),
ty::TyFloat(ast::FloatTy::F32) => convert_val!(f32, Float, f64),
ty::TyFloat(ast::FloatTy::F64) => convert_val!(f64, Float, f64),
_ => Err(ErrKind::CannotCast),
}
}

fn lit_to_const(sess: &Session, span: Span, lit: &ast::Lit, ty_hint: Option<Ty>) -> ConstVal {
match lit.node {
ast::LitStr(ref s, _) => Str((*s).clone()),
ast::LitByteStr(ref data) => {
ast::LitKind::Str(ref s, _) => Str((*s).clone()),
ast::LitKind::ByteStr(ref data) => {
ByteStr(data.clone())
}
ast::LitByte(n) => Uint(n as u64),
ast::LitChar(n) => Uint(n as u64),
ast::LitInt(n, ast::SignedIntLit(_, ast::Plus)) => Int(n as i64),
ast::LitInt(n, ast::UnsuffixedIntLit(ast::Plus)) => {
ast::LitKind::Byte(n) => Uint(n as u64),
ast::LitKind::Char(n) => Uint(n as u64),
ast::LitKind::Int(n, ast::LitIntType::Signed(_)) => Int(n as i64),
ast::LitKind::Int(n, ast::LitIntType::Unsuffixed) => {
match ty_hint.map(|ty| &ty.sty) {
Some(&ty::TyUint(_)) => Uint(n),
_ => Int(n as i64)
}
}
ast::LitInt(n, ast::SignedIntLit(_, ast::Minus)) |
ast::LitInt(n, ast::UnsuffixedIntLit(ast::Minus)) => Int(-(n as i64)),
ast::LitInt(n, ast::UnsignedIntLit(_)) => Uint(n),
ast::LitFloat(ref n, _) |
ast::LitFloatUnsuffixed(ref n) => {
ast::LitKind::Int(n, ast::LitIntType::Unsigned(_)) => Uint(n),
ast::LitKind::Float(ref n, _) |
ast::LitKind::FloatUnsuffixed(ref n) => {
if let Ok(x) = n.parse::<f64>() {
Float(x)
} else {
// FIXME(#31407) this is only necessary because float parsing is buggy
sess.span_bug(span, "could not evaluate float literal (see issue #31407)");
}
}
ast::LitBool(b) => Bool(b)
ast::LitKind::Bool(b) => Bool(b)
}
}

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
2 changes: 1 addition & 1 deletion src/librustc/middle/ty/contents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl<'tcx> ty::TyS<'tcx> {

let result = match ty.sty {
// usize and isize are ffi-unsafe
ty::TyUint(ast::TyUs) | ty::TyInt(ast::TyIs) => {
ty::TyUint(ast::UintTy::Us) | ty::TyInt(ast::IntTy::Is) => {
TC::None
}

Expand Down
52 changes: 26 additions & 26 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 @@ -192,18 +192,18 @@ impl<'tcx> CommonTypes<'tcx> {
bool: mk(TyBool),
char: mk(TyChar),
err: mk(TyError),
isize: mk(TyInt(ast::TyIs)),
i8: mk(TyInt(ast::TyI8)),
i16: mk(TyInt(ast::TyI16)),
i32: mk(TyInt(ast::TyI32)),
i64: mk(TyInt(ast::TyI64)),
usize: mk(TyUint(ast::TyUs)),
u8: mk(TyUint(ast::TyU8)),
u16: mk(TyUint(ast::TyU16)),
u32: mk(TyUint(ast::TyU32)),
u64: mk(TyUint(ast::TyU64)),
f32: mk(TyFloat(ast::TyF32)),
f64: mk(TyFloat(ast::TyF64)),
isize: mk(TyInt(ast::IntTy::Is)),
i8: mk(TyInt(ast::IntTy::I8)),
i16: mk(TyInt(ast::IntTy::I16)),
i32: mk(TyInt(ast::IntTy::I32)),
i64: mk(TyInt(ast::IntTy::I64)),
usize: mk(TyUint(ast::UintTy::Us)),
u8: mk(TyUint(ast::UintTy::U8)),
u16: mk(TyUint(ast::UintTy::U16)),
u32: mk(TyUint(ast::UintTy::U32)),
u64: mk(TyUint(ast::UintTy::U64)),
f32: mk(TyFloat(ast::FloatTy::F32)),
f64: mk(TyFloat(ast::FloatTy::F64)),
}
}
}
Expand Down Expand Up @@ -840,28 +840,28 @@ impl<'tcx> ctxt<'tcx> {

pub fn mk_mach_int(&self, tm: ast::IntTy) -> Ty<'tcx> {
match tm {
ast::TyIs => self.types.isize,
ast::TyI8 => self.types.i8,
ast::TyI16 => self.types.i16,
ast::TyI32 => self.types.i32,
ast::TyI64 => self.types.i64,
ast::IntTy::Is => self.types.isize,
ast::IntTy::I8 => self.types.i8,
ast::IntTy::I16 => self.types.i16,
ast::IntTy::I32 => self.types.i32,
ast::IntTy::I64 => self.types.i64,
}
}

pub fn mk_mach_uint(&self, tm: ast::UintTy) -> Ty<'tcx> {
match tm {
ast::TyUs => self.types.usize,
ast::TyU8 => self.types.u8,
ast::TyU16 => self.types.u16,
ast::TyU32 => self.types.u32,
ast::TyU64 => self.types.u64,
ast::UintTy::Us => self.types.usize,
ast::UintTy::U8 => self.types.u8,
ast::UintTy::U16 => self.types.u16,
ast::UintTy::U32 => self.types.u32,
ast::UintTy::U64 => self.types.u64,
}
}

pub fn mk_mach_float(&self, tm: ast::FloatTy) -> Ty<'tcx> {
match tm {
ast::TyF32 => self.types.f32,
ast::TyF64 => self.types.f64,
ast::FloatTy::F32 => self.types.f32,
ast::FloatTy::F64 => self.types.f64,
}
}

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/middle/ty/relate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ impl<'a,'tcx:'a> Relate<'a,'tcx> for ty::TypeAndMut<'tcx> {
} else {
let mutbl = a.mutbl;
let variance = match mutbl {
ast::MutImmutable => ty::Covariant,
ast::MutMutable => ty::Invariant,
ast::Mutability::MutImmutable => ty::Covariant,
ast::Mutability::MutMutable => ty::Invariant,
};
let ty = try!(relation.relate_with_variance(variance, &a.ty, &b.ty));
Ok(ty::TypeAndMut {ty: ty, mutbl: mutbl})
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ impl<'tcx> TyS<'tcx> {
pub fn sequence_element_type(&self, cx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
match self.sty {
TyArray(ty, _) | TySlice(ty) => ty,
TyStr => cx.mk_mach_uint(ast::TyU8),
TyStr => cx.mk_mach_uint(ast::UintTy::U8),
_ => cx.sess.bug(&format!("sequence_element_type called on non-sequence value: {}",
self)),
}
Expand Down Expand Up @@ -1068,7 +1068,7 @@ impl<'tcx> TyS<'tcx> {

pub fn is_uint(&self) -> bool {
match self.sty {
TyInfer(IntVar(_)) | TyUint(ast::TyUs) => true,
TyInfer(IntVar(_)) | TyUint(ast::UintTy::Us) => true,
_ => false
}
}
Expand Down Expand Up @@ -1114,7 +1114,7 @@ impl<'tcx> TyS<'tcx> {

pub fn is_machine(&self) -> bool {
match self.sty {
TyInt(ast::TyIs) | TyUint(ast::TyUs) => false,
TyInt(ast::IntTy::Is) | TyUint(ast::UintTy::Us) => false,
TyInt(..) | TyUint(..) | TyFloat(..) => true,
_ => false
}
Expand Down
Loading