Rename ExprKind::Vec to Array in HIR and HAIR.
This is a clearer name since they represent [a, b, c] array literals.
This commit is contained in:
parent
ff591b6dc0
commit
a9f8f98caa
14 changed files with 17 additions and 17 deletions
|
@ -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) => {
|
||||
|
|
|
@ -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 { .. } |
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -60,7 +60,7 @@ impl Category {
|
|||
ExprKind::Call { .. } =>
|
||||
Some(Category::Rvalue(RvalueFunc::Into)),
|
||||
|
||||
ExprKind::Vec { .. } |
|
||||
ExprKind::Array { .. } |
|
||||
ExprKind::Tuple { .. } |
|
||||
ExprKind::Adt { .. } |
|
||||
ExprKind::Closure { .. } |
|
||||
|
|
|
@ -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 { .. } |
|
||||
|
|
|
@ -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() },
|
||||
};
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ pub enum ExprKind<'tcx> {
|
|||
value: ExprRef<'tcx>,
|
||||
count: TypedConstVal<'tcx>,
|
||||
},
|
||||
Vec {
|
||||
Array {
|
||||
fields: Vec<ExprRef<'tcx>>,
|
||||
},
|
||||
Tuple {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"]),
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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()?;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue