Skip to content

Commit 7732c0a

Browse files
committed
Auto merge of #31487 - oli-obk:breaking_batch/ast/unop, r=Manishearth
r? @Manishearth I just noticed they can't be rolled up (often modifying the same line(s) in imports). So once I reach the critical amount for them to be merged I'll create a PR that merges all of them.
2 parents f5f8e0b + bafea3b commit 7732c0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2352
-2415
lines changed

src/librustc/front/check_attr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ enum Target {
2626
impl Target {
2727
fn from_item(item: &ast::Item) -> Target {
2828
match item.node {
29-
ast::ItemFn(..) => Target::Fn,
30-
ast::ItemStruct(..) => Target::Struct,
31-
ast::ItemEnum(..) => Target::Enum,
29+
ast::ItemKind::Fn(..) => Target::Fn,
30+
ast::ItemKind::Struct(..) => Target::Struct,
31+
ast::ItemKind::Enum(..) => Target::Enum,
3232
_ => Target::Other,
3333
}
3434
}

src/librustc/front/map/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use middle::cstore::InlinedItem;
2020
use middle::cstore::InlinedItem as II;
2121
use middle::def_id::DefId;
2222

23-
use syntax::abi;
23+
use syntax::abi::Abi;
2424
use syntax::ast::{self, Name, NodeId, DUMMY_NODE_ID};
2525
use syntax::codemap::{Span, Spanned};
2626
use syntax::parse::token;
@@ -512,7 +512,7 @@ impl<'ast> Map<'ast> {
512512
}
513513
}
514514

515-
pub fn get_foreign_abi(&self, id: NodeId) -> abi::Abi {
515+
pub fn get_foreign_abi(&self, id: NodeId) -> Abi {
516516
let parent = self.get_parent(id);
517517
let abi = match self.find_entry(parent) {
518518
Some(EntryItem(_, i)) => {
@@ -522,7 +522,7 @@ impl<'ast> Map<'ast> {
522522
}
523523
}
524524
/// Wrong but OK, because the only inlined foreign items are intrinsics.
525-
Some(RootInlinedParent(_)) => Some(abi::RustIntrinsic),
525+
Some(RootInlinedParent(_)) => Some(Abi::RustIntrinsic),
526526
_ => None
527527
};
528528
match abi {

src/librustc/lint/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ pub fn gather_attr(attr: &ast::Attribute)
374374

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

384384
for meta in metas {
385385
out.push(match meta.node {
386-
ast::MetaWord(ref lint_name) => Ok((lint_name.clone(), level, meta.span)),
386+
ast::MetaItemKind::Word(ref lint_name) => Ok((lint_name.clone(), level, meta.span)),
387387
_ => Err(meta.span),
388388
});
389389
}

src/librustc/middle/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix, source: hir:
421421

422422
fn const_val_to_expr(value: &ConstVal) -> P<hir::Expr> {
423423
let node = match value {
424-
&ConstVal::Bool(b) => ast::LitBool(b),
424+
&ConstVal::Bool(b) => ast::LitKind::Bool(b),
425425
_ => unreachable!()
426426
};
427427
P(hir::Expr {

src/librustc/middle/const_eval.rs

+40-42
Original file line numberDiff line numberDiff line change
@@ -545,34 +545,34 @@ pub enum UintTy { U8, U16, U32, U64 }
545545

546546
impl IntTy {
547547
pub fn from(tcx: &ty::ctxt, t: ast::IntTy) -> IntTy {
548-
let t = if let ast::TyIs = t {
548+
let t = if let ast::IntTy::Is = t {
549549
tcx.sess.target.int_type
550550
} else {
551551
t
552552
};
553553
match t {
554-
ast::TyIs => unreachable!(),
555-
ast::TyI8 => IntTy::I8,
556-
ast::TyI16 => IntTy::I16,
557-
ast::TyI32 => IntTy::I32,
558-
ast::TyI64 => IntTy::I64,
554+
ast::IntTy::Is => unreachable!(),
555+
ast::IntTy::I8 => IntTy::I8,
556+
ast::IntTy::I16 => IntTy::I16,
557+
ast::IntTy::I32 => IntTy::I32,
558+
ast::IntTy::I64 => IntTy::I64,
559559
}
560560
}
561561
}
562562

563563
impl UintTy {
564564
pub fn from(tcx: &ty::ctxt, t: ast::UintTy) -> UintTy {
565-
let t = if let ast::TyUs = t {
565+
let t = if let ast::UintTy::Us = t {
566566
tcx.sess.target.uint_type
567567
} else {
568568
t
569569
};
570570
match t {
571-
ast::TyUs => unreachable!(),
572-
ast::TyU8 => UintTy::U8,
573-
ast::TyU16 => UintTy::U16,
574-
ast::TyU32 => UintTy::U32,
575-
ast::TyU64 => UintTy::U64,
571+
ast::UintTy::Us => unreachable!(),
572+
ast::UintTy::U8 => UintTy::U8,
573+
ast::UintTy::U16 => UintTy::U16,
574+
ast::UintTy::U32 => UintTy::U32,
575+
ast::UintTy::U64 => UintTy::U64,
576576
}
577577
}
578578
}
@@ -1289,65 +1289,63 @@ fn cast_const<'tcx>(tcx: &ty::ctxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {
12891289

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

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

13001300
_ => {}
13011301
}
13021302

13031303
match ty.sty {
1304-
ty::TyInt(ast::TyIs) => unreachable!(),
1305-
ty::TyUint(ast::TyUs) => unreachable!(),
1304+
ty::TyInt(ast::IntTy::Is) => unreachable!(),
1305+
ty::TyUint(ast::UintTy::Us) => unreachable!(),
13061306

1307-
ty::TyInt(ast::TyI8) => convert_val!(i8, Int, i64),
1308-
ty::TyInt(ast::TyI16) => convert_val!(i16, Int, i64),
1309-
ty::TyInt(ast::TyI32) => convert_val!(i32, Int, i64),
1310-
ty::TyInt(ast::TyI64) => convert_val!(i64, Int, i64),
1307+
ty::TyInt(ast::IntTy::I8) => convert_val!(i8, Int, i64),
1308+
ty::TyInt(ast::IntTy::I16) => convert_val!(i16, Int, i64),
1309+
ty::TyInt(ast::IntTy::I32) => convert_val!(i32, Int, i64),
1310+
ty::TyInt(ast::IntTy::I64) => convert_val!(i64, Int, i64),
13111311

1312-
ty::TyUint(ast::TyU8) => convert_val!(u8, Uint, u64),
1313-
ty::TyUint(ast::TyU16) => convert_val!(u16, Uint, u64),
1314-
ty::TyUint(ast::TyU32) => convert_val!(u32, Uint, u64),
1315-
ty::TyUint(ast::TyU64) => convert_val!(u64, Uint, u64),
1312+
ty::TyUint(ast::UintTy::U8) => convert_val!(u8, Uint, u64),
1313+
ty::TyUint(ast::UintTy::U16) => convert_val!(u16, Uint, u64),
1314+
ty::TyUint(ast::UintTy::U32) => convert_val!(u32, Uint, u64),
1315+
ty::TyUint(ast::UintTy::U64) => convert_val!(u64, Uint, u64),
13161316

1317-
ty::TyFloat(ast::TyF32) => convert_val!(f32, Float, f64),
1318-
ty::TyFloat(ast::TyF64) => convert_val!(f64, Float, f64),
1317+
ty::TyFloat(ast::FloatTy::F32) => convert_val!(f32, Float, f64),
1318+
ty::TyFloat(ast::FloatTy::F64) => convert_val!(f64, Float, f64),
13191319
_ => Err(ErrKind::CannotCast),
13201320
}
13211321
}
13221322

13231323
fn lit_to_const(sess: &Session, span: Span, lit: &ast::Lit, ty_hint: Option<Ty>) -> ConstVal {
13241324
match lit.node {
1325-
ast::LitStr(ref s, _) => Str((*s).clone()),
1326-
ast::LitByteStr(ref data) => {
1325+
ast::LitKind::Str(ref s, _) => Str((*s).clone()),
1326+
ast::LitKind::ByteStr(ref data) => {
13271327
ByteStr(data.clone())
13281328
}
1329-
ast::LitByte(n) => Uint(n as u64),
1330-
ast::LitChar(n) => Uint(n as u64),
1331-
ast::LitInt(n, ast::SignedIntLit(_, ast::Plus)) => Int(n as i64),
1332-
ast::LitInt(n, ast::UnsuffixedIntLit(ast::Plus)) => {
1329+
ast::LitKind::Byte(n) => Uint(n as u64),
1330+
ast::LitKind::Char(n) => Uint(n as u64),
1331+
ast::LitKind::Int(n, ast::LitIntType::Signed(_)) => Int(n as i64),
1332+
ast::LitKind::Int(n, ast::LitIntType::Unsuffixed) => {
13331333
match ty_hint.map(|ty| &ty.sty) {
13341334
Some(&ty::TyUint(_)) => Uint(n),
13351335
_ => Int(n as i64)
13361336
}
13371337
}
1338-
ast::LitInt(n, ast::SignedIntLit(_, ast::Minus)) |
1339-
ast::LitInt(n, ast::UnsuffixedIntLit(ast::Minus)) => Int(-(n as i64)),
1340-
ast::LitInt(n, ast::UnsignedIntLit(_)) => Uint(n),
1341-
ast::LitFloat(ref n, _) |
1342-
ast::LitFloatUnsuffixed(ref n) => {
1338+
ast::LitKind::Int(n, ast::LitIntType::Unsigned(_)) => Uint(n),
1339+
ast::LitKind::Float(ref n, _) |
1340+
ast::LitKind::FloatUnsuffixed(ref n) => {
13431341
if let Ok(x) = n.parse::<f64>() {
13441342
Float(x)
13451343
} else {
13461344
// FIXME(#31407) this is only necessary because float parsing is buggy
13471345
sess.span_bug(span, "could not evaluate float literal (see issue #31407)");
13481346
}
13491347
}
1350-
ast::LitBool(b) => Bool(b)
1348+
ast::LitKind::Bool(b) => Bool(b)
13511349
}
13521350
}
13531351

src/librustc/middle/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use middle::ty::{self, Ty, TypeFoldable};
1717

1818
use std::fmt;
1919

20-
use syntax::abi::RustIntrinsic;
20+
use syntax::abi::Abi::RustIntrinsic;
2121
use syntax::ast;
2222
use syntax::codemap::Span;
2323
use rustc_front::intravisit::{self, Visitor, FnKind};

src/librustc/middle/reachable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use session::config;
2525
use util::nodemap::NodeSet;
2626

2727
use std::collections::HashSet;
28-
use syntax::abi;
28+
use syntax::abi::Abi;
2929
use syntax::ast;
3030
use syntax::attr;
3131
use rustc_front::hir;
@@ -236,7 +236,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
236236
// participate in linkage after this product is produced)
237237
if let ast_map::NodeItem(item) = *node {
238238
if let hir::ItemFn(_, _, _, abi, _, _) = item.node {
239-
if abi != abi::Rust {
239+
if abi != Abi::Rust {
240240
self.reachable_symbols.insert(search_item);
241241
}
242242
}

src/librustc/middle/traits/select.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use middle::ty::relate::TypeRelation;
4646
use std::cell::RefCell;
4747
use std::fmt;
4848
use std::rc::Rc;
49-
use syntax::abi;
49+
use syntax::abi::Abi;
5050
use rustc_front::hir;
5151
use util::common::ErrorReported;
5252
use util::nodemap::FnvHashMap;
@@ -1288,7 +1288,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12881288
// provide an impl, but only for suitable `fn` pointers
12891289
ty::TyBareFn(_, &ty::BareFnTy {
12901290
unsafety: hir::Unsafety::Normal,
1291-
abi: abi::Rust,
1291+
abi: Abi::Rust,
12921292
sig: ty::Binder(ty::FnSig {
12931293
inputs: _,
12941294
output: ty::FnConverging(_),

src/librustc/middle/ty/contents.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'tcx> ty::TyS<'tcx> {
180180

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

src/librustc/middle/ty/context.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use std::borrow::Borrow;
4444
use std::cell::{Cell, RefCell, Ref};
4545
use std::hash::{Hash, Hasher};
4646
use std::rc::Rc;
47-
use syntax::abi;
47+
use syntax::abi::Abi;
4848
use syntax::ast::{self, Name, NodeId};
4949
use syntax::attr;
5050
use syntax::parse::token::special_idents;
@@ -192,18 +192,18 @@ impl<'tcx> CommonTypes<'tcx> {
192192
bool: mk(TyBool),
193193
char: mk(TyChar),
194194
err: mk(TyError),
195-
isize: mk(TyInt(ast::TyIs)),
196-
i8: mk(TyInt(ast::TyI8)),
197-
i16: mk(TyInt(ast::TyI16)),
198-
i32: mk(TyInt(ast::TyI32)),
199-
i64: mk(TyInt(ast::TyI64)),
200-
usize: mk(TyUint(ast::TyUs)),
201-
u8: mk(TyUint(ast::TyU8)),
202-
u16: mk(TyUint(ast::TyU16)),
203-
u32: mk(TyUint(ast::TyU32)),
204-
u64: mk(TyUint(ast::TyU64)),
205-
f32: mk(TyFloat(ast::TyF32)),
206-
f64: mk(TyFloat(ast::TyF64)),
195+
isize: mk(TyInt(ast::IntTy::Is)),
196+
i8: mk(TyInt(ast::IntTy::I8)),
197+
i16: mk(TyInt(ast::IntTy::I16)),
198+
i32: mk(TyInt(ast::IntTy::I32)),
199+
i64: mk(TyInt(ast::IntTy::I64)),
200+
usize: mk(TyUint(ast::UintTy::Us)),
201+
u8: mk(TyUint(ast::UintTy::U8)),
202+
u16: mk(TyUint(ast::UintTy::U16)),
203+
u32: mk(TyUint(ast::UintTy::U32)),
204+
u64: mk(TyUint(ast::UintTy::U64)),
205+
f32: mk(TyFloat(ast::FloatTy::F32)),
206+
f64: mk(TyFloat(ast::FloatTy::F64)),
207207
}
208208
}
209209
}
@@ -840,28 +840,28 @@ impl<'tcx> ctxt<'tcx> {
840840

841841
pub fn mk_mach_int(&self, tm: ast::IntTy) -> Ty<'tcx> {
842842
match tm {
843-
ast::TyIs => self.types.isize,
844-
ast::TyI8 => self.types.i8,
845-
ast::TyI16 => self.types.i16,
846-
ast::TyI32 => self.types.i32,
847-
ast::TyI64 => self.types.i64,
843+
ast::IntTy::Is => self.types.isize,
844+
ast::IntTy::I8 => self.types.i8,
845+
ast::IntTy::I16 => self.types.i16,
846+
ast::IntTy::I32 => self.types.i32,
847+
ast::IntTy::I64 => self.types.i64,
848848
}
849849
}
850850

851851
pub fn mk_mach_uint(&self, tm: ast::UintTy) -> Ty<'tcx> {
852852
match tm {
853-
ast::TyUs => self.types.usize,
854-
ast::TyU8 => self.types.u8,
855-
ast::TyU16 => self.types.u16,
856-
ast::TyU32 => self.types.u32,
857-
ast::TyU64 => self.types.u64,
853+
ast::UintTy::Us => self.types.usize,
854+
ast::UintTy::U8 => self.types.u8,
855+
ast::UintTy::U16 => self.types.u16,
856+
ast::UintTy::U32 => self.types.u32,
857+
ast::UintTy::U64 => self.types.u64,
858858
}
859859
}
860860

861861
pub fn mk_mach_float(&self, tm: ast::FloatTy) -> Ty<'tcx> {
862862
match tm {
863-
ast::TyF32 => self.types.f32,
864-
ast::TyF64 => self.types.f64,
863+
ast::FloatTy::F32 => self.types.f32,
864+
ast::FloatTy::F64 => self.types.f64,
865865
}
866866
}
867867

@@ -943,7 +943,7 @@ impl<'tcx> ctxt<'tcx> {
943943
let input_args = input_tys.iter().cloned().collect();
944944
self.mk_fn(Some(def_id), self.mk_bare_fn(BareFnTy {
945945
unsafety: hir::Unsafety::Normal,
946-
abi: abi::Rust,
946+
abi: Abi::Rust,
947947
sig: ty::Binder(ty::FnSig {
948948
inputs: input_args,
949949
output: ty::FnConverging(output),

src/librustc/middle/ty/relate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ impl<'a,'tcx:'a> Relate<'a,'tcx> for ty::TypeAndMut<'tcx> {
105105
} else {
106106
let mutbl = a.mutbl;
107107
let variance = match mutbl {
108-
ast::MutImmutable => ty::Covariant,
109-
ast::MutMutable => ty::Invariant,
108+
ast::Mutability::MutImmutable => ty::Covariant,
109+
ast::Mutability::MutMutable => ty::Invariant,
110110
};
111111
let ty = try!(relation.relate_with_variance(variance, &a.ty, &b.ty));
112112
Ok(ty::TypeAndMut {ty: ty, mutbl: mutbl})

src/librustc/middle/ty/sty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ impl<'tcx> TyS<'tcx> {
977977
pub fn sequence_element_type(&self, cx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
978978
match self.sty {
979979
TyArray(ty, _) | TySlice(ty) => ty,
980-
TyStr => cx.mk_mach_uint(ast::TyU8),
980+
TyStr => cx.mk_mach_uint(ast::UintTy::U8),
981981
_ => cx.sess.bug(&format!("sequence_element_type called on non-sequence value: {}",
982982
self)),
983983
}
@@ -1068,7 +1068,7 @@ impl<'tcx> TyS<'tcx> {
10681068

10691069
pub fn is_uint(&self) -> bool {
10701070
match self.sty {
1071-
TyInfer(IntVar(_)) | TyUint(ast::TyUs) => true,
1071+
TyInfer(IntVar(_)) | TyUint(ast::UintTy::Us) => true,
10721072
_ => false
10731073
}
10741074
}
@@ -1114,7 +1114,7 @@ impl<'tcx> TyS<'tcx> {
11141114

11151115
pub fn is_machine(&self) -> bool {
11161116
match self.sty {
1117-
TyInt(ast::TyIs) | TyUint(ast::TyUs) => false,
1117+
TyInt(ast::IntTy::Is) | TyUint(ast::UintTy::Us) => false,
11181118
TyInt(..) | TyUint(..) | TyFloat(..) => true,
11191119
_ => false
11201120
}

0 commit comments

Comments
 (0)