Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
a69ddc4
add ghostLetexpr demo
Jun 26, 2025
42561cd
ghostletExpression added
Jul 1, 2025
4212732
Merge branch rusty from upstream
yseulp Aug 10, 2025
abad758
data type GhostBlockExpr added
yseulp Aug 13, 2025
57754b1
extract common logic into AbstractBlockExpression
yseulp Aug 19, 2025
e6c9d83
convert json into Hir&AST
Aug 20, 2025
a7ce97d
update wrapper
Aug 26, 2025
7751e25
Test some things
Drodt Nov 18, 2025
e3ef72c
Merge branch 'rusty' into ghosty_rusty_drodt
Drodt Nov 19, 2025
97696a9
Spotless
Drodt Nov 19, 2025
02b5b6a
Merge branch 'rusty' into ghosty_rusty_drodt
Drodt Nov 19, 2025
3efca80
Use only RML submodule
Drodt Nov 19, 2025
02f771c
Adapt to RML
Drodt Nov 19, 2025
b13b02a
ghost rules added
yseulp Nov 24, 2025
64f46b6
Merge remote-tracking branch 'origin/ghosty_rusty_drodt' into ghosty_…
yseulp Nov 24, 2025
7ee6c7b
Merge remote-tracking branch 'origin/rusty' into ghosty_rusty_drodt
yseulp Dec 8, 2025
27c6c5b
Spotless
yseulp Dec 8, 2025
c606b74
Merge remote-tracking branch 'origin/rusty' into ghosty_rusty_drodt
yseulp Dec 8, 2025
347da59
Fix imports
yseulp Dec 8, 2025
6ba9713
Spotless
yseulp Dec 8, 2025
74652f6
Bump rml; fix test
Drodt Dec 8, 2025
a89468a
ghost added to the rust parser
yseulp Dec 10, 2025
805183a
Fix GhostExpr conversion
yseulp Dec 17, 2025
3fa6fc8
add ghost semantic detection
yseulp Dec 20, 2025
f51d971
Merge branch 'ghosty_rusty' of github.com:yseulp/key into ghosty_rusty
Drodt Dec 29, 2025
1df7b1e
snapshot implementation and adjust performActionOnGhostBlockExpression
yseulp Dec 29, 2025
28a43ef
Add context wrapper for GhostBlock and run Spotless
Drodt Dec 29, 2025
b4e1c4f
add createGhostBlockExprWrapper
yseulp Dec 31, 2025
1fef865
add snapshot to parser
Jan 5, 2026
f6f65c0
add snapshotexpression to hirconverter
yseulp Jan 5, 2026
4d13567
Bump rml
Drodt Jan 7, 2026
b8ad893
Spotless & fix conversion
Drodt Jan 7, 2026
97f0ea8
Bump rml
Drodt Jan 7, 2026
f923ba0
Snapshot example that causes an error
yseulp Jan 11, 2026
095de43
Add key file
Drodt Jan 12, 2026
69c9276
update rule
yseulp Jan 13, 2026
87b7095
ghost example
yseulp Jan 14, 2026
e1e3d70
test_array_enumerate example doesn't work in first-ghost.proof
yseulp Jan 14, 2026
75a9a38
Bump rml
Drodt Jan 14, 2026
6cd5c94
Consistent file renaming
Drodt Jan 14, 2026
73ad7bc
Merge branch 'rusty' into ghosty_rusty_drodt
Drodt Jan 14, 2026
5989d9c
Update PC
Drodt Jan 14, 2026
97a3e8d
Bump rml; don't use len() method in example
Drodt Jan 15, 2026
1612fd3
Add support for local Struct/Enum defs
Drodt Jan 22, 2026
54e8d76
error_example
yseulp Jan 22, 2026
0bde28c
Convert Const definitions
Drodt Jan 22, 2026
f87d43c
example fails
yseulp Jan 23, 2026
c48f6c7
Add continue unwrapping rule
Drodt Jan 23, 2026
0c1b7b1
Fix some rules; add (temporary) rule for reading a ghost array
Drodt Jan 23, 2026
c4fc265
add examples for rq2 and rq3
yseulp Jan 23, 2026
b14f9b0
add assign_empty_ghost_block
yseulp Jan 27, 2026
711ef41
merge ghosty_rusty_drodt
yseulp Jan 27, 2026
fefb21a
add more examples
yseulp Jan 27, 2026
49fe835
Spotless and fix typo
Drodt Jan 28, 2026
ecd22c7
modify ghost_house example
yseulp Jan 28, 2026
7619f16
Merge remote-tracking branch 'drodt/rusty-dev' into ghosty_rusty
Drodt Mar 20, 2026
b3724b8
Fix ProofCollections
Drodt Mar 20, 2026
81ec59e
Fix fm26 setup
Drodt Mar 20, 2026
ef539cb
Bump rml
Drodt Mar 20, 2026
c0b69a6
Add rusty to test workflow
Drodt Mar 20, 2026
968d159
Add more ghost proofs, clean up
Drodt Mar 20, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
keyext.exploration, keyext.slicing, key.ncore, key.ui, key.core, key.core.rifl,
key.core.testgen, keyext.isabelletranslation, keyext.ui.testgen, key.ncore.calculus,
key.util, key.core.example, keyext.caching,
keyext.proofmanagement, key.removegenerics ]
keyext.proofmanagement, key.removegenerics, keyext.rusty ]
continue-on-error: true
runs-on: ${{ matrix.os }}
env:
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "keyext.rusty/rust-wrapper/rust"]
path = keyext.rusty/rust-wrapper/rust
url = git@github.com:rust-lang/rust.git
[submodule "rust-wrapper"]
path = rust-wrapper
url = https://github.com/Drodt/KeY-rustc-wrapper.git
[submodule "rml"]
path = rml
url = https://github.com/yseulp/rml.git
7 changes: 7 additions & 0 deletions keyext.rusty/example/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions keyext.rusty/example/target/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc_fingerprint":6139828803497917698,"outputs":{"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.88.0 (6b00bc388 2025-06-23)\nbinary: rustc\ncommit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc\ncommit-date: 2025-06-23\nhost: x86_64-unknown-linux-gnu\nrelease: 1.88.0\nLLVM version: 20.1.5\n","stderr":""},"11857020428658561806":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/yseulp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/yseulp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}}
3 changes: 3 additions & 0 deletions keyext.rusty/example/target/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
94ed5a9cb32ba0b1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":11410426090777951712,"features":"[]","declared_features":"[]","target":18343425508367059059,"profile":17672942494452627365,"path":10763286916239946207,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/example-14b6227221523c01/dep-lib-example","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d855d1ce1ee45f13
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":11410426090777951712,"features":"[]","declared_features":"[]","target":18343425508367059059,"profile":3316208278650011218,"path":10763286916239946207,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/example-b6d004a4079f250b/dep-test-lib-example","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/home/yseulp/uni/thesis/key/keyext.rusty/example/target/debug/deps/example-14b6227221523c01.d: src/lib.rs

/home/yseulp/uni/thesis/key/keyext.rusty/example/target/debug/deps/libexample-14b6227221523c01.rmeta: src/lib.rs

src/lib.rs:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/home/yseulp/uni/thesis/key/keyext.rusty/example/target/debug/deps/example-b6d004a4079f250b.d: src/lib.rs

/home/yseulp/uni/thesis/key/keyext.rusty/example/target/debug/deps/libexample-b6d004a4079f250b.rmeta: src/lib.rs

src/lib.rs:
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions keyext.rusty/src/main/antlr/RustySchemaLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ PANIC

FN_FRAME: 'fn_frame!';

GHOST: 'ghost!';

SNAPSHOT: 'snapshot!';

PANIC_FRAME: 'panic_frame!';
2 changes: 2 additions & 0 deletions keyext.rusty/src/main/antlr/RustySchemaParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ expr
| closureExpr # ClosureExpression_
| exprWithBlock # ExpressionWithBlock_
| PANIC LPAREN RPAREN # EmptyPanic
| GHOST blockExpr # GhostBlockExpression
| SNAPSHOT LPAREN schemaVariable RPAREN # SnapshotExpression
;

stmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public KeYRustyType getKeYRustyType(Type type) {
var krt = new KeYRustyType(f);
type2KRTCache.put(type, krt);
return krt;
} else if (type instanceof GhostType g) {
var krt = new KeYRustyType(g, g.getSort(services));
type2KRTCache.put(type, krt);
return krt;
} else {
throw new IllegalArgumentException("Unsupported type: " + type);
}
Expand Down
33 changes: 33 additions & 0 deletions keyext.rusty/src/main/java/org/key_project/rusty/ast/ConstDef.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package org.key_project.rusty.ast;

import org.key_project.logic.SyntaxElement;
import org.key_project.logic.op.Function;
import org.key_project.rusty.ast.expr.Expr;
import org.key_project.rusty.ast.ty.RustType;
import org.key_project.rusty.ast.visitor.Visitor;

import org.jspecify.annotations.NonNull;

public record ConstDef(String name, RustType rustType, Expr expr, Function fn) implements Item {
@Override
public void visit(Visitor v) {
v.performActionOnConstDef(this);
}

@Override
public @NonNull SyntaxElement getChild(int n) {
if (n == 0)
return rustType;
if (n == 1)
return expr;
throw new IndexOutOfBoundsException();
}

@Override
public int getChildCount() {
return 2;
}
}
26 changes: 26 additions & 0 deletions keyext.rusty/src/main/java/org/key_project/rusty/ast/EnumDef.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package org.key_project.rusty.ast;

import org.key_project.logic.SyntaxElement;
import org.key_project.rusty.ast.visitor.Visitor;

import org.jspecify.annotations.NonNull;

public record EnumDef() implements Item {
@Override
public void visit(Visitor v) {
v.performActionOnEnumDef(this);
}

@Override
public @NonNull SyntaxElement getChild(int n) {
throw new IndexOutOfBoundsException("No children");
}

@Override
public int getChildCount() {
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.key_project.rusty.ast.stmt.LetStatement;
import org.key_project.rusty.ast.stmt.Statement;
import org.key_project.rusty.ast.ty.*;
import org.key_project.rusty.logic.op.IProgramVariable;
import org.key_project.rusty.logic.op.ParametricFunctionDecl;
import org.key_project.rusty.logic.op.ProgramFunction;
import org.key_project.rusty.logic.op.ProgramVariable;
Expand All @@ -48,8 +49,6 @@
import org.key_project.rusty.speclang.FnSpecConverter;
import org.key_project.rusty.speclang.LoopSpecConverter;
import org.key_project.rusty.speclang.spec.FnSpec;
import org.key_project.rusty.speclang.spec.LoopSpec;
import org.key_project.rusty.speclang.spec.SpecMap;
import org.key_project.util.collection.ImmutableArray;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;
Expand All @@ -59,30 +58,15 @@
public class HirConverter {
private final Services services;

private final @Nullable Map<DefId, FnSpec> fnSpecs;
private final @Nullable Map<HirId, LoopSpec> loopSpecs;
private final Map<DefId, Adt> adts = new HashMap<>();
private final FnSpecConverter fnSpecConverter;
private final LoopSpecConverter loopSpecConverter;
private @Nullable GenericParam[] currentParams = null;

public HirConverter(Services services, @Nullable SpecMap specs) {
public HirConverter(Services services) {
this.services = services;
fnSpecConverter = new FnSpecConverter(services);
loopSpecConverter = new LoopSpecConverter(services);
if (specs != null) {
fnSpecs = new HashMap<>(specs.fnSpecs().length);
loopSpecs = new HashMap<>(specs.loopSpecs().length);
for (var e : specs.fnSpecs()) {
fnSpecs.put(e.id(), e.value());
}
for (var e : specs.loopSpecs()) {
loopSpecs.put(e.id(), e.value());
}
} else {
fnSpecs = null;
loopSpecs = null;
}
}

public Services getServices() {
Expand Down Expand Up @@ -132,8 +116,8 @@ public Crate convertCrate(org.key_project.rusty.parser.hir.Crate crate) {
Crate crate1 = new Crate(convertMod(crate.topMod()));
for (var fn : fnsToComplete.keySet()) {
currentFn = fn;
var spec = fn2Spec.get(fn);
var hirFn = fnsToComplete.get(fn);
var specCases = hirFn.specCases();
convertGenerics(hirFn.tyGenerics());
if (hirFn.generics() != null) {
org.key_project.rusty.parser.hir.GenericParam[] params = hirFn.generics().params();
Expand Down Expand Up @@ -165,11 +149,10 @@ public Crate convertCrate(org.key_project.rusty.parser.hir.Crate crate) {
fn.setParams(new ImmutableArray<>(params));
fn.setBody((BlockExpression) convertExpr(hirFn.body().value()));
services.getRustInfo().registerFunction(fn);
if (spec != null) {
if (specCases.length > 0) {
var contracts =
fnSpecConverter.convert(spec,
Objects.requireNonNull(services.getRustInfo().getFunction(fn),
"Could not get function for " + fn));
fnSpecConverter.convert(specCases,
Objects.requireNonNull(services.getRustInfo().getFunction(fn)));
for (var contract : contracts) {
services.getSpecificationRepository().addContract(contract);
}
Expand Down Expand Up @@ -199,19 +182,35 @@ private Mod convertMod(org.key_project.rusty.parser.hir.Mod mod) {
// above
case org.key_project.rusty.parser.hir.item.Struct s -> null; // Handled by ADT
// conversion above
case org.key_project.rusty.parser.hir.item.Const c -> convertConstDef(c);
default -> throw new IllegalArgumentException("Unknown item: " + item);
};
}

private Item convertConstDef(org.key_project.rusty.parser.hir.item.Const c) {
var rustTy = convertHirTy(c.ty());
assert c.body().params().length == 0;
org.key_project.rusty.parser.hir.expr.Expr value = c.body().value();
var expr = convertExpr(value);
// TODO: Get type in second step
var ty = convertTy(rawTypes.get(value.hirId()));
String name = c.ident().name();
var fn = new RFunction(new Name(name), ty.getSort(services));
return new ConstDef(name, rustTy, expr, fn);
}

private Item convertUse(org.key_project.rusty.parser.hir.item.Use use) {
var path = convertPath(use.path(), rs -> {
var lst = Arrays.stream(rs).map(this::convertRes).toList();
return new ImmutableArray<>(lst);
});
var kind = switch (use.useKind()) {
case org.key_project.rusty.parser.hir.item.Use.UseKind.Single -> Use.UseKind.Single;
case org.key_project.rusty.parser.hir.item.Use.UseKind.Glob -> Use.UseKind.Glob;
case org.key_project.rusty.parser.hir.item.Use.UseKind.ListStem -> Use.UseKind.ListStem;
case org.key_project.rusty.parser.hir.item.Use.UseKind.Single ignored ->
Use.UseKind.Single;
case org.key_project.rusty.parser.hir.item.Use.UseKind.Glob ignored -> Use.UseKind.Glob;
case org.key_project.rusty.parser.hir.item.Use.UseKind.ListStem ignored ->
Use.UseKind.ListStem;
default -> throw new IllegalArgumentException("Unknown use kind: " + use);
};
return new Use(path, kind);
}
Expand All @@ -223,11 +222,6 @@ private Function convertFn(Fn fn, LocalDefId id) {
@SuppressWarnings("argument.type.incompatible")
Function function = new Function(name, Function.ImplicitSelfKind.None,
null, retTy, null);
if (fnSpecs != null) {
var spec = fnSpecs.get(new DefId(id.localDefIndex(), 0));
if (spec != null)
fn2Spec.put(function, Objects.requireNonNull(spec, name.toString()));
}
localFns.put(id, function);
fnsToComplete.put(function, fn);
return function;
Expand Down Expand Up @@ -281,10 +275,18 @@ private Expr convertExpr(org.key_project.rusty.parser.hir.expr.Expr expr) {
case ExprKind.Struct e -> convertStructExpr(e);
case ExprKind.Repeat e -> convertRepeat(e, ty);
// case ExprKind.Yield e -> convertYieldExpr(e);
case ExprKind.GhostBlockExpr e -> convertGhostBlockExpr(e);
case ExprKind.Snapshot e -> convertSnapshotExpr(e);
default -> throw new IllegalArgumentException("Unknown expression: " + expr);
};
}

private SnapshotExpression convertSnapshotExpr(ExprKind.Snapshot e) {
var body = e.expr();
IProgramVariable pv = (IProgramVariable) convertExpr(body);
return new SnapshotExpression(pv);
}

private ConstBlockExpression convertConstBlockExpr(ExprKind.ConstBlock e) {
var body = (BlockExpression) convertExpr(e.block().body().value());
return new ConstBlockExpression(body);
Expand Down Expand Up @@ -409,6 +411,12 @@ private BlockExpression convertBlockExpr(ExprKind.BlockExpr expr) {
return new BlockExpression(ImmutableList.fromList(stmts), value);
}

private GhostBlockExpression convertGhostBlockExpr(ExprKind.GhostBlockExpr expr) {
var stmts = Arrays.stream(expr.block().stmts()).map(this::convertStmt).toList();
var value = expr.block().expr() == null ? null : convertExpr(expr.block().expr());
return new GhostBlockExpression(ImmutableList.fromList(stmts), value);
}

private LiteralExpression convertLitExpr(Lit expr, Type type) {
return switch (expr.node()) {
case LitKind.Bool(var v) -> new BooleanLiteralExpression(v);
Expand Down Expand Up @@ -453,9 +461,8 @@ private LoopExpression convertLoopExpr(ExprKind.Loop l, HirId id, Type type) {
var body = convertBlockExpr(new ExprKind.BlockExpr(l.block()));
var le = new InfiniteLoopExpression(null, body);

if (loopSpecs != null && loopSpecs.containsKey(id)) {
var ls = loopSpecConverter.convert(loopSpecs.get(id),
Objects.requireNonNull(currentFn, "Missing local fn"),
if (l.spec() != null) {
var ls = loopSpecConverter.convert(l.spec(), Objects.requireNonNull(currentFn),
le, pvs);
services.getSpecificationRepository().addLoopSpec(ls);
}
Expand Down Expand Up @@ -882,6 +889,9 @@ private Adt getAdt(AdtDef def) {
Adt adt = switch (def.kind()) {
case Struct -> {
assert def.variants().size() == 1;
if (def.pathStr().equals("rml_contracts::Ghost")) {
yield new GenericGhostType(generics, services);
}
if (generics.isEmpty()) {
var fields = convertFields(def.pathStr(), def.variants().get(0).fields());
yield new Struct(name, fields, null, null);
Expand Down Expand Up @@ -990,6 +1000,7 @@ private Type convertAdtTy(AdtDef def, GenericTyArgKind[] args) {
case Enum e -> e;
case GenericStruct g -> g.instantiate(convertGenericArgs(args), services);
case Struct s -> s;
case GenericGhostType g -> g.instantiate(convertGenericArgs(args), services);
default -> throw new IllegalArgumentException("Unknown adt: " + adt);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public RustyBlock readBlock(String block, Context context) {

var wrapperOutput = getWrapperOutput(tmpDir);
var beforeConversion = System.nanoTime();
var converter = new HirConverter(services, null);
var converted = converter.convertCrate(wrapperOutput.crate());
var converter = new HirConverter(services);
var converted = converter.convertCrate(wrapperOutput);
LOGGER.debug("HIR conversion took {}",
PerfScope.formatTime(System.nanoTime() - beforeConversion));
BlockExpression body = converted.getVerificationTarget().body();
Expand Down Expand Up @@ -144,19 +144,19 @@ public RustyBlock readBlock(String block, Context context) {
}
}

public static Crate.WrapperOutput getWrapperOutput(Path path) throws IOException {
public static Crate getWrapperOutput(Path path) throws IOException {
return getWrapperOutput(path, false);
}

public static Crate.WrapperOutput getWrapperOutput(Path path, boolean clean)
public static Crate getWrapperOutput(Path path, boolean clean)
throws IOException {
var startTime = System.nanoTime();
long rustCEnd;
try {
Process cleanCmd =
Runtime.getRuntime().exec(new String[] { "cargo", "clean" }, null, path.toFile());
cleanCmd.waitFor();
var command = new String[] { "cargo", "key", "-o", "hir.json" };
var command = new String[] { "cargo", "rml", "-o", "hir.json" };
Process cmd = Runtime.getRuntime().exec(command, null, path.toFile());
var stdErr = cmd.getErrorStream();
var errReader = new BufferedReader(new InputStreamReader(stdErr));
Expand All @@ -176,7 +176,7 @@ public static Crate.WrapperOutput getWrapperOutput(Path path, boolean clean)
LOGGER.debug("rustc took {}", PerfScope.formatTime(rustCEnd - startTime));
}
var hir = Files.readString(path.resolve("hir.json"), Charset.defaultCharset());
Crate.WrapperOutput output = Crate.parseJSON(hir);
Crate output = Crate.parseJSON(hir);
LOGGER.debug("JSON parsing took {}", PerfScope.formatTime(System.nanoTime() - rustCEnd));
return output;
}
Expand Down
Loading
Loading