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

Chore: Dafny to Rust refactorings #5513

Merged
merged 29 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0f9f1a1
chore-rust-refactorings
MikaelMayer May 2, 2024
45fd9ee
Removed enforce determinism extra option. More error checks
MikaelMayer May 31, 2024
136a72b
Ensure right handling of tuples and printing, and no extra rs.check file
MikaelMayer Jun 1, 2024
2da9647
Merge branch 'master' into chore-rust-refactorings
MikaelMayer Jun 4, 2024
6a5dcdb
Merge branch 'master' into chore-rust-refactorings
MikaelMayer Jun 4, 2024
77df75f
Fixed formatting
MikaelMayer Jun 4, 2024
a9084e5
Updated all .rs.check files
MikaelMayer Jun 4, 2024
2afbd5b
Merge branch 'chore-rust-refactorings' of https://github.com/dafny-la…
MikaelMayer Jun 4, 2024
530dfd5
Merge branch 'refs/heads/master' into chore-rust-refactorings
MikaelMayer Jun 5, 2024
f991053
Merge branch 'refs/heads/master' into chore-rust-refactorings
MikaelMayer Jun 5, 2024
1facdae
WIP need to remove these check files
MikaelMayer Jun 5, 2024
1692ddf
Updated test and check files
MikaelMayer Jun 6, 2024
1b29dda
Merge branch 'refs/heads/master' into chore-rust-refactorings
MikaelMayer Jun 6, 2024
6b65030
Merge branch 'master' into chore-rust-refactorings
MikaelMayer Jun 6, 2024
ad72a8e
Merge branch 'refs/heads/master' into chore-rust-refactorings
MikaelMayer Jun 10, 2024
6c6a423
Merge branch 'master' into chore-rust-refactorings
MikaelMayer Jun 11, 2024
6c6e37e
Fixed the core files for the rust tests
MikaelMayer Jun 12, 2024
4853061
Fixed typôs
MikaelMayer Jun 13, 2024
ccbe323
Merge branch 'refs/heads/master' into chore-rust-refactorings
MikaelMayer Jun 13, 2024
b29ffd0
Updated check files again
MikaelMayer Jun 13, 2024
0a13114
More fixups
MikaelMayer Jun 13, 2024
40721bb
Reverted ownership and included a change in the message
MikaelMayer Jun 13, 2024
1f9824e
One last test fixed
MikaelMayer Jun 13, 2024
af055f4
New attempt at fixing CI
MikaelMayer Jun 14, 2024
4fda132
Merge branch 'master' into chore-rust-refactorings
MikaelMayer Jun 19, 2024
6e11aca
Merge branch 'master' into chore-rust-refactorings
MikaelMayer Jun 21, 2024
c5f22f1
latest improvements
MikaelMayer Jun 21, 2024
1832a90
Fixed one last test
MikaelMayer Jun 21, 2024
123ef92
Changed the printing so that it's deterministic
MikaelMayer Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reverted ownership and included a change in the message
  • Loading branch information
MikaelMayer committed Jun 13, 2024
commit 40721bb64f9408d0e164aa67d3658d578e692d58
4 changes: 2 additions & 2 deletions Source/DafnyCore/Backends/Rust/Dafny-compiler-rust.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ module {:extern "DCOMP"} DafnyToRustCompiler {
newEnv := env;
}
case Print(e) => {
var printedExpr, recOwnership, recIdents := GenExpr(e, selfIdent, env, OwnershipOwned);
var printedExpr, recOwnership, recIdents := GenExpr(e, selfIdent, env, OwnershipBorrowed);
generated := R.Identifier("print!").Apply([R.LiteralString("{}", false),
R.dafny_runtime.MSel("DafnyPrintWrapper").Apply1(printedExpr)]);
readIdents := recIdents;
Expand Down Expand Up @@ -2943,7 +2943,7 @@ module {:extern "DCOMP"} DafnyToRustCompiler {
var Path(_, _, Newtype(b, range, erase, attributes)) := fromTpe;
var nativeFromType := NewtypeToRustType(b, range);
if b == toTpe {
var recursiveGen, recOwned, recIdents := GenExpr(expr, selfIdent, env, expectedOwnership);
var recursiveGen, recOwned, recIdents := GenExpr(expr, selfIdent, env, OwnershipOwned);
readIdents := recIdents;
match nativeFromType {
case Some(v) =>
Expand Down
4 changes: 2 additions & 2 deletions Source/DafnyCore/GeneratedFromDafny/DCOMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ public void GenStmt(DAST._IStatement stmt, Std.Wrappers._IOption<Dafny.ISequence
RAST._IExpr _out163;
DCOMP._IOwnership _out164;
Dafny.ISet<Dafny.ISequence<Dafny.Rune>> _out165;
(this).GenExpr(_1431_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out163, out _out164, out _out165);
(this).GenExpr(_1431_e, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out163, out _out164, out _out165);
_1432_printedExpr = _out163;
_1433_recOwnership = _out164;
_1434_recIdents = _out165;
Expand Down Expand Up @@ -3186,7 +3186,7 @@ public void GenExprConvertFromNewtype(DAST._IExpression e, Std.Wrappers._IOption
RAST._IExpr _out214;
DCOMP._IOwnership _out215;
Dafny.ISet<Dafny.ISequence<Dafny.Rune>> _out216;
(this).GenExpr(_1499_expr, selfIdent, env, expectedOwnership, out _out214, out _out215, out _out216);
(this).GenExpr(_1499_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out214, out _out215, out _out216);
_1509_recursiveGen = _out214;
_1510_recOwned = _out215;
_1511_recIdents = _out216;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// CHECK: .*<i>Coercion\ from\ ::std::rc::Rc<super::_module::MyClass>\ to\ _K</i>.*
// CHECK-L: error[E0308]: mismatched types
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// CHECK-L: error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
// CHECK-L: error[E0308]: mismatched types
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// CHECK: .*<i>Char literal without unicode char enabled</i>.*
// CHECK-L: Unhandled exception: System.ArgumentException: Value does not fall within the expected range.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// CHECK-L: Unhandled exception: System.IO.IOException: The process cannot access the file 'C:\vscode\settings.json' because it is being used by another process.
// CHECK-L: error[E0308]: mismatched types
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// CHECK-L: error[E0599]: no associated item named `_allocated` found for struct `C` in the current scope
// CHECK-L: error[E0308]: mismatched types
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// CHECK: .*<i>Cannot\ assign\ null\ value\ to\ variable</i>.*
// CHECK: error[E0308]: mismatched types
Loading