-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: --rust-module-name with externs (#5865)
Fixes #5864 ### Description This PR adds the ability to use `--rust-module-name` along with externs, by detecting that we are not generating an entry library file, and in that case it removes the "pub mod" declaration for the externs since side files do not have the ability to import externs themselves. Since the Rust compiler is internal, we don't advertise this change yet. ### How has this been tested? The test `translate_additional/more_dafny.dfy` was updated to include externs. The test was not working without this PR, reproducing faithfully the issue. <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
- Loading branch information
1 parent
bd38a72
commit c5ce8c9
Showing
6 changed files
with
22 additions
and
7 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
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
8 changes: 6 additions & 2 deletions
8
...IntegrationTests/TestFiles/LitTests/LitTest/comp/rust/translate-additional/more_dafny.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
5 changes: 5 additions & 0 deletions
5
...ationTests/TestFiles/LitTests/LitTest/comp/rust/translate-additional/more_dafny_extern.rs
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,5 @@ | ||
pub mod extern_dafny { | ||
pub fn eight() -> u16 { | ||
8 | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...les/LitTests/LitTest/comp/rust/translate-additional/project_depending_on_dafny/.gitignore
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
src/additional_module.rs | ||
src/more_dafny_extern.rs | ||
target/ |
1 change: 1 addition & 0 deletions
1
...mp/rust/translate-additional/project_depending_on_dafny/src/project_depending_on_dafny.rs
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