diff --git a/analysis/tests/utils.rs b/analysis/tests/utils.rs index 397f53aeaa6..b9ef0a0cdd9 100644 --- a/analysis/tests/utils.rs +++ b/analysis/tests/utils.rs @@ -31,12 +31,16 @@ pub fn find_compiled_executable(name: &str) -> PathBuf { } pub fn find_sysroot() -> String { - // Taken from https://github.com/Manishearth/rust-clippy/pull/911. - let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); - let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); + // Taken from https://github.com/rust-lang/rust-clippy/commit/f5db351a1d502cb65f8807ec2c84f44756099ef3. + let home = std::env::var("RUSTUP_HOME") + .or_else(|_| std::env::var("MULTIRUST_HOME")) + .ok(); + let toolchain = std::env::var("RUSTUP_TOOLCHAIN") + .or_else(|_| std::env::var("MULTIRUST_TOOLCHAIN")) + .ok(); match (home, toolchain) { (Some(home), Some(toolchain)) => format!("{home}/toolchains/{toolchain}"), - _ => option_env!("RUST_SYSROOT") + _ => std::env::var("RUST_SYSROOT") .expect("need to specify RUST_SYSROOT env var or use rustup or multirust") .to_owned(), } diff --git a/mir-state-analysis/src/free_pcs/impl/engine.rs b/mir-state-analysis/src/free_pcs/impl/engine.rs index f3f85d8a00b..fdbcf85cc31 100644 --- a/mir-state-analysis/src/free_pcs/impl/engine.rs +++ b/mir-state-analysis/src/free_pcs/impl/engine.rs @@ -65,13 +65,26 @@ impl<'a, 'tcx> AnalysisDomain<'tcx> for FreePlaceCapabilitySummary<'a, 'tcx> { } impl<'a, 'tcx> Analysis<'tcx> for FreePlaceCapabilitySummary<'a, 'tcx> { - #[tracing::instrument(name = "FreePlaceCapabilitySummary::apply_before_statement_effect", level = "debug", skip(self))] - fn apply_before_statement_effect(&mut self, state: &mut Self::Domain, statement: &Statement<'tcx>, location: Location) { + #[tracing::instrument( + name = "FreePlaceCapabilitySummary::apply_before_statement_effect", + level = "debug", + skip(self) + )] + fn apply_before_statement_effect( + &mut self, + state: &mut Self::Domain, + statement: &Statement<'tcx>, + location: Location, + ) { state.repackings.clear(); state.apply_pre_effect = true; state.visit_statement(statement, location); } - #[tracing::instrument(name = "FreePlaceCapabilitySummary::apply_statement_effect", level = "debug", skip(self))] + #[tracing::instrument( + name = "FreePlaceCapabilitySummary::apply_statement_effect", + level = "debug", + skip(self) + )] fn apply_statement_effect( &mut self, state: &mut Self::Domain, @@ -83,7 +96,11 @@ impl<'a, 'tcx> Analysis<'tcx> for FreePlaceCapabilitySummary<'a, 'tcx> { state.visit_statement(statement, location); } - #[tracing::instrument(name = "FreePlaceCapabilitySummary::apply_before_terminator_effect", level = "debug", skip(self))] + #[tracing::instrument( + name = "FreePlaceCapabilitySummary::apply_before_terminator_effect", + level = "debug", + skip(self) + )] fn apply_before_terminator_effect( &mut self, state: &mut Self::Domain, @@ -94,7 +111,11 @@ impl<'a, 'tcx> Analysis<'tcx> for FreePlaceCapabilitySummary<'a, 'tcx> { state.apply_pre_effect = true; state.visit_terminator(terminator, location); } - #[tracing::instrument(name = "FreePlaceCapabilitySummary::apply_terminator_effect", level = "debug", skip(self))] + #[tracing::instrument( + name = "FreePlaceCapabilitySummary::apply_terminator_effect", + level = "debug", + skip(self) + )] fn apply_terminator_effect<'mir>( &mut self, state: &mut Self::Domain, diff --git a/mir-state-analysis/src/utils/repacker.rs b/mir-state-analysis/src/utils/repacker.rs index ad9a3ad8ba8..2bf86bdec2a 100644 --- a/mir-state-analysis/src/utils/repacker.rs +++ b/mir-state-analysis/src/utils/repacker.rs @@ -10,7 +10,8 @@ use prusti_rustc_interface::{ index::bit_set::BitSet, middle::{ mir::{ - tcx::PlaceTy, Body, HasLocalDecls, Local, Mutability, Place as MirPlace, ProjectionElem, PlaceRef, + tcx::PlaceTy, Body, HasLocalDecls, Local, Mutability, Place as MirPlace, PlaceRef, + ProjectionElem, }, ty::{TyCtxt, TyKind}, }, @@ -326,7 +327,7 @@ impl<'tcx> Place<'tcx> { // } pub fn ty(self, repacker: PlaceRepacker<'_, 'tcx>) -> PlaceTy<'tcx> { - PlaceRef::ty(&*self, repacker.mir, repacker.tcx) + PlaceRef::ty(&self, repacker.mir, repacker.tcx) } /// Should only be called on a `Place` obtained from `RootPlace::get_parent`.