*/
use middle::borrowck::*;
-use euv = middle::expr_use_visitor;
-use mc = middle::mem_categorization;
+use middle::expr_use_visitor as euv;
+use middle::mem_categorization as mc;
use middle::ty;
use util::ppaux::Repr;
use syntax::ast;
///////////////////////////////////////////////////////////////////////////
// Private
-struct GuaranteeLifetimeContext<'a> {
- bccx: &'a BorrowckCtxt<'a>,
+struct GuaranteeLifetimeContext<'a, 'tcx: 'a> {
+ bccx: &'a BorrowckCtxt<'a, 'tcx>,
// the node id of the function body for the enclosing item
item_scope_id: ast::NodeId,
cmt_original: mc::cmt
}
-impl<'a> GuaranteeLifetimeContext<'a> {
+impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
fn check(&self, cmt: &mc::cmt, discr_scope: Option<ast::NodeId>) -> R {
//! Main routine. Walks down `cmt` until we find the "guarantor".
mc::cat_rvalue(..) |
mc::cat_copied_upvar(..) | // L-Local
mc::cat_local(..) | // L-Local
- mc::cat_arg(..) | // L-Local
mc::cat_upvar(..) |
mc::cat_deref(_, _, mc::BorrowedPtr(..)) | // L-Deref-Borrowed
+ mc::cat_deref(_, _, mc::Implicit(..)) |
mc::cat_deref(_, _, mc::UnsafePtr(..)) => {
self.check_scope(self.scope(cmt))
}
mc::cat_static_item => {
ty::ReStatic
}
- mc::cat_local(local_id) |
- mc::cat_arg(local_id) => {
+ mc::cat_local(local_id) => {
ty::ReScope(self.bccx.tcx.region_maps.var_scope(local_id))
}
mc::cat_deref(_, _, mc::UnsafePtr(..)) => {
ty::ReStatic
}
- mc::cat_deref(_, _, mc::BorrowedPtr(_, r)) => {
+ mc::cat_deref(_, _, mc::BorrowedPtr(_, r)) |
+ mc::cat_deref(_, _, mc::Implicit(_, r)) => {
r
}
mc::cat_downcast(ref cmt) |