File tree 1 file changed +6
-5
lines changed
compiler/rustc_macros/src
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
#![ deny( unused_must_use) ]
2
- use quote:: format_ident;
3
- use quote:: quote;
4
-
5
2
use proc_macro:: Diagnostic ;
3
+ use quote:: { format_ident, quote} ;
6
4
use syn:: spanned:: Spanned ;
7
5
8
- use std:: collections:: { HashMap , HashSet } ;
6
+ use std:: collections:: { BTreeSet , HashMap } ;
9
7
10
8
/// Implements #[derive(SessionDiagnostic)], which allows for errors to be specified as a struct, independent
11
9
/// from the actual diagnostics emitting code.
@@ -577,7 +575,10 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> {
577
575
/// ```
578
576
/// This function builds the entire call to format!.
579
577
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 ( ) ;
581
582
582
583
// At this point, we can start parsing the format string.
583
584
let mut it = input. chars ( ) . peekable ( ) ;
You can’t perform that action at this time.
0 commit comments