about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-10-31 22:47:57 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-11-01 00:03:35 +0300
commit6b63e9b990b1624df3f93aeca849a33efcf156e9 (patch)
tree4457daa004c1ee732382e5f53fa864491ea6972a /compiler/rustc_ast
parent4f7612ac1499258025077f1fd05d2f429f9accfb (diff)
downloadrust-6b63e9b990b1624df3f93aeca849a33efcf156e9.tar.gz
rust-6b63e9b990b1624df3f93aeca849a33efcf156e9.zip
Do not remove tokens before AST json serialization
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/tokenstream.rs5
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)
     }
 }