diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-11-02 14:14:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-02 14:14:34 +0900 |
| commit | 61305d5ab4f6a3ca09a62a5f13c3ea3f10e69e9f (patch) | |
| tree | 9245db031f5df7a933d59ae22d2099c6008c8779 /compiler/rustc_ast/src/tokenstream.rs | |
| parent | 0fdb371d5ae2267a7783997b0a84f580059a6488 (diff) | |
| parent | 6b63e9b990b1624df3f93aeca849a33efcf156e9 (diff) | |
Rollup merge of #78610 - petrochenkov:nostriptok, r=Aaron1011
Do not remove tokens before AST json serialization `TokenStripper` is error-prone and introduces one more use of `MutVisitor`. It's much simpler to treat serialization as just one more place that wants lazy token stream to turn into a real token stream. Also, no code is better than more code, in general. r? @Aaron1011 (I also merged tests for `TokenStripper` ICEs into one.)
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
| -rw-r--r-- | compiler/rustc_ast/src/tokenstream.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index b53acb97aeb..98da20af8f6 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -153,8 +153,9 @@ impl fmt::Debug for LazyTokenStream { } impl<S: Encoder> Encodable<S> for LazyTokenStream { - fn encode(&self, _s: &mut S) -> Result<(), S::Error> { - panic!("Attempted to encode LazyTokenStream"); + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + // Used by AST json printing. + Encodable::encode(&self.create_token_stream(), s) } } |
