Skip to content

Commit 4871a16

Browse files
committed
rustc: Remove root_map usage from lifetime
1 parent 3c1b1a3 commit 4871a16

File tree

3 files changed

+2
-115
lines changed

3 files changed

+2
-115
lines changed

src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
9090
Ok(())
9191
}
9292

93-
mc::cat_deref(ref base, derefs, mc::GcPtr) => {
93+
mc::cat_deref(ref base, _, mc::GcPtr) => {
9494
let base_scope = self.scope(base);
9595

9696
// L-Deref-Managed-Imm-User-Root
@@ -102,7 +102,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
102102
if !omit_root {
103103
// L-Deref-Managed-Imm-Compiler-Root
104104
// L-Deref-Managed-Mut-Compiler-Root
105-
self.check_root(cmt, base, derefs, discr_scope)
105+
Err(())
106106
} else {
107107
debug!("omitting root, base={}, base_scope={:?}",
108108
base.repr(self.tcx()), base_scope);
@@ -187,61 +187,6 @@ impl<'a> GuaranteeLifetimeContext<'a> {
187187
}
188188
}
189189

190-
fn check_root(&self,
191-
cmt_deref: &mc::cmt,
192-
cmt_base: &mc::cmt,
193-
derefs: uint,
194-
discr_scope: Option<ast::NodeId>) -> R {
195-
debug!("check_root(cmt_deref={}, cmt_base={}, derefs={:?}, \
196-
discr_scope={:?})",
197-
cmt_deref.repr(self.tcx()),
198-
cmt_base.repr(self.tcx()),
199-
derefs,
200-
discr_scope);
201-
202-
// Make sure that the loan does not exceed the maximum time
203-
// that we can root the value, dynamically.
204-
let root_region = ty::ReScope(self.root_scope_id);
205-
if !self.bccx.is_subregion_of(self.loan_region, root_region) {
206-
return Err(self.report_error(
207-
err_out_of_root_scope(root_region, self.loan_region)));
208-
}
209-
210-
// Extract the scope id that indicates how long the rooting is required
211-
let root_scope = match self.loan_region {
212-
ty::ReScope(id) => id,
213-
_ => {
214-
// the check above should fail for anything is not ReScope
215-
self.bccx.tcx.sess.span_bug(
216-
cmt_base.span,
217-
format!("cannot issue root for scope region: {:?}",
218-
self.loan_region));
219-
}
220-
};
221-
222-
// If inside of a match arm, expand the rooting to the entire
223-
// match. See the detailed discussion in `check()` above.
224-
let root_scope = match discr_scope {
225-
None => root_scope,
226-
Some(id) => {
227-
if self.bccx.is_subscope_of(root_scope, id) {
228-
id
229-
} else {
230-
root_scope
231-
}
232-
}
233-
};
234-
235-
// Add a record of what is required
236-
let rm_key = root_map_key {id: cmt_deref.id, derefs: derefs};
237-
let root_info = RootInfo {scope: root_scope};
238-
239-
self.bccx.root_map.borrow_mut().insert(rm_key, root_info);
240-
241-
debug!("root_key: {:?} root_info: {:?}", rm_key, root_info);
242-
Ok(())
243-
}
244-
245190
fn check_scope(&self, max_scope: ty::Region) -> R {
246191
//! Reports an error if `loan_region` is larger than `valid_scope`
247192

src/test/compile-fail/regions-infer-borrow-scope-too-big.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)