-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Ordering of modules now deterministic in compiled code
Previously, the order of modules depended on the ordering of the hashes of instances of ModuleDefinition, which likely depended on run-time addresses. To ensure we generate code deterministically irrespective of run-time addresses, I sort the module definitions by their full name before iterative over them.
- Loading branch information
1 parent
d38be44
commit d956ed7
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/rust/moduleordering.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// NONUNIFORM: Test of the Rust compiler to ensure it emits modules in a deterministic order. | ||
// RUN: %baredafny translate rs "%s" > "%t" | ||
// RUN: %OutputCheck --file-to-check "%S/moduleordering-rust/src/moduleordering.rs" "%s" | ||
// CHECK-L: pub mod A { | ||
// CHECK-L: pub mod B { | ||
// CHECK-L: pub mod C { | ||
// CHECK-L: pub mod D { | ||
// CHECK-L: pub mod E { | ||
// CHECK-L: pub mod F { | ||
// CHECK-L: pub mod G { | ||
// CHECK-L: pub mod H { | ||
|
||
module B { const X := "B" } | ||
module D { import B const X := B.X } | ||
module C { import A const X := A.X } | ||
module E { import C const X := C.X } | ||
module A { import G const X := G.X } | ||
module G { const X := "G" } | ||
module F { const X := "F" } | ||
module H { const X := "H" } |