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

Remove forked rust dependency #19

Merged
merged 16 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,27 @@ RUST_LIB_DIR=${RUST_INSTALL_DIR}/lib
RUST_DEP_DIR=${RUST_BUILD_DIR}/stage1-rustc/${RUST_ARCH}/release/deps
TARGET_DEP_DIR=${CURDIR}/target/${TARGET}/deps
TEMP_DIR=${RUST_DIR}/temp
RUST_REPO=https://github.com/runtimeverification/rust
RUST_BRANCH=smir_serde_derive_intern_scripts
TOOLCHAIN_NAME=smir_serde_derive_intern_scripts
#############################################
# depend on the rust compiler
RUST_REPO=https://github.com/rust-lang/rust
# tip of the `beta` branch on 2025-01-14
RUST_BRANCH=beta
RUST_COMMIT=fe9b975
#############################################
TOOLCHAIN_NAME=smir_pretty
RELEASE_FLAG=
ifeq (${TARGET}, release)
RELEASE_FLAG=--release
endif

default: build

build_all: rust_build rust_set_toolchain build

setup: rust_clone

update: ${RUST_SRC}
cd "${RUST_SRC}"; git fetch origin; git reset --hard origin/${RUST_BRANCH}
cd "${RUST_SRC}"; git fetch origin; git checkout ${RUST_COMMIT}

build:
cargo build ${RELEASE_FLAG}
Expand All @@ -53,7 +60,9 @@ prebuild_clean: ${RUST_SRC}

# NOTE: a deeper clone depth is needed for the build process
rust_clone:
git clone --depth 70 --single-branch --branch "${RUST_BRANCH}" "${RUST_REPO}" "${RUST_SRC}"
git clone --depth 70 --single-branch --branch "${RUST_BRANCH}" "${RUST_REPO}" "${RUST_SRC}" && \
cd "${RUST_SRC}" && \
git checkout ${RUST_COMMIT}


# rust_build for linking against custom rustc is involved
Expand Down
12 changes: 3 additions & 9 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern crate rustc_smir;
extern crate rustc_session;
use rustc_middle::ty::TyCtxt;
use rustc_driver::Compilation;
use rustc_interface::{interface::Compiler, Queries};
use rustc_interface::interface::Compiler;
use rustc_smir::rustc_internal;

struct StableMirCallbacks {
Expand All @@ -35,16 +35,10 @@ impl rustc_driver::Callbacks for StableMirCallbacks {
fn after_analysis<'tcx>(
&mut self,
_compiler: &Compiler,
queries: &'tcx Queries<'tcx>,
tcx: TyCtxt<'tcx>,
) -> Compilation {

let _q = queries
.global_ctxt()
.unwrap()
.get_mut()
.enter(|tcx| {
let _ = rustc_internal::run(tcx, || (self.callback_fn)(tcx));
});
let _ = rustc_internal::run(tcx, || (self.callback_fn)(tcx));

Compilation::Continue
}
Expand Down
Loading