Skip to content

Commit 0a14cc9

Browse files
Stephen Skeirikjbertholddkcumming
authored
Remove forked rust dependency (#19)
This PR removes the forked rust dependency by implementing the following two functions directly in smir_pretty (instead of in a forked rust compiler): - visited_tys - visited_alloc_ids This is done by extending the functionality of `LinkNameCollector` to also collect `Ty` and `AllocId` mappings and renaming the combined collector to `InternedValueCollector`. EDIT: When running the panic example on rustc master, there is some weirdness where a static item called: `alloc::alloc::__rust_no_alloc_shim_is_unstable` is generated which has no body. This static item appears to be referenced from several different allocations (can be seen by chasing pointers in allocations provenance table). If this funny static item is findable on other machines, we should document this issue. It may well be that this is an empty type that is never used at runtime, but I haven't gone in to check this yet. --------- Co-authored-by: Jost Berthold <jost.berthold@gmail.com> Co-authored-by: dkcumming <daniel.cumming@runtimeverification.com> Co-authored-by: Daniel Cumming <124537596+dkcumming@users.noreply.github.com>
1 parent a823e31 commit 0a14cc9

39 files changed

+14710
-90591
lines changed

Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,27 @@ RUST_LIB_DIR=${RUST_INSTALL_DIR}/lib
1616
RUST_DEP_DIR=${RUST_BUILD_DIR}/stage1-rustc/${RUST_ARCH}/release/deps
1717
TARGET_DEP_DIR=${CURDIR}/target/${TARGET}/deps
1818
TEMP_DIR=${RUST_DIR}/temp
19-
RUST_REPO=https://github.com/runtimeverification/rust
20-
RUST_BRANCH=smir_serde_derive_intern_scripts
21-
TOOLCHAIN_NAME=smir_serde_derive_intern_scripts
19+
#############################################
20+
# depend on the rust compiler
21+
RUST_REPO=https://github.com/rust-lang/rust
22+
# tip of the `beta` branch on 2025-01-14
23+
RUST_BRANCH=beta
24+
RUST_COMMIT=fe9b975
25+
#############################################
26+
TOOLCHAIN_NAME=smir_pretty
2227
RELEASE_FLAG=
2328
ifeq (${TARGET}, release)
2429
RELEASE_FLAG=--release
2530
endif
2631

32+
default: build
33+
2734
build_all: rust_build rust_set_toolchain build
2835

2936
setup: rust_clone
3037

3138
update: ${RUST_SRC}
32-
cd "${RUST_SRC}"; git fetch origin; git reset --hard origin/${RUST_BRANCH}
39+
cd "${RUST_SRC}"; git fetch origin; git checkout ${RUST_COMMIT}
3340

3441
build:
3542
cargo build ${RELEASE_FLAG}
@@ -53,7 +60,9 @@ prebuild_clean: ${RUST_SRC}
5360

5461
# NOTE: a deeper clone depth is needed for the build process
5562
rust_clone:
56-
git clone --depth 70 --single-branch --branch "${RUST_BRANCH}" "${RUST_REPO}" "${RUST_SRC}"
63+
git clone --depth 70 --single-branch --branch "${RUST_BRANCH}" "${RUST_REPO}" "${RUST_SRC}" && \
64+
cd "${RUST_SRC}" && \
65+
git checkout ${RUST_COMMIT}
5766

5867

5968
# rust_build for linking against custom rustc is involved

src/driver.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate rustc_smir;
2424
extern crate rustc_session;
2525
use rustc_middle::ty::TyCtxt;
2626
use rustc_driver::Compilation;
27-
use rustc_interface::{interface::Compiler, Queries};
27+
use rustc_interface::interface::Compiler;
2828
use rustc_smir::rustc_internal;
2929

3030
struct StableMirCallbacks {
@@ -35,16 +35,10 @@ impl rustc_driver::Callbacks for StableMirCallbacks {
3535
fn after_analysis<'tcx>(
3636
&mut self,
3737
_compiler: &Compiler,
38-
queries: &'tcx Queries<'tcx>,
38+
tcx: TyCtxt<'tcx>,
3939
) -> Compilation {
4040

41-
let _q = queries
42-
.global_ctxt()
43-
.unwrap()
44-
.get_mut()
45-
.enter(|tcx| {
46-
let _ = rustc_internal::run(tcx, || (self.callback_fn)(tcx));
47-
});
41+
let _ = rustc_internal::run(tcx, || (self.callback_fn)(tcx));
4842

4943
Compilation::Continue
5044
}

0 commit comments

Comments
 (0)