-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Generated Rust docstring no longer crashes cargo doc
Fixes #6084 Previously, Dafny docstring was literally transformed to Rust docstring. However, Rust docstring follows a markdown syntax where non-labelled code blocks are interpreted and checked as Rust code when running `cargo doc`. Rather than creating a flag to avoid the docstring, this PR does a lightweight parsing on the docstring to ensures that: * In docstrings, Code blocks without label are written using the "dafny" label so that they are not interpreted as Rust * In docstrings, text that has a certain level of indentation has its first space replaced by a vertical bar so that we make sure it's not interpreted as Rust code. I added Dafny tests for the new function that converts docstrings, and also an integration test that verifies that 'cargo doc' works on the already existing but modified docstring.dfy test.
- Loading branch information
1 parent
18c538a
commit 175ee9f
Showing
8 changed files
with
516 additions
and
12 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
23 changes: 22 additions & 1 deletion
23
Source/DafnyCore/Backends/Rust/Dafny-compiler-rust-proofs.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
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
Oops, something went wrong.