Skip to content

syntax: fix use of "vector" for [x; n] literal and [x, y] patterns #27664

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
Aug 12, 2015
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/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ pub enum Expr_ {
/// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
ExprStruct(Path, Vec<Field>, Option<P<Expr>>),

/// A vector literal constructed from one repeated element.
/// An array literal constructed from one repeated element.
///
/// For example, `[1u8; 5]`. The first expression is the element
/// to be repeated; the second is the number of times to repeat it.
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ impl<'a> Parser<'a> {
// Nonempty vector.
let first_expr = try!(self.parse_expr_nopanic());
if self.check(&token::Semi) {
// Repeating vector syntax: [ 0; 512 ]
// Repeating array syntax: [ 0; 512 ]
try!(self.bump());
let count = try!(self.parse_expr_nopanic());
try!(self.expect(&token::CloseDelim(token::Bracket)));
Expand Down Expand Up @@ -3260,7 +3260,7 @@ impl<'a> Parser<'a> {
pat = PatTup(fields);
}
token::OpenDelim(token::Bracket) => {
// Parse [pat,pat,...] as vector pattern
// Parse [pat,pat,...] as slice pattern
try!(self.bump());
let (before, slice, after) = try!(self.parse_pat_vec_elements());
try!(self.expect(&token::CloseDelim(token::Bracket)));
Expand Down