Skip to content

Commit

Permalink
make some things public for the benefit of priroda
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 24, 2018
1 parent 356369d commit a34b9c7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ use range_map::RangeMap;
#[allow(unused_imports)] // FIXME rustc bug https://github.com/rust-lang/rust/issues/53682
use helpers::{ScalarExt, EvalContextExt as HelpersEvalContextExt};
use mono_hash_map::MonoHashMap;
use stacked_borrows::{EvalContextExt as StackedBorEvalContextExt, Borrow};
use stacked_borrows::{EvalContextExt as StackedBorEvalContextExt};

// Used by priroda
pub use stacked_borrows::{Borrow, Stacks, Mut as MutBorrow};

// Used by priroda
pub fn create_ecx<'a, 'mir: 'a, 'tcx: 'mir>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
main_id: DefId,
Expand Down
22 changes: 19 additions & 3 deletions src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ pub enum Mut {

impl Mut {
#[inline(always)]
fn is_raw(self) -> bool {
pub fn is_raw(self) -> bool {
match self {
Mut::Raw => true,
_ => false,
}
}

#[inline(always)]
pub fn is_uniq(self) -> bool {
match self {
Mut::Uniq(_) => true,
_ => false,
}
}
}

/// Information about any kind of borrow
Expand All @@ -40,9 +48,17 @@ pub enum Borrow {

impl Borrow {
#[inline(always)]
fn is_uniq(self) -> bool {
pub fn is_uniq(self) -> bool {
match self {
Borrow::Mut(m) => m.is_uniq(),
_ => false,
}
}

#[inline(always)]
pub fn is_frz(self) -> bool {
match self {
Borrow::Mut(Mut::Uniq(_)) => true,
Borrow::Frz(_) => true,
_ => false,
}
}
Expand Down

0 comments on commit a34b9c7

Please sign in to comment.