diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-11-04 16:57:51 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-11-06 00:59:08 +0300 |
| commit | 8def2fc122a9f698914606c51a9e8c18aed168df (patch) | |
| tree | dd8e2fca95fb33d81d5a5928724149b3d0516f2b | |
| parent | 63343f6323ba2efbffc4ff4436bdafac8298fc8c (diff) | |
| download | rust-8def2fc122a9f698914606c51a9e8c18aed168df.tar.gz rust-8def2fc122a9f698914606c51a9e8c18aed168df.zip | |
rustc_ast: Never clone empty token streams in mutable visitor
| -rw-r--r-- | compiler/rustc_ast/src/mut_visit.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index af8b8ad34c8..517717eebd9 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -656,7 +656,7 @@ pub fn visit_tt<T: MutVisitor>(tt: &mut TokenTree, vis: &mut T) { // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. pub fn visit_tts<T: MutVisitor>(TokenStream(tts): &mut TokenStream, vis: &mut T) { - if vis.token_visiting_enabled() { + if vis.token_visiting_enabled() && !tts.is_empty() { let tts = Lrc::make_mut(tts); visit_vec(tts, |(tree, _is_joint)| visit_tt(tree, vis)); } |
