diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-09-27 00:43:04 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-10-02 18:31:50 +0300 |
| commit | d7d07657cd45a71f753a6a613d34dc8323ec3943 (patch) | |
| tree | 3190666e832d016265aeeafef3c19e66b6e94dc3 | |
| parent | ded08e44c65ebabc0bcc45bba8ec88143d6be93c (diff) | |
| download | rust-d7d07657cd45a71f753a6a613d34dc8323ec3943.tar.gz rust-d7d07657cd45a71f753a6a613d34dc8323ec3943.zip | |
rustc_span: Make hygiene debug printing reproducible
| -rw-r--r-- | compiler/rustc_span/src/hygiene.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index ef60608a27c..29af6b38bf4 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -601,7 +601,10 @@ pub fn debug_hygiene_data(verbose: bool) -> String { let expn_data = expn_data.as_ref().expect("no expansion data for an expansion ID"); debug_expn_data((&id.to_expn_id(), expn_data)) }); - data.foreign_expn_data.iter().for_each(debug_expn_data); + // Sort the hash map for more reproducible output. + let mut foreign_expn_data: Vec<_> = data.foreign_expn_data.iter().collect(); + foreign_expn_data.sort_by_key(|(id, _)| (id.krate, id.local_id)); + foreign_expn_data.into_iter().for_each(debug_expn_data); s.push_str("\n\nSyntaxContexts:"); data.syntax_context_data.iter().enumerate().for_each(|(id, ctxt)| { s.push_str(&format!( |
