1
Fork 0

libsyntax: clearer names for some AST parts

This applies the HIR changes from the previous commits to the AST, and
is thus a syntax-[breaking-change]

Renames `PatKind::Vec` to `PatKind::Slice`, since these are called slice
patterns, not vec patterns. Renames `TyKind::Vec`, which represents the
type `[T]`, to `TyKind::Slice`. Renames `TyKind::FixedLengthVec` to
`TyKind::Array`.
This commit is contained in:
Jonas Schievink 2016-09-20 16:54:24 +02:00
parent cf0b7bdd0c
commit 48e5199de3
11 changed files with 42 additions and 43 deletions

View file

@ -1386,8 +1386,8 @@ impl<'a> Parser<'a> {
// Parse the `; e` in `[ i32; e ]`
// where `e` is a const expression
let t = match self.maybe_parse_fixed_length_of_vec()? {
None => TyKind::Vec(t),
Some(suffix) => TyKind::FixedLengthVec(t, suffix)
None => TyKind::Slice(t),
Some(suffix) => TyKind::Array(t, suffix)
};
self.expect(&token::CloseDelim(token::Bracket))?;
t
@ -3587,7 +3587,7 @@ impl<'a> Parser<'a> {
self.bump();
let (before, slice, after) = self.parse_pat_vec_elements()?;
self.expect(&token::CloseDelim(token::Bracket))?;
pat = PatKind::Vec(before, slice, after);
pat = PatKind::Slice(before, slice, after);
}
// At this point, token != _, &, &&, (, [
_ => if self.eat_keyword(keywords::Mut) {