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());
|
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())
|
hir::ExprArray(exprs.iter().map(|x| self.lower_expr(x)).collect())
|
||||||
}
|
}
|
||||||
ExprKind::Repeat(ref expr, ref count) => {
|
ExprKind::Repeat(ref expr, ref count) => {
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||||
block.and(Lvalue::Static(id))
|
block.and(Lvalue::Static(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprKind::Vec { .. } |
|
ExprKind::Array { .. } |
|
||||||
ExprKind::Tuple { .. } |
|
ExprKind::Tuple { .. } |
|
||||||
ExprKind::Adt { .. } |
|
ExprKind::Adt { .. } |
|
||||||
ExprKind::Closure { .. } |
|
ExprKind::Closure { .. } |
|
||||||
|
|
|
@ -132,7 +132,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||||
let source = unpack!(block = this.as_operand(block, source));
|
let source = unpack!(block = this.as_operand(block, source));
|
||||||
block.and(Rvalue::Cast(CastKind::Unsize, source, expr.ty))
|
block.and(Rvalue::Cast(CastKind::Unsize, source, expr.ty))
|
||||||
}
|
}
|
||||||
ExprKind::Vec { fields } => {
|
ExprKind::Array { fields } => {
|
||||||
// (*) We would (maybe) be closer to trans if we
|
// (*) We would (maybe) be closer to trans if we
|
||||||
// handled this and other aggregate cases via
|
// handled this and other aggregate cases via
|
||||||
// `into()`, not `as_rvalue` -- in that case, instead
|
// `into()`, not `as_rvalue` -- in that case, instead
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl Category {
|
||||||
ExprKind::Call { .. } =>
|
ExprKind::Call { .. } =>
|
||||||
Some(Category::Rvalue(RvalueFunc::Into)),
|
Some(Category::Rvalue(RvalueFunc::Into)),
|
||||||
|
|
||||||
ExprKind::Vec { .. } |
|
ExprKind::Array { .. } |
|
||||||
ExprKind::Tuple { .. } |
|
ExprKind::Tuple { .. } |
|
||||||
ExprKind::Adt { .. } |
|
ExprKind::Adt { .. } |
|
||||||
ExprKind::Closure { .. } |
|
ExprKind::Closure { .. } |
|
||||||
|
|
|
@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||||
ExprKind::VarRef { .. } |
|
ExprKind::VarRef { .. } |
|
||||||
ExprKind::SelfRef |
|
ExprKind::SelfRef |
|
||||||
ExprKind::StaticRef { .. } |
|
ExprKind::StaticRef { .. } |
|
||||||
ExprKind::Vec { .. } |
|
ExprKind::Array { .. } |
|
||||||
ExprKind::Tuple { .. } |
|
ExprKind::Tuple { .. } |
|
||||||
ExprKind::Adt { .. } |
|
ExprKind::Adt { .. } |
|
||||||
ExprKind::Closure { .. } |
|
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),
|
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() },
|
hir::ExprTup(ref fields) => ExprKind::Tuple { fields: fields.to_ref() },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ pub enum ExprKind<'tcx> {
|
||||||
value: ExprRef<'tcx>,
|
value: ExprRef<'tcx>,
|
||||||
count: TypedConstVal<'tcx>,
|
count: TypedConstVal<'tcx>,
|
||||||
},
|
},
|
||||||
Vec {
|
Array {
|
||||||
fields: Vec<ExprRef<'tcx>>,
|
fields: Vec<ExprRef<'tcx>>,
|
||||||
},
|
},
|
||||||
Tuple {
|
Tuple {
|
||||||
|
|
|
@ -864,7 +864,7 @@ pub enum ExprKind {
|
||||||
/// First expr is the place; second expr is the value.
|
/// First expr is the place; second expr is the value.
|
||||||
InPlace(P<Expr>, P<Expr>),
|
InPlace(P<Expr>, P<Expr>),
|
||||||
/// An array (`[a, b, c, d]`)
|
/// An array (`[a, b, c, d]`)
|
||||||
Vec(Vec<P<Expr>>),
|
Array(Vec<P<Expr>>),
|
||||||
/// A function call
|
/// A function call
|
||||||
///
|
///
|
||||||
/// The first field resolves to the function itself,
|
/// 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> {
|
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> {
|
fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr> {
|
||||||
self.expr_call_global(sp, self.std_path(&["vec", "Vec", "new"]),
|
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(p, e) => {
|
||||||
ExprKind::InPlace(folder.fold_expr(p), folder.fold_expr(e))
|
ExprKind::InPlace(folder.fold_expr(p), folder.fold_expr(e))
|
||||||
}
|
}
|
||||||
ExprKind::Vec(exprs) => {
|
ExprKind::Array(exprs) => {
|
||||||
ExprKind::Vec(folder.fold_exprs(exprs))
|
ExprKind::Array(folder.fold_exprs(exprs))
|
||||||
}
|
}
|
||||||
ExprKind::Repeat(expr, count) => {
|
ExprKind::Repeat(expr, count) => {
|
||||||
ExprKind::Repeat(folder.fold_expr(expr), folder.fold_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)) {
|
if self.check(&token::CloseDelim(token::Bracket)) {
|
||||||
// Empty vector.
|
// Empty vector.
|
||||||
self.bump();
|
self.bump();
|
||||||
ex = ExprKind::Vec(Vec::new());
|
ex = ExprKind::Array(Vec::new());
|
||||||
} else {
|
} else {
|
||||||
// Nonempty vector.
|
// Nonempty vector.
|
||||||
let first_expr = self.parse_expr()?;
|
let first_expr = self.parse_expr()?;
|
||||||
|
@ -2160,11 +2160,11 @@ impl<'a> Parser<'a> {
|
||||||
)?;
|
)?;
|
||||||
let mut exprs = vec![first_expr];
|
let mut exprs = vec![first_expr];
|
||||||
exprs.extend(remaining_exprs);
|
exprs.extend(remaining_exprs);
|
||||||
ex = ExprKind::Vec(exprs);
|
ex = ExprKind::Array(exprs);
|
||||||
} else {
|
} else {
|
||||||
// Vector with one element.
|
// Vector with one element.
|
||||||
self.expect(&token::CloseDelim(token::Bracket))?;
|
self.expect(&token::CloseDelim(token::Bracket))?;
|
||||||
ex = ExprKind::Vec(vec![first_expr]);
|
ex = ExprKind::Array(vec![first_expr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hi = self.prev_span.hi;
|
hi = self.prev_span.hi;
|
||||||
|
|
|
@ -2018,7 +2018,7 @@ impl<'a> State<'a> {
|
||||||
ast::ExprKind::InPlace(ref place, ref expr) => {
|
ast::ExprKind::InPlace(ref place, ref expr) => {
|
||||||
self.print_expr_in_place(place, expr)?;
|
self.print_expr_in_place(place, expr)?;
|
||||||
}
|
}
|
||||||
ast::ExprKind::Vec(ref exprs) => {
|
ast::ExprKind::Array(ref exprs) => {
|
||||||
self.print_expr_vec(&exprs[..], attrs)?;
|
self.print_expr_vec(&exprs[..], attrs)?;
|
||||||
}
|
}
|
||||||
ast::ExprKind::Repeat(ref element, ref count) => {
|
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,
|
node: ast::ExprKind::AddrOf(ast::Mutability::Immutable,
|
||||||
P(ast::Expr {
|
P(ast::Expr {
|
||||||
id: ast::DUMMY_NODE_ID,
|
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)
|
mk_test_desc_and_fn_rec(cx, test)
|
||||||
}).collect()),
|
}).collect()),
|
||||||
span: DUMMY_SP,
|
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(place);
|
||||||
visitor.visit_expr(subexpression)
|
visitor.visit_expr(subexpression)
|
||||||
}
|
}
|
||||||
ExprKind::Vec(ref subexpressions) => {
|
ExprKind::Array(ref subexpressions) => {
|
||||||
walk_list!(visitor, visit_expr, subexpressions);
|
walk_list!(visitor, visit_expr, subexpressions);
|
||||||
}
|
}
|
||||||
ExprKind::Repeat(ref element, ref count) => {
|
ExprKind::Repeat(ref element, ref count) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue