Skip to content

Commit 6617c55

Browse files
authored
Update to Rust 1.100 (#617)
1 parent 242534e commit 6617c55

5 files changed

Lines changed: 31 additions & 32 deletions

File tree

‎cmake/rust-toolchain.cmake‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
set(RUST_STABLE_VERSION "1.99.0")
2-
set(RUST_NIGHTLY_VERSION "nightly-2026-10-01")
1+
set(RUST_STABLE_VERSION "1.100.0")
2+
set(RUST_NIGHTLY_VERSION "nightly-2026-11-11")

‎libc-dep/CMakeLists.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
set(LIBC_DEP_DIR ${CMAKE_SOURCE_DIR}/libc-dep)
22
set(LIBC_DEP_OUTPUT ${CMAKE_BINARY_DIR}/libc-dep-target/release/liblibc_dep.rlib)
3+
set(LIBC_DEP_ARTIFACTS ${CMAKE_BINARY_DIR}/libc-dep-target/artifacts.json)
34

45
add_custom_command(
5-
OUTPUT ${LIBC_DEP_OUTPUT}
6+
OUTPUT ${LIBC_DEP_OUTPUT} ${LIBC_DEP_ARTIFACTS}
67
COMMAND ${CARGO_ENV_LIBC_DEP} cargo +${RUST_STABLE_VERSION} build --release
8+
--message-format=json-render-diagnostics > ${LIBC_DEP_ARTIFACTS}
79
WORKING_DIRECTORY ${LIBC_DEP_DIR}
810
DEPENDS "${RUST_STAMP_FILE}" ${LIBC_DEP_DIR}/Cargo.toml
911
)

‎libcc2rs/CMakeLists.txt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
set(LIBCC2RC_LIB_DIR ${CMAKE_SOURCE_DIR}/libcc2rs)
22
set(LIBCC2RC_MACROS_LIB_DIR ${CMAKE_SOURCE_DIR}/libcc2rs-macros)
33
set(LIBCC2RS_RLIB ${CMAKE_BINARY_DIR}/libcc2rs-target/release/liblibcc2rs.rlib)
4+
set(LIBCC2RS_ARTIFACTS ${CMAKE_BINARY_DIR}/libcc2rs-target/artifacts.json)
45
set(LIBCC2RS_MACROS_RLIB ${CMAKE_BINARY_DIR}/libcc2rs-macros-target/release/liblibcc2rs-macros.rlib)
56
file(GLOB_RECURSE LIBCC2RS_SOURCES "${LIBCC2RC_LIB_DIR}/src/*.rs")
67
file(GLOB_RECURSE LIBCC2RS_MACROS_SOURCES "${LIBCC2RC_MACROS_LIB_DIR}/src/*.rs")
78
file(GLOB LIBCC2RS_RULE_SHIMS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/rules/*/shim.rs")
89

910
add_custom_command(
10-
OUTPUT ${LIBCC2RS_RLIB}
11+
OUTPUT ${LIBCC2RS_RLIB} ${LIBCC2RS_ARTIFACTS}
1112
COMMAND ${CARGO_ENV_LIBCC2RS} cargo +${RUST_STABLE_VERSION} build --release
13+
--message-format=json-render-diagnostics > ${LIBCC2RS_ARTIFACTS}
1214
WORKING_DIRECTORY ${LIBCC2RC_LIB_DIR}
1315
DEPENDS
1416
"${RUST_STAMP_FILE}"

‎rule-preprocessor/src/semantic.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl SemanticAnalysis {
1414
let mut resolver = MethodResolver { ir };
1515

1616
if rustc_driver::catch_fatal_errors(|| {
17-
rustc_driver::run_compiler(&args, &mut resolver);
17+
rustc_driver::compiler_entrypoint(&args, &mut resolver);
1818
})
1919
.is_err()
2020
{

‎tests/lit/lit/formats/Cpp2RustTest.py‎

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from pathlib import Path
1010
from typing import NamedTuple, Optional
1111
import difflib
12+
import functools
13+
import json
1214
import os
1315
import re
1416
import shlex
@@ -217,21 +219,7 @@ def build_cpp(self):
217219
def build_rust(self):
218220
exp = self.expectations
219221

220-
cc2rs_dir = BUILD_DIR / "libcc2rs-target" / "release"
221-
libc_dep_deps = BUILD_DIR / "libc-dep-target" / "release" / "deps"
222-
# pick the most recently compiled libc
223-
libc_rlib = max(
224-
libc_dep_deps.glob("liblibc-*.rlib"),
225-
key=lambda p: p.stat().st_mtime,
226-
)
227-
nix_rlib = max(
228-
libc_dep_deps.glob("libnix-*.rlib"),
229-
key=lambda p: p.stat().st_mtime,
230-
)
231-
jiff_rlib = max(
232-
libc_dep_deps.glob("libjiff-*.rlib"),
233-
key=lambda p: p.stat().st_mtime,
234-
)
222+
libs = read_cargo_artifacts()
235223
cmd = [
236224
"rustc",
237225
"+" + read_rust_version(),
@@ -248,19 +236,11 @@ def build_rust(self):
248236
"panic=abort",
249237
"--out-dir",
250238
str(self.tmp_dir),
251-
"-L",
252-
f"dependency={cc2rs_dir / 'deps'}",
253-
"-L",
254-
f"dependency={libc_dep_deps}",
255-
"--extern",
256-
f"libcc2rs={cc2rs_dir / 'liblibcc2rs.rlib'}",
257-
"--extern",
258-
f"libc={libc_rlib}",
259-
"--extern",
260-
f"nix={nix_rlib}",
261-
"--extern",
262-
f"jiff={jiff_rlib}",
263239
]
240+
for lib_dir in sorted({p.parent for p in libs.values()}):
241+
cmd += ["-L", f"dependency={lib_dir}"]
242+
for crate in ("libcc2rs", "libc", "nix", "jiff"):
243+
cmd += ["--extern", f"{crate}={libs[crate]}"]
264244
_, err, returncode = lit.util.executeCommand(cmd, str(self.tmp_dir))
265245
if exp.should_not_compile:
266246
if returncode != 0:
@@ -403,6 +383,21 @@ def read_rust_version():
403383
raise Exception("could not find rust version in " + toolchain_path)
404384

405385

386+
@functools.cache
387+
def read_cargo_artifacts():
388+
libs = {}
389+
for crate in ("libc-dep", "libcc2rs"):
390+
path = BUILD_DIR / f"{crate}-target" / "artifacts.json"
391+
for line in path.read_text().splitlines():
392+
msg = json.loads(line)
393+
if msg.get("reason") != "compiler-artifact":
394+
continue
395+
for f in map(Path, msg["filenames"]):
396+
if f.suffix in (".rlib", ".so", ".dylib"):
397+
libs[msg["target"]["name"]] = f
398+
return libs
399+
400+
406401
def get_temp_dir():
407402
shm = Path("/dev/shm")
408403
if shm.exists() and os.access(shm, os.W_OK):

0 commit comments

Comments
 (0)