Skip to content

Commit

Permalink
fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Nov 13, 2023
1 parent 87d41e8 commit 09dcd1e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
12 changes: 8 additions & 4 deletions analysis/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down
31 changes: 26 additions & 5 deletions mir-state-analysis/src/free_pcs/impl/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions mir-state-analysis/src/utils/repacker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 09dcd1e

Please sign in to comment.