diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-19 23:16:56 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-21 10:52:48 +1100 |
| commit | 7785fe191651fb42a6300a399d61414bf49dffb3 (patch) | |
| tree | 1d58655556eac689f63b20f5944dd7e806d50de4 /src/libsyntax/parse | |
| parent | 7334c11b4b196e39da2418a239e2ff916896fa19 (diff) | |
| download | rust-7785fe191651fb42a6300a399d61414bf49dffb3.tar.gz rust-7785fe191651fb42a6300a399d61414bf49dffb3.zip | |
syntax: make OptVec immutable.
This is the first step to replacing OptVec with a new representation: remove all mutability. Any mutations have to go via `Vec` and then make to `OptVec`. Many of the uses of OptVec are unnecessary now that Vec has no-alloc emptiness (and have been converted to Vec): the only ones that really need it are the AST and sty's (and so on) where there are a *lot* of instances of them, and they're (mostly) immutable.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5398844d52a..3e2b88c1cf1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -632,7 +632,7 @@ impl<'a> Parser<'a> { f: |&mut Parser| -> T) -> OptVec<T> { let mut first = true; - let mut v = opt_vec::Empty; + let mut v = Vec::new(); while self.token != token::GT && self.token != token::BINOP(token::SHR) { match sep { @@ -644,7 +644,7 @@ impl<'a> Parser<'a> { } v.push(f(self)); } - return v; + return opt_vec::from(v); } pub fn parse_seq_to_gt<T>( @@ -681,7 +681,7 @@ impl<'a> Parser<'a> { f: |&mut Parser| -> T) -> Vec<T> { let mut first: bool = true; - let mut v: Vec<T> = Vec::new(); + let mut v = vec!(); while self.token != *ket { match sep.sep { Some(ref t) => { @@ -3437,7 +3437,7 @@ impl<'a> Parser<'a> { return None; } - let mut result = opt_vec::Empty; + let mut result = vec!(); loop { match self.token { token::LIFETIME(lifetime) => { @@ -3462,7 +3462,7 @@ impl<'a> Parser<'a> { } } - return Some(result); + return Some(opt_vec::from(result)); } // matches typaram = IDENT optbounds ( EQ ty )? |
