File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
compiler/rustc_macros/src Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 11#![ deny( unused_must_use) ]
2- use quote:: format_ident;
3- use quote:: quote;
4-
52use proc_macro:: Diagnostic ;
3+ use quote:: { format_ident, quote} ;
64use syn:: spanned:: Spanned ;
75
8- use std:: collections:: { HashMap , HashSet } ;
6+ use std:: collections:: { BTreeSet , HashMap } ;
97
108/// Implements #[derive(SessionDiagnostic)], which allows for errors to be specified as a struct, independent
119/// from the actual diagnostics emitting code.
@@ -577,7 +575,10 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
577575 /// ```
578576 /// This function builds the entire call to format!.
579577 fn build_format ( & self , input : & String , span : proc_macro2:: Span ) -> proc_macro2:: TokenStream {
580- let mut referenced_fields: HashSet < String > = HashSet :: new ( ) ;
578+ // This set is used later to generate the final format string. To keep builds reproducible,
579+ // the iteration order needs to be deterministic, hence why we use a BTreeSet here instead
580+ // of a HashSet.
581+ let mut referenced_fields: BTreeSet < String > = BTreeSet :: new ( ) ;
581582
582583 // At this point, we can start parsing the format string.
583584 let mut it = input. chars ( ) . peekable ( ) ;
You can’t perform that action at this time.
0 commit comments