html_root_url = "http://doc.rust-lang.org/master/")]
#![allow(deprecated)]
-#![feature(macro_rules, globs, struct_variant, managed_boxes, quote)]
+#![feature(macro_rules, globs, struct_variant, quote)]
#![feature(default_type_params, phase, unsafe_destructor)]
#![allow(unknown_features)] // NOTE: Remove after next snapshot
use libc;
use std::io::Seek;
use std::mem;
-use std::gc::GC;
use std::rc::Rc;
use rbml::io::SeekableMemWriter;
def::DefPrimTy(p) => def::DefPrimTy(p),
def::DefTyParam(s, did, v) => def::DefTyParam(s, did.tr(dcx), v),
def::DefUse(did) => def::DefUse(did.tr(dcx)),
- def::DefUpvar(nid1, def, depth, nid2, nid3) => {
+ def::DefUpvar(nid1, nid2, nid3) => {
def::DefUpvar(dcx.tr_id(nid1),
- box(GC) (*def).tr(dcx),
- depth,
dcx.tr_id(nid2),
dcx.tr_id(nid3))
}
use syntax::ast;
use syntax::ast_util::local_def;
-use std::gc::Gc;
-
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Def {
DefFn(ast::DefId, ast::FnStyle),
DefTyParam(ParamSpace, ast::DefId, uint),
DefUse(ast::DefId),
DefUpvar(ast::NodeId, // id of closed over local
- Gc<Def>, // closed over def
- u32, // number of closures implicitely capturing this local
ast::NodeId, // expr node that creates the closure
ast::NodeId), // block node for the closest enclosing proc
// or unboxed closure, DUMMY_NODE_ID otherwise
}
DefLocal(id) |
DefSelfTy(id) |
- DefUpvar(id, _, _, _, _) |
+ DefUpvar(id, _, _) |
DefRegion(id) |
DefTyParamBinder(id) |
DefLabel(id) => {
}))
}
- def::DefUpvar(var_id, _, _, fn_node_id, _) => {
+ def::DefUpvar(var_id, fn_node_id, _) => {
let ty = if_ok!(self.node_ty(fn_node_id));
match ty::get(ty).sty {
ty::ty_closure(ref closure_ty) => {
use std::collections::{HashMap, HashSet};
use std::cell::{Cell, RefCell};
-use std::gc::GC;
use std::mem::replace;
use std::rc::{Rc, Weak};
use std::uint;
DlDef(d @ DefLocal(_)) => {
let node_id = d.def_id().node;
let mut def = d;
- let mut depth = 0;
let mut last_proc_body_id = ast::DUMMY_NODE_ID;
for rib in ribs.iter() {
match rib.kind {
if maybe_proc_body != ast::DUMMY_NODE_ID {
last_proc_body_id = maybe_proc_body;
}
- def = DefUpvar(node_id, box(GC) def,
- depth, function_id, last_proc_body_id);
- depth += 1;
+ def = DefUpvar(node_id, function_id, last_proc_body_id);
let mut seen = self.freevars_seen.borrow_mut();
let seen = seen.find_or_insert(function_id, NodeSet::new());
fn is_discr_reassigned(bcx: Block, discr: &ast::Expr, body: &ast::Expr) -> bool {
match discr.node {
ast::ExprPath(..) => match bcx.def(discr.id) {
- def::DefLocal(vid) | def::DefUpvar(vid, _, _, _, _) => {
+ def::DefLocal(vid) | def::DefUpvar(vid, _, _) => {
let mut rc = ReassignmentChecker {
node: vid,
reassigned: false
let _icx = push_ctxt("trans_local_var");
match def {
- def::DefUpvar(nid, _, _, _, _) => {
+ def::DefUpvar(nid, _, _) => {
// Can't move upvars, so this is never a ZeroMemLastUse.
let local_ty = node_id_type(bcx, nid);
match bcx.fcx.llupvars.borrow().find(&nid) {
defn: def::Def)
-> Polytype {
match defn {
- def::DefLocal(nid) | def::DefUpvar(nid, _, _, _, _) => {
+ def::DefLocal(nid) | def::DefUpvar(nid, _, _) => {
let typ = fcx.local_ty(sp, nid);
return no_params(typ);
}
def::DefLocal(node_id) => {
tcx.region_maps.var_region(node_id)
}
- def::DefUpvar(node_id, _, _, _, body_id) => {
+ def::DefUpvar(node_id, _, body_id) => {
if body_id == ast::DUMMY_NODE_ID {
tcx.region_maps.var_region(node_id)
} else {
// determining the final borrow_kind) and propagate that as
// a constraint on the outer closure.
match freevar.def {
- def::DefUpvar(var_id, _, _, outer_closure_id, _) => {
+ def::DefUpvar(var_id, outer_closure_id, _) => {
// thing being captured is itself an upvar:
let outer_upvar_id = ty::UpvarId {
var_id: var_id,