Skip to content

Rename ExprKind::Vec to Array in HIR and HAIR. #39090

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

Merged
merged 1 commit into from
Jan 17, 2017
Merged
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
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ impl<'a> LoweringContext<'a> {
return self.expr_block(P(block), e.attrs.clone());
}

ExprKind::Vec(ref exprs) => {
ExprKind::Array(ref exprs) => {
hir::ExprArray(exprs.iter().map(|x| self.lower_expr(x)).collect())
}
ExprKind::Repeat(ref expr, ref count) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/expr/as_lvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
block.and(Lvalue::Static(id))
}

ExprKind::Vec { .. } |
ExprKind::Array { .. } |
ExprKind::Tuple { .. } |
ExprKind::Adt { .. } |
ExprKind::Closure { .. } |
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
let source = unpack!(block = this.as_operand(block, source));
block.and(Rvalue::Cast(CastKind::Unsize, source, expr.ty))
}
ExprKind::Vec { fields } => {
ExprKind::Array { fields } => {
// (*) We would (maybe) be closer to trans if we
// handled this and other aggregate cases via
// `into()`, not `as_rvalue` -- in that case, instead
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/expr/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Category {
ExprKind::Call { .. } =>
Some(Category::Rvalue(RvalueFunc::Into)),

ExprKind::Vec { .. } |
ExprKind::Array { .. } |
ExprKind::Tuple { .. } |
ExprKind::Adt { .. } |
ExprKind::Closure { .. } |
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/expr/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
ExprKind::VarRef { .. } |
ExprKind::SelfRef |
ExprKind::StaticRef { .. } |
ExprKind::Vec { .. } |
ExprKind::Array { .. } |
ExprKind::Tuple { .. } |
ExprKind::Adt { .. } |
ExprKind::Closure { .. } |
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
value_extents: cx.tcx.region_maps.node_extent(value.id),
}
}
hir::ExprArray(ref fields) => ExprKind::Vec { fields: fields.to_ref() },
hir::ExprArray(ref fields) => ExprKind::Array { fields: fields.to_ref() },
hir::ExprTup(ref fields) => ExprKind::Tuple { fields: fields.to_ref() },
};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ pub enum ExprKind<'tcx> {
value: ExprRef<'tcx>,
count: TypedConstVal<'tcx>,
},
Vec {
Array {
fields: Vec<ExprRef<'tcx>>,
},
Tuple {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ pub enum ExprKind {
/// First expr is the place; second expr is the value.
InPlace(P<Expr>, P<Expr>),
/// An array (`[a, b, c, d]`)
Vec(Vec<P<Expr>>),
Array(Vec<P<Expr>>),
/// A function call
///
/// The first field resolves to the function itself,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
}

fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Vec(exprs))
self.expr(sp, ast::ExprKind::Array(exprs))
}
fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr> {
self.expr_call_global(sp, self.std_path(&["vec", "Vec", "new"]),
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
ExprKind::InPlace(p, e) => {
ExprKind::InPlace(folder.fold_expr(p), folder.fold_expr(e))
}
ExprKind::Vec(exprs) => {
ExprKind::Vec(folder.fold_exprs(exprs))
ExprKind::Array(exprs) => {
ExprKind::Array(folder.fold_exprs(exprs))
}
ExprKind::Repeat(expr, count) => {
ExprKind::Repeat(folder.fold_expr(expr), folder.fold_expr(count))
Expand Down
6 changes: 3 additions & 3 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ impl<'a> Parser<'a> {
if self.check(&token::CloseDelim(token::Bracket)) {
// Empty vector.
self.bump();
ex = ExprKind::Vec(Vec::new());
ex = ExprKind::Array(Vec::new());
} else {
// Nonempty vector.
let first_expr = self.parse_expr()?;
Expand All @@ -2160,11 +2160,11 @@ impl<'a> Parser<'a> {
)?;
let mut exprs = vec![first_expr];
exprs.extend(remaining_exprs);
ex = ExprKind::Vec(exprs);
ex = ExprKind::Array(exprs);
} else {
// Vector with one element.
self.expect(&token::CloseDelim(token::Bracket))?;
ex = ExprKind::Vec(vec![first_expr]);
ex = ExprKind::Array(vec![first_expr]);
}
}
hi = self.prev_span.hi;
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ impl<'a> State<'a> {
ast::ExprKind::InPlace(ref place, ref expr) => {
self.print_expr_in_place(place, expr)?;
}
ast::ExprKind::Vec(ref exprs) => {
ast::ExprKind::Array(ref exprs) => {
self.print_expr_vec(&exprs[..], attrs)?;
}
ast::ExprKind::Repeat(ref element, ref count) => {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ fn mk_test_descs(cx: &TestCtxt) -> P<ast::Expr> {
node: ast::ExprKind::AddrOf(ast::Mutability::Immutable,
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::Vec(cx.testfns.iter().map(|test| {
node: ast::ExprKind::Array(cx.testfns.iter().map(|test| {
mk_test_desc_and_fn_rec(cx, test)
}).collect()),
span: DUMMY_SP,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
visitor.visit_expr(place);
visitor.visit_expr(subexpression)
}
ExprKind::Vec(ref subexpressions) => {
ExprKind::Array(ref subexpressions) => {
walk_list!(visitor, visit_expr, subexpressions);
}
ExprKind::Repeat(ref element, ref count) => {
Expand Down