Permalink
Browse files

Auto merge of #36857 - Manishearth:syntax-rollup, r=<try>

Syntax breaking batch

None
  • Loading branch information...
2 parents 50932b5 + 173ebc3 commit 14b30b0cc144506020547c6465d50c8fd4cab0bd @bors bors committed on GitHub Sep 30, 2016
Showing with 514 additions and 174 deletions.
  1. +2 −2 src/librustc/cfg/construct.rs
  2. +4 −4 src/librustc/hir/intravisit.rs
  3. +21 −20 src/librustc/hir/lowering.rs
  4. +2 −2 src/librustc/hir/map/def_collector.rs
  5. +7 −7 src/librustc/hir/mod.rs
  6. +1 −1 src/librustc/hir/pat_util.rs
  7. +4 −4 src/librustc/hir/print.rs
  8. +5 −5 src/librustc/infer/error_reporting.rs
  9. +1 −1 src/librustc/middle/expr_use_visitor.rs
  10. +3 −3 src/librustc/middle/liveness.rs
  11. +2 −2 src/librustc/middle/mem_categorization.rs
  12. +2 −2 src/librustc/middle/region.rs
  13. +5 −7 src/librustc/mir/repr.rs
  14. +1 −1 src/librustc/mir/tcx.rs
  15. +1 −1 src/librustc/mir/visit.rs
  16. +0 −27 src/librustc/ty/error.rs
  17. +2 −2 src/librustc/ty/fast_reject.rs
  18. +1 −1 src/librustc/ty/mod.rs
  19. +0 −7 src/librustc/ty/structural_impls.rs
  20. +9 −9 src/librustc_const_eval/check_match.rs
  21. +4 −4 src/librustc_const_eval/eval.rs
  22. +2 −2 src/librustc_incremental/calculate_svh/svh_visitor.rs
  23. +1 −1 src/librustc_mir/build/expr/as_rvalue.rs
  24. +1 −1 src/librustc_mir/hair/cx/expr.rs
  25. +1 −1 src/librustc_mir/hair/cx/pattern.rs
  26. +1 −1 src/librustc_mir/mir_map.rs
  27. +1 −1 src/librustc_passes/consts.rs
  28. +1 −1 src/librustc_trans/mir/constant.rs
  29. +2 −2 src/librustc_typeck/astconv.rs
  30. +1 −1 src/librustc_typeck/check/_match.rs
  31. +4 −4 src/librustc_typeck/check/mod.rs
  32. +1 −1 src/librustc_typeck/check/writeback.rs
  33. +3 −3 src/librustdoc/clean/mod.rs
  34. +8 −6 src/libsyntax/ast.rs
  35. +1 −1 src/libsyntax/diagnostics/plugin.rs
  36. +10 −4 src/libsyntax/ext/build.rs
  37. +23 −2 src/libsyntax/feature_gate.rs
  38. +16 −6 src/libsyntax/fold.rs
  39. +56 −12 src/libsyntax/parse/parser.rs
  40. +3 −3 src/libsyntax/print/pprust.rs
  41. +1 −1 src/libsyntax/test.rs
  42. +5 −3 src/libsyntax/visit.rs
  43. +1 −1 src/libsyntax_ext/deriving/generic/mod.rs
  44. +4 −3 src/libsyntax_ext/deriving/generic/ty.rs
  45. +1 −1 src/libsyntax_ext/format.rs
  46. +75 −0 src/test/compile-fail/attr-on-generic-formals-are-visited.rs
  47. +76 −0 src/test/compile-fail/attr-on-generic-formals-wo-feature-gate.rs
  48. +26 −0 src/test/compile-fail/attrs-with-no-formal-in-generics-1.rs
  49. +26 −0 src/test/compile-fail/attrs-with-no-formal-in-generics-2.rs
  50. +26 −0 src/test/compile-fail/attrs-with-no-formal-in-generics-3.rs
  51. +60 −0 src/test/run-pass/attr-on-generic-formals.rs
@@ -126,7 +126,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
self.add_ast_node(pat.id, &[pats_exit])
}
- PatKind::Vec(ref pre, ref vec, ref post) => {
+ PatKind::Slice(ref pre, ref vec, ref post) => {
let pre_exit = self.pats_all(pre.iter(), pred);
let vec_exit = self.pats_all(vec.iter(), pre_exit);
let post_exit = self.pats_all(post.iter(), vec_exit);
@@ -298,7 +298,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
self.add_unreachable_node()
}
- hir::ExprVec(ref elems) => {
+ hir::ExprArray(ref elems) => {
self.straightline(expr, pred, elems.iter().map(|e| &**e))
}
@@ -394,7 +394,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
visitor.visit_id(typ.id);
match typ.node {
- TyVec(ref ty) => {
+ TySlice(ref ty) => {
visitor.visit_ty(ty)
}
TyPtr(ref mutable_type) => {
@@ -422,7 +422,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
visitor.visit_ty(ty);
walk_list!(visitor, visit_ty_param_bound, bounds);
}
- TyFixedLengthVec(ref ty, ref expression) => {
+ TyArray(ref ty, ref expression) => {
visitor.visit_ty(ty);
visitor.visit_expr(expression)
}
@@ -520,7 +520,7 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) {
visitor.visit_expr(upper_bound)
}
PatKind::Wild => (),
- PatKind::Vec(ref prepatterns, ref slice_pattern, ref postpatterns) => {
+ PatKind::Slice(ref prepatterns, ref slice_pattern, ref postpatterns) => {
walk_list!(visitor, visit_pat, prepatterns);
walk_list!(visitor, visit_pat, slice_pattern);
walk_list!(visitor, visit_pat, postpatterns);
@@ -749,7 +749,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
ExprBox(ref subexpression) => {
visitor.visit_expr(subexpression)
}
- ExprVec(ref subexpressions) => {
+ ExprArray(ref subexpressions) => {
walk_list!(visitor, visit_expr, subexpressions);
}
ExprRepeat(ref element, ref count) => {
@@ -222,30 +222,31 @@ impl<'a> LoweringContext<'a> {
}
fn lower_ty(&mut self, t: &Ty) -> P<hir::Ty> {
- use syntax::ast::TyKind::*;
P(hir::Ty {
id: t.id,
node: match t.node {
- Infer | ImplicitSelf => hir::TyInfer,
- Vec(ref ty) => hir::TyVec(self.lower_ty(ty)),
- Ptr(ref mt) => hir::TyPtr(self.lower_mt(mt)),
- Rptr(ref region, ref mt) => {
+ TyKind::Infer | TyKind::ImplicitSelf => hir::TyInfer,
+ TyKind::Slice(ref ty) => hir::TySlice(self.lower_ty(ty)),
+ TyKind::Ptr(ref mt) => hir::TyPtr(self.lower_mt(mt)),
+ TyKind::Rptr(ref region, ref mt) => {
hir::TyRptr(self.lower_opt_lifetime(region), self.lower_mt(mt))
}
- BareFn(ref f) => {
+ TyKind::BareFn(ref f) => {
hir::TyBareFn(P(hir::BareFnTy {
lifetimes: self.lower_lifetime_defs(&f.lifetimes),
unsafety: self.lower_unsafety(f.unsafety),
abi: f.abi,
decl: self.lower_fn_decl(&f.decl),
}))
}
- Never => hir::TyNever,
- Tup(ref tys) => hir::TyTup(tys.iter().map(|ty| self.lower_ty(ty)).collect()),
- Paren(ref ty) => {
+ TyKind::Never => hir::TyNever,
+ TyKind::Tup(ref tys) => {
+ hir::TyTup(tys.iter().map(|ty| self.lower_ty(ty)).collect())
+ }
+ TyKind::Paren(ref ty) => {
return self.lower_ty(ty);
}
- Path(ref qself, ref path) => {
+ TyKind::Path(ref qself, ref path) => {
let qself = qself.as_ref().map(|&QSelf { ref ty, position }| {
hir::QSelf {
ty: self.lower_ty(ty),
@@ -254,22 +255,22 @@ impl<'a> LoweringContext<'a> {
});
hir::TyPath(qself, self.lower_path(path))
}
- ObjectSum(ref ty, ref bounds) => {
+ TyKind::ObjectSum(ref ty, ref bounds) => {
hir::TyObjectSum(self.lower_ty(ty), self.lower_bounds(bounds))
}
- FixedLengthVec(ref ty, ref e) => {
- hir::TyFixedLengthVec(self.lower_ty(ty), self.lower_expr(e))
+ TyKind::Array(ref ty, ref e) => {
+ hir::TyArray(self.lower_ty(ty), self.lower_expr(e))
}
- Typeof(ref expr) => {
+ TyKind::Typeof(ref expr) => {
hir::TyTypeof(self.lower_expr(expr))
}
- PolyTraitRef(ref bounds) => {
+ TyKind::PolyTraitRef(ref bounds) => {
hir::TyPolyTraitRef(self.lower_bounds(bounds))
}
- ImplTrait(ref bounds) => {
+ TyKind::ImplTrait(ref bounds) => {
hir::TyImplTrait(self.lower_bounds(bounds))
}
- Mac(_) => panic!("TyMac should have been expanded by now."),
+ TyKind::Mac(_) => panic!("TyMac should have been expanded by now."),
},
span: t.span,
})
@@ -891,8 +892,8 @@ impl<'a> LoweringContext<'a> {
PatKind::Range(ref e1, ref e2) => {
hir::PatKind::Range(self.lower_expr(e1), self.lower_expr(e2))
}
- PatKind::Vec(ref before, ref slice, ref after) => {
- hir::PatKind::Vec(before.iter().map(|x| self.lower_pat(x)).collect(),
+ PatKind::Slice(ref before, ref slice, ref after) => {
+ hir::PatKind::Slice(before.iter().map(|x| self.lower_pat(x)).collect(),
slice.as_ref().map(|x| self.lower_pat(x)),
after.iter().map(|x| self.lower_pat(x)).collect())
}
@@ -1031,7 +1032,7 @@ impl<'a> LoweringContext<'a> {
}
ExprKind::Vec(ref exprs) => {
- hir::ExprVec(exprs.iter().map(|x| self.lower_expr(x)).collect())
+ hir::ExprArray(exprs.iter().map(|x| self.lower_expr(x)).collect())
}
ExprKind::Repeat(ref expr, ref count) => {
let expr = self.lower_expr(expr);
@@ -286,7 +286,7 @@ impl<'a> visit::Visitor for DefCollector<'a> {
fn visit_ty(&mut self, ty: &Ty) {
match ty.node {
TyKind::Mac(..) => return self.visit_macro_invoc(ty.id, false),
- TyKind::FixedLengthVec(_, ref length) => self.visit_ast_const_integer(length),
+ TyKind::Array(_, ref length) => self.visit_ast_const_integer(length),
TyKind::ImplTrait(..) => {
self.create_def(ty.id, DefPathData::ImplTrait);
}
@@ -448,7 +448,7 @@ impl<'ast> intravisit::Visitor<'ast> for DefCollector<'ast> {
}
fn visit_ty(&mut self, ty: &'ast hir::Ty) {
- if let hir::TyFixedLengthVec(_, ref length) = ty.node {
+ if let hir::TyArray(_, ref length) = ty.node {
self.visit_hir_const_integer(length);
}
if let hir::TyImplTrait(..) = ty.node {
@@ -478,7 +478,7 @@ impl Pat {
PatKind::Box(ref s) | PatKind::Ref(ref s, _) => {
s.walk_(it)
}
- PatKind::Vec(ref before, ref slice, ref after) => {
+ PatKind::Slice(ref before, ref slice, ref after) => {
before.iter().all(|p| p.walk_(it)) &&
slice.iter().all(|p| p.walk_(it)) &&
after.iter().all(|p| p.walk_(it))
@@ -554,8 +554,8 @@ pub enum PatKind {
/// A range pattern, e.g. `1...2`
Range(P<Expr>, P<Expr>),
/// `[a, b, ..i, y, z]` is represented as:
- /// `PatKind::Vec(box [a, b], Some(i), box [y, z])`
- Vec(HirVec<P<Pat>>, Option<P<Pat>>, HirVec<P<Pat>>),
+ /// `PatKind::Slice(box [a, b], Some(i), box [y, z])`
+ Slice(HirVec<P<Pat>>, Option<P<Pat>>, HirVec<P<Pat>>),
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
@@ -826,7 +826,7 @@ pub enum Expr_ {
/// A `box x` expression.
ExprBox(P<Expr>),
/// An array (`[a, b, c, d]`)
- ExprVec(HirVec<P<Expr>>),
+ ExprArray(HirVec<P<Expr>>),
/// A function call
///
/// The first field resolves to the function itself (usually an `ExprPath`),
@@ -1080,10 +1080,10 @@ pub struct BareFnTy {
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
/// The different kinds of types recognized by the compiler
pub enum Ty_ {
- /// A variable length array (`[T]`)
- TyVec(P<Ty>),
+ /// A variable length slice (`[T]`)
+ TySlice(P<Ty>),
/// A fixed length array (`[T; n]`)
- TyFixedLengthVec(P<Ty>, P<Expr>),
+ TyArray(P<Ty>, P<Expr>),
/// A raw pointer (`*const T` or `*mut T`)
TyPtr(MutTy),
/// A reference (`&'a T` or `&'a mut T`)
@@ -62,7 +62,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
_ => false
}
}
- PatKind::Vec(..) => true,
+ PatKind::Slice(..) => true,
_ => false
}
}
@@ -486,7 +486,7 @@ impl<'a> State<'a> {
self.maybe_print_comment(ty.span.lo)?;
self.ibox(0)?;
match ty.node {
- hir::TyVec(ref ty) => {
+ hir::TySlice(ref ty) => {
word(&mut self.s, "[")?;
self.print_type(&ty)?;
word(&mut self.s, "]")?;
@@ -543,7 +543,7 @@ impl<'a> State<'a> {
hir::TyImplTrait(ref bounds) => {
self.print_bounds("impl ", &bounds[..])?;
}
- hir::TyFixedLengthVec(ref ty, ref v) => {
+ hir::TyArray(ref ty, ref v) => {
word(&mut self.s, "[")?;
self.print_type(&ty)?;
word(&mut self.s, "; ")?;
@@ -1319,7 +1319,7 @@ impl<'a> State<'a> {
self.word_space("box")?;
self.print_expr(expr)?;
}
- hir::ExprVec(ref exprs) => {
+ hir::ExprArray(ref exprs) => {
self.print_expr_vec(&exprs[..])?;
}
hir::ExprRepeat(ref element, ref count) => {
@@ -1829,7 +1829,7 @@ impl<'a> State<'a> {
word(&mut self.s, "...")?;
self.print_expr(&end)?;
}
- PatKind::Vec(ref before, ref slice, ref after) => {
+ PatKind::Slice(ref before, ref slice, ref after) => {
word(&mut self.s, "[")?;
self.commasep(Inconsistent, &before[..], |s, p| s.print_pat(&p))?;
if let Some(ref p) = *slice {
@@ -1433,8 +1433,8 @@ impl<'a, 'gcx, 'tcx> Rebuilder<'a, 'gcx, 'tcx> {
hir::TyPtr(ref mut_ty) => {
ty_queue.push(&mut_ty.ty);
}
- hir::TyVec(ref ty) |
- hir::TyFixedLengthVec(ref ty, _) => {
+ hir::TySlice(ref ty) |
+ hir::TyArray(ref ty, _) => {
ty_queue.push(&ty);
}
hir::TyTup(ref tys) => ty_queue.extend(tys.iter().map(|ty| &**ty)),
@@ -1469,9 +1469,9 @@ impl<'a, 'gcx, 'tcx> Rebuilder<'a, 'gcx, 'tcx> {
ty: build_to(mut_ty.ty, to),
})
}
- hir::TyVec(ty) => hir::TyVec(build_to(ty, to)),
- hir::TyFixedLengthVec(ty, e) => {
- hir::TyFixedLengthVec(build_to(ty, to), e)
+ hir::TySlice(ty) => hir::TySlice(build_to(ty, to)),
+ hir::TyArray(ty, e) => {
+ hir::TyArray(build_to(ty, to), e)
}
hir::TyTup(tys) => {
hir::TyTup(tys.into_iter().map(|ty| build_to(ty, to)).collect())
@@ -442,7 +442,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
}
}
- hir::ExprVec(ref exprs) => {
+ hir::ExprArray(ref exprs) => {
self.consume_exprs(exprs);
}
@@ -490,7 +490,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
// otherwise, live nodes are not required:
hir::ExprIndex(..) | hir::ExprField(..) | hir::ExprTupField(..) |
- hir::ExprVec(..) | hir::ExprCall(..) | hir::ExprMethodCall(..) |
+ hir::ExprArray(..) | hir::ExprCall(..) | hir::ExprMethodCall(..) |
hir::ExprTup(..) | hir::ExprBinary(..) | hir::ExprAddrOf(..) |
hir::ExprCast(..) | hir::ExprUnary(..) | hir::ExprBreak(_) |
hir::ExprAgain(_) | hir::ExprLit(_) | hir::ExprRet(..) |
@@ -1095,7 +1095,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
// Uninteresting cases: just propagate in rev exec order
- hir::ExprVec(ref exprs) => {
+ hir::ExprArray(ref exprs) => {
self.propagate_through_exprs(&exprs[..], succ)
}
@@ -1436,7 +1436,7 @@ fn check_expr(this: &mut Liveness, expr: &Expr) {
hir::ExprCall(..) | hir::ExprMethodCall(..) | hir::ExprIf(..) |
hir::ExprMatch(..) | hir::ExprWhile(..) | hir::ExprLoop(..) |
hir::ExprIndex(..) | hir::ExprField(..) | hir::ExprTupField(..) |
- hir::ExprVec(..) | hir::ExprTup(..) | hir::ExprBinary(..) |
+ hir::ExprArray(..) | hir::ExprTup(..) | hir::ExprBinary(..) |
hir::ExprCast(..) | hir::ExprUnary(..) | hir::ExprRet(..) |
hir::ExprBreak(..) | hir::ExprAgain(..) | hir::ExprLit(_) |
hir::ExprBlock(..) | hir::ExprAddrOf(..) |
@@ -503,7 +503,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
hir::ExprClosure(..) | hir::ExprRet(..) |
hir::ExprUnary(..) |
hir::ExprMethodCall(..) | hir::ExprCast(..) |
- hir::ExprVec(..) | hir::ExprTup(..) | hir::ExprIf(..) |
+ hir::ExprArray(..) | hir::ExprTup(..) | hir::ExprIf(..) |
hir::ExprBinary(..) | hir::ExprWhile(..) |
hir::ExprBlock(..) | hir::ExprLoop(..) | hir::ExprMatch(..) |
hir::ExprLit(..) | hir::ExprBreak(..) |
@@ -1155,7 +1155,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
self.cat_pattern_(subcmt, &subpat, op)?;
}
- PatKind::Vec(ref before, ref slice, ref after) => {
+ PatKind::Slice(ref before, ref slice, ref after) => {
let context = InteriorOffsetKind::Pattern;
let elt_cmt = self.cat_index(pat, cmt, context)?;
for before_pat in before {
@@ -961,7 +961,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor, local: &hir::Local) {
field_pats.iter().any(|fp| is_binding_pat(&fp.node.pat))
}
- PatKind::Vec(ref pats1, ref pats2, ref pats3) => {
+ PatKind::Slice(ref pats1, ref pats2, ref pats3) => {
pats1.iter().any(|p| is_binding_pat(&p)) ||
pats2.iter().any(|p| is_binding_pat(&p)) ||
pats3.iter().any(|p| is_binding_pat(&p))
@@ -1012,7 +1012,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor, local: &hir::Local) {
visitor, &field.expr, blk_id);
}
}
- hir::ExprVec(ref subexprs) |
+ hir::ExprArray(ref subexprs) |
hir::ExprTup(ref subexprs) => {
for subexpr in subexprs {
record_rvalue_scope_if_borrow_expr(
@@ -1024,7 +1024,7 @@ pub enum CastKind {
#[derive(Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub enum AggregateKind<'tcx> {
- Vec,
+ Array,
Tuple,
/// The second field is variant number (discriminant), it's equal to 0
/// for struct and union expressions. The fourth field is active field
@@ -1115,8 +1115,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
}
Aggregate(ref kind, ref lvs) => {
- use self::AggregateKind::*;
-
fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
let mut tuple_fmt = fmt.debug_tuple("");
for lv in lvs {
@@ -1126,17 +1124,17 @@ impl<'tcx> Debug for Rvalue<'tcx> {
}
match *kind {
- Vec => write!(fmt, "{:?}", lvs),
+ AggregateKind::Array => write!(fmt, "{:?}", lvs),
- Tuple => {
+ AggregateKind::Tuple => {
match lvs.len() {
0 => write!(fmt, "()"),
1 => write!(fmt, "({:?},)", lvs[0]),
_ => fmt_tuple(fmt, lvs),
}
}
- Adt(adt_def, variant, substs, _) => {
+ AggregateKind::Adt(adt_def, variant, substs, _) => {
let variant_def = &adt_def.variants[variant];
ppaux::parameterized(fmt, substs, variant_def.did,
@@ -1155,7 +1153,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
}
}
- Closure(def_id, _) => ty::tls::with(|tcx| {
+ AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| {
if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
let name = format!("[closure@{:?}]", tcx.map.span(node_id));
let mut struct_fmt = fmt.debug_struct(&name);
Oops, something went wrong.

0 comments on commit 14b30b0

Please sign in to comment.