Skip to content

Commit d0c35d9

Browse files
committed
edits
1 parent 517bb32 commit d0c35d9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/lit/lit/formats/Cpp2RustTest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,13 @@ def build_rust(self):
195195

196196
parent = Path(__file__).resolve().parent.parent.parent.parent.parent
197197
cc2rs_dir = parent / "libcc2rs" / "target" / "release"
198-
libc_dir = parent / "libc-dep" / "target" / "release"
198+
# pick the most recently compiled libc
199+
libc_rlib = max(
200+
(parent / "libc-dep" / "target" / "release" / "deps").glob(
201+
"liblibc-*.rlib"
202+
),
203+
key=lambda p: p.stat().st_mtime,
204+
)
199205
cmd = [
200206
"rustc",
201207
"+" + read_rust_version(),
@@ -216,7 +222,7 @@ def build_rust(self):
216222
f"libcc2rs={cc2rs_dir / 'liblibcc2rs.rlib'}",
217223
]
218224
if self.model == "unsafe":
219-
cmd += ["--extern", f"libc={libc_dir / 'liblibc_dep.rlib'}"]
225+
cmd += ["--extern", f"libc={libc_rlib}"]
220226
_, err, returncode = lit.util.executeCommand(cmd, str(self.tmp_dir))
221227
if exp.should_not_compile:
222228
if returncode != 0:

0 commit comments

Comments
 (0)