mem_categorization: freely_aliasable doesn't need to take TyCtxt.

This commit is contained in:
Eduard Burtescu 2016-03-11 02:33:46 +02:00
parent 6e290998c3
commit 8600a67782
2 changed files with 4 additions and 5 deletions

View File

@ -1389,8 +1389,7 @@ impl<'tcx> cmt_<'tcx> {
}
/// Returns `FreelyAliasable(_)` if this lvalue represents a freely aliasable pointer type.
pub fn freely_aliasable(&self, ctxt: &TyCtxt<'tcx>)
-> Aliasability {
pub fn freely_aliasable(&self) -> Aliasability {
// Maybe non-obvious: copied upvars can only be considered
// non-aliasable in once closures, since any other kind can be
// aliased and eventually recused.
@ -1403,11 +1402,11 @@ impl<'tcx> cmt_<'tcx> {
Categorization::Downcast(ref b, _) |
Categorization::Interior(ref b, _) => {
// Aliasability depends on base cmt
b.freely_aliasable(ctxt)
b.freely_aliasable()
}
Categorization::Deref(ref b, _, Unique) => {
let sub = b.freely_aliasable(ctxt);
let sub = b.freely_aliasable();
if b.mutbl.is_mutable() {
// Aliasability depends on base cmt alone
sub

View File

@ -178,7 +178,7 @@ fn check_aliasability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
req_kind: ty::BorrowKind)
-> Result<(),()> {
let aliasability = cmt.freely_aliasable(bccx.tcx);
let aliasability = cmt.freely_aliasable();
debug!("check_aliasability aliasability={:?} req_kind={:?}",
aliasability, req_kind);