Skip to content

Commit a9b6a3c

Browse files
committed
Order grammar summary deterministically
In `load_grammar`, we were walking files in directory-entry order. This may not be the same order in two places, leading to sections and rules sorted in different orders in the grammar summary. Let's sort by file name so as to produce deterministic results.
1 parent 3a380bc commit a9b6a3c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/grammar/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub static GRAMMAR_RE: LazyLock<Regex> =
259259
pub fn load_grammar(diag: &mut Diagnostics) -> Grammar {
260260
let mut grammar = Grammar::default();
261261
let base = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../src");
262-
for entry in WalkDir::new(&base) {
262+
for entry in WalkDir::new(&base).sort_by_file_name() {
263263
let entry = entry.unwrap();
264264
let path = entry.path();
265265
if path.extension().and_then(|s| s.to_str()) != Some("md") {

0 commit comments

Comments
 (0)