Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: --rust-module-name with externs #5865

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

MikaelMayer
Copy link
Member

@MikaelMayer MikaelMayer commented Oct 28, 2024

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.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

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.
ajewellamz
ajewellamz previously approved these changes Oct 28, 2024
@MikaelMayer MikaelMayer enabled auto-merge (squash) October 29, 2024 19:27
@MikaelMayer MikaelMayer merged commit 142c49e into master Oct 29, 2024
22 checks passed
@MikaelMayer MikaelMayer deleted the fix-5864-rust-module-name-extern branch October 29, 2024 19:33
MikaelMayer added a commit that referenced this pull request Oct 30, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust code generation with --rust-module-name
3 participants