diff options
| author | Ms2ger <Ms2ger@gmail.com> | 2015-12-15 16:15:59 +0100 |
|---|---|---|
| committer | Ms2ger <Ms2ger@gmail.com> | 2015-12-15 16:15:59 +0100 |
| commit | 9a0ab50ac08a01cea1d4170fa90dc851f42971c7 (patch) | |
| tree | dd887d30c08b86cdde0780e92b7c64490b72a150 | |
| parent | 9e63cecb10a3a22abed9c230c5daf268dc258bf3 (diff) | |
| download | rust-9a0ab50ac08a01cea1d4170fa90dc851f42971c7.tar.gz rust-9a0ab50ac08a01cea1d4170fa90dc851f42971c7.zip | |
Stop re-exporting RestrictionResult variants.
| -rw-r--r-- | src/librustc_borrowck/borrowck/gather_loans/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_borrowck/borrowck/gather_loans/restrictions.rs | 22 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 47f29a26db1..c07a27043c2 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -33,6 +33,8 @@ use rustc_front::hir::{Expr, FnDecl, Block, Pat}; use rustc_front::intravisit; use rustc_front::intravisit::Visitor; +use self::restrictions::RestrictionResult; + mod lifetime; mod restrictions; mod gather_moves; @@ -354,12 +356,12 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { // Create the loan record (if needed). let loan = match restr { - restrictions::Safe => { + RestrictionResult::Safe => { // No restrictions---no loan record necessary return; } - restrictions::SafeIf(loan_path, restricted_paths) => { + RestrictionResult::SafeIf(loan_path, restricted_paths) => { let loan_scope = match loan_region { ty::ReScope(scope) => scope, diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index cb75180b474..2a0d8ef2766 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -10,8 +10,6 @@ //! Computes the restrictions that result from a borrow. -pub use self::RestrictionResult::*; - use borrowck::*; use rustc::middle::expr_use_visitor as euv; use rustc::middle::mem_categorization as mc; @@ -69,19 +67,19 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { // are inherently non-aliasable, they can only be // accessed later through the borrow itself and hence // must inherently comply with its terms. - Safe + RestrictionResult::Safe } Categorization::Local(local_id) => { // R-Variable, locally declared let lp = new_lp(LpVar(local_id)); - SafeIf(lp.clone(), vec![lp]) + RestrictionResult::SafeIf(lp.clone(), vec![lp]) } Categorization::Upvar(mc::Upvar { id, .. }) => { // R-Variable, captured into closure let lp = new_lp(LpUpvar(id)); - SafeIf(lp.clone(), vec![lp]) + RestrictionResult::SafeIf(lp.clone(), vec![lp]) } Categorization::Downcast(cmt_base, _) => { @@ -106,7 +104,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { } Categorization::StaticItem => { - Safe + RestrictionResult::Safe } Categorization::Deref(cmt_base, _, pk) => { @@ -133,11 +131,11 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { cmt: cmt_base, code: err_borrowed_pointer_too_short( self.loan_region, lt)}); - return Safe; + return RestrictionResult::Safe; } match bk { - ty::ImmBorrow => Safe, + ty::ImmBorrow => RestrictionResult::Safe, ty::MutBorrow | ty::UniqueImmBorrow => { // R-Deref-Mut-Borrowed // @@ -150,7 +148,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { } } // Borrowck is not relevant for raw pointers - mc::UnsafePtr(..) => Safe + mc::UnsafePtr(..) => RestrictionResult::Safe } } } @@ -161,12 +159,12 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { cmt: &mc::cmt<'tcx>, elem: LoanPathElem) -> RestrictionResult<'tcx> { match result { - Safe => Safe, - SafeIf(base_lp, mut base_vec) => { + RestrictionResult::Safe => RestrictionResult::Safe, + RestrictionResult::SafeIf(base_lp, mut base_vec) => { let v = LpExtend(base_lp, cmt.mutbl, elem); let lp = Rc::new(LoanPath::new(v, cmt.ty)); base_vec.push(lp.clone()); - SafeIf(lp, base_vec) + RestrictionResult::SafeIf(lp, base_vec) } } } |
