diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-11-30 10:02:04 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-12-10 12:10:10 +1100 |
| commit | 1fe2c0324006165b0c39ece0ccd7509e19583054 (patch) | |
| tree | 5212ff7760cc0de9d347ee40714a5110565a9f82 /src/libsyntax/print | |
| parent | b755501043d5b27b39f94bcadd57c8d5dedfd6ba (diff) | |
| download | rust-1fe2c0324006165b0c39ece0ccd7509e19583054.tar.gz rust-1fe2c0324006165b0c39ece0ccd7509e19583054.zip | |
Remove `tokenstream::Delimited`.
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index e50f28897dd..41165c7e36d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -815,12 +815,12 @@ pub trait PrintState<'a> { _ => Ok(()) } } - TokenTree::Delimited(_, ref delimed) => { - self.writer().word(token_to_string(&delimed.open_token()))?; + TokenTree::Delimited(_, delim, tts) => { + self.writer().word(token_to_string(&token::OpenDelim(delim)))?; self.writer().space()?; - self.print_tts(delimed.stream())?; + self.print_tts(tts.stream())?; self.writer().space()?; - self.writer().word(token_to_string(&delimed.close_token())) + self.writer().word(token_to_string(&token::CloseDelim(delim))) }, } } |
