Skip to content

Commit a9f8f98

Browse files
committed
Rename ExprKind::Vec to Array in HIR and HAIR.
This is a clearer name since they represent [a, b, c] array literals.
1 parent ff591b6 commit a9f8f98

File tree

14 files changed

+17
-17
lines changed

14 files changed

+17
-17
lines changed

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ impl<'a> LoweringContext<'a> {
13821382
return self.expr_block(P(block), e.attrs.clone());
13831383
}
13841384

1385-
ExprKind::Vec(ref exprs) => {
1385+
ExprKind::Array(ref exprs) => {
13861386
hir::ExprArray(exprs.iter().map(|x| self.lower_expr(x)).collect())
13871387
}
13881388
ExprKind::Repeat(ref expr, ref count) => {

src/librustc_mir/build/expr/as_lvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
8787
block.and(Lvalue::Static(id))
8888
}
8989

90-
ExprKind::Vec { .. } |
90+
ExprKind::Array { .. } |
9191
ExprKind::Tuple { .. } |
9292
ExprKind::Adt { .. } |
9393
ExprKind::Closure { .. } |

src/librustc_mir/build/expr/as_rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
132132
let source = unpack!(block = this.as_operand(block, source));
133133
block.and(Rvalue::Cast(CastKind::Unsize, source, expr.ty))
134134
}
135-
ExprKind::Vec { fields } => {
135+
ExprKind::Array { fields } => {
136136
// (*) We would (maybe) be closer to trans if we
137137
// handled this and other aggregate cases via
138138
// `into()`, not `as_rvalue` -- in that case, instead

src/librustc_mir/build/expr/category.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Category {
6060
ExprKind::Call { .. } =>
6161
Some(Category::Rvalue(RvalueFunc::Into)),
6262

63-
ExprKind::Vec { .. } |
63+
ExprKind::Array { .. } |
6464
ExprKind::Tuple { .. } |
6565
ExprKind::Adt { .. } |
6666
ExprKind::Closure { .. } |

src/librustc_mir/build/expr/into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
256256
ExprKind::VarRef { .. } |
257257
ExprKind::SelfRef |
258258
ExprKind::StaticRef { .. } |
259-
ExprKind::Vec { .. } |
259+
ExprKind::Array { .. } |
260260
ExprKind::Tuple { .. } |
261261
ExprKind::Adt { .. } |
262262
ExprKind::Closure { .. } |

src/librustc_mir/hair/cx/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
664664
value_extents: cx.tcx.region_maps.node_extent(value.id),
665665
}
666666
}
667-
hir::ExprArray(ref fields) => ExprKind::Vec { fields: fields.to_ref() },
667+
hir::ExprArray(ref fields) => ExprKind::Array { fields: fields.to_ref() },
668668
hir::ExprTup(ref fields) => ExprKind::Tuple { fields: fields.to_ref() },
669669
};
670670

src/librustc_mir/hair/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub enum ExprKind<'tcx> {
214214
value: ExprRef<'tcx>,
215215
count: TypedConstVal<'tcx>,
216216
},
217-
Vec {
217+
Array {
218218
fields: Vec<ExprRef<'tcx>>,
219219
},
220220
Tuple {

src/libsyntax/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ pub enum ExprKind {
864864
/// First expr is the place; second expr is the value.
865865
InPlace(P<Expr>, P<Expr>),
866866
/// An array (`[a, b, c, d]`)
867-
Vec(Vec<P<Expr>>),
867+
Array(Vec<P<Expr>>),
868868
/// A function call
869869
///
870870
/// The first field resolves to the function itself,

src/libsyntax/ext/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
745745
}
746746

747747
fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
748-
self.expr(sp, ast::ExprKind::Vec(exprs))
748+
self.expr(sp, ast::ExprKind::Array(exprs))
749749
}
750750
fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr> {
751751
self.expr_call_global(sp, self.std_path(&["vec", "Vec", "new"]),

src/libsyntax/fold.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,8 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
11231123
ExprKind::InPlace(p, e) => {
11241124
ExprKind::InPlace(folder.fold_expr(p), folder.fold_expr(e))
11251125
}
1126-
ExprKind::Vec(exprs) => {
1127-
ExprKind::Vec(folder.fold_exprs(exprs))
1126+
ExprKind::Array(exprs) => {
1127+
ExprKind::Array(folder.fold_exprs(exprs))
11281128
}
11291129
ExprKind::Repeat(expr, count) => {
11301130
ExprKind::Repeat(folder.fold_expr(expr), folder.fold_expr(count))

src/libsyntax/parse/parser.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,7 @@ impl<'a> Parser<'a> {
21402140
if self.check(&token::CloseDelim(token::Bracket)) {
21412141
// Empty vector.
21422142
self.bump();
2143-
ex = ExprKind::Vec(Vec::new());
2143+
ex = ExprKind::Array(Vec::new());
21442144
} else {
21452145
// Nonempty vector.
21462146
let first_expr = self.parse_expr()?;
@@ -2160,11 +2160,11 @@ impl<'a> Parser<'a> {
21602160
)?;
21612161
let mut exprs = vec![first_expr];
21622162
exprs.extend(remaining_exprs);
2163-
ex = ExprKind::Vec(exprs);
2163+
ex = ExprKind::Array(exprs);
21642164
} else {
21652165
// Vector with one element.
21662166
self.expect(&token::CloseDelim(token::Bracket))?;
2167-
ex = ExprKind::Vec(vec![first_expr]);
2167+
ex = ExprKind::Array(vec![first_expr]);
21682168
}
21692169
}
21702170
hi = self.prev_span.hi;

src/libsyntax/print/pprust.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ impl<'a> State<'a> {
20182018
ast::ExprKind::InPlace(ref place, ref expr) => {
20192019
self.print_expr_in_place(place, expr)?;
20202020
}
2021-
ast::ExprKind::Vec(ref exprs) => {
2021+
ast::ExprKind::Array(ref exprs) => {
20222022
self.print_expr_vec(&exprs[..], attrs)?;
20232023
}
20242024
ast::ExprKind::Repeat(ref element, ref count) => {

src/libsyntax/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ fn mk_test_descs(cx: &TestCtxt) -> P<ast::Expr> {
628628
node: ast::ExprKind::AddrOf(ast::Mutability::Immutable,
629629
P(ast::Expr {
630630
id: ast::DUMMY_NODE_ID,
631-
node: ast::ExprKind::Vec(cx.testfns.iter().map(|test| {
631+
node: ast::ExprKind::Array(cx.testfns.iter().map(|test| {
632632
mk_test_desc_and_fn_rec(cx, test)
633633
}).collect()),
634634
span: DUMMY_SP,

src/libsyntax/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
650650
visitor.visit_expr(place);
651651
visitor.visit_expr(subexpression)
652652
}
653-
ExprKind::Vec(ref subexpressions) => {
653+
ExprKind::Array(ref subexpressions) => {
654654
walk_list!(visitor, visit_expr, subexpressions);
655655
}
656656
ExprKind::Repeat(ref element, ref count) => {

0 commit comments

Comments
 (0)