ty::ty_unboxed_vec(mt) => { mywrite!(w, "U"); enc_mt(w, cx, mt); }
ty::ty_closure(ref f) => {
mywrite!(w, "f");
- enc_closure_ty(w, cx, f);
+ enc_closure_ty(w, cx, *f);
}
ty::ty_bare_fn(ref f) => {
mywrite!(w, "F");
let fty = ty::node_id_to_type(cx.tcx, id);
match ty::get(fty).sty {
- ty::ty_closure(ty::ClosureTy {
+ ty::ty_closure(~ty::ClosureTy {
sigil: OwnedSigil,
bounds: bounds,
..
}) => {
b(|cx, fv| check_for_uniq(cx, fv, bounds))
}
- ty::ty_closure(ty::ClosureTy {
+ ty::ty_closure(~ty::ClosureTy {
sigil: ManagedSigil,
..
}) => {
// can't happen
fail!("internal error: saw closure with managed sigil (@fn)");
}
- ty::ty_closure(ty::ClosureTy {
+ ty::ty_closure(~ty::ClosureTy {
sigil: BorrowedSigil,
bounds: bounds,
region: region,
ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) |
ty::ty_vec(_, ty::vstore_uniq) |
ty::ty_str(ty::vstore_uniq) |
- ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => {
+ ty::ty_closure(~ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => {
Some(deref_ptr(OwnedPtr))
}
}
ty::ty_str(ty::vstore_slice(r)) |
- ty::ty_closure(ty::ClosureTy {sigil: ast::BorrowedSigil,
+ ty::ty_closure(~ty::ClosureTy {sigil: ast::BorrowedSigil,
region: r, ..}) => {
Some(deref_ptr(BorrowedPtr(ty::ImmBorrow, r)))
}
// noalias because the actual object pointer is nested.
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) |
- ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => {
+ ty::ty_closure(~ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => {
unsafe {
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
}
ty_ptr(mt),
ty_rptr(Region, mt),
ty_bare_fn(BareFnTy),
- ty_closure(ClosureTy),
+ ty_closure(~ClosureTy),
ty_trait(~TyTrait),
ty_struct(DefId, substs),
ty_tup(Vec<t>),
pub fn mk_tup(cx: &ctxt, ts: Vec<t>) -> t { mk_t(cx, ty_tup(ts)) }
pub fn mk_closure(cx: &ctxt, fty: ClosureTy) -> t {
- mk_t(cx, ty_closure(fty))
+ mk_t(cx, ty_closure(~fty))
}
pub fn mk_bare_fn(cx: &ctxt, fty: BareFnTy) -> t {
}
ty_closure(ref c) => {
- closure_contents(cx, c)
+ closure_contents(cx, *c)
}
ty_box(typ) => {
pub fn replace_fn_sig(cx: &ctxt, fsty: &sty, new_sig: FnSig) -> t {
match *fsty {
ty_bare_fn(ref f) => mk_bare_fn(cx, BareFnTy {sig: new_sig, ..*f}),
- ty_closure(ref f) => mk_closure(cx, ClosureTy {sig: new_sig, ..*f}),
+ ty_closure(ref f) => mk_closure(cx, ClosureTy {sig: new_sig, ..**f}),
ref s => {
cx.sess.bug(
format!("ty_fn_sig() called on non-fn type: {:?}", s));
ty::ty_closure(ref fty) => {
ty::mk_closure(tcx, ClosureTy {
sig: FnSig {output: ret_type, ..fty.sig.clone()},
- ..(*fty).clone()
+ ..(**fty).clone()
})
}
_ => {
ty::mk_closure(cx, ClosureTy {
sigil: BorrowedSigil,
region: r,
- ..(*fty).clone()
+ ..(**fty).clone()
})
}
ty::ty_bare_fn(this.fold_bare_fn_ty(f))
}
ty::ty_closure(ref f) => {
- ty::ty_closure(this.fold_closure_ty(f))
+ ty::ty_closure(~this.fold_closure_ty(*f))
}
ty::ty_rptr(r, ref tm) => {
ty::ty_rptr(this.fold_region(r),
let fn_sig = match *fn_sty {
ty::ty_bare_fn(ty::BareFnTy {sig: ref sig, ..}) |
- ty::ty_closure(ty::ClosureTy {sig: ref sig, ..}) => sig,
+ ty::ty_closure(~ty::ClosureTy {sig: ref sig, ..}) => sig,
_ => {
fcx.type_error_message(call_expr.span, |actual| {
format!("expected function but \
let tcx = rcx.fcx.tcx();
let function_type = rcx.resolve_node_type(expr.id);
match ty::get(function_type).sty {
- ty::ty_closure(ty::ClosureTy {
+ ty::ty_closure(~ty::ClosureTy {
sigil: ast::BorrowedSigil, region: region, ..}) => {
let freevars = freevars::get_freevars(tcx, expr.id);
if freevars.is_empty() {
rcx.set_repeating_scope(repeating_scope);
match ty::get(function_type).sty {
- ty::ty_closure(ty::ClosureTy {sigil: ast::BorrowedSigil, ..}) => {
+ ty::ty_closure(~ty::ClosureTy {sigil: ast::BorrowedSigil, ..}) => {
let freevars = freevars::get_freevars(tcx, expr.id);
propagate_upupvar_borrow_kind(rcx, expr, freevars);
}
});
}
- ty::ty_closure(ty::ClosureTy {sigil: ast::BorrowedSigil, ..}) => {
+ ty::ty_closure(~ty::ClosureTy {sigil: ast::BorrowedSigil, ..}) => {
return self.unpack_actual_value(a, |sty_a| {
self.coerce_borrowed_fn(a, sty_a, b)
});
ty::ClosureTy {
sigil: ast::BorrowedSigil,
region: r_borrow,
- ..fn_ty
+ .. *fn_ty
});
if_ok!(self.subtype(a_borrowed, b));
let a_closure = ty::mk_closure(self.get_ref().infcx.tcx,
ty::ClosureTy {
sig: fn_ty_a.sig.clone(),
- ..fn_ty_b
+ .. *fn_ty_b
});
if_ok!(self.subtype(a_closure, b));
Ok(Some(adj))
}
(&ty::ty_closure(ref a_fty), &ty::ty_closure(ref b_fty)) => {
- this.closure_tys(a_fty, b_fty).and_then(|fty| {
+ this.closure_tys(*a_fty, *b_fty).and_then(|fty| {
Ok(ty::mk_closure(tcx, fty))
})
}
self.add_constraints_from_sig(sig, variance);
}
- ty::ty_closure(ty::ClosureTy { sig: ref sig, region, .. }) => {
+ ty::ty_closure(~ty::ClosureTy { sig: ref sig, region, .. }) => {
let contra = self.contravariant(variance);
self.add_constraints_from_region(region, contra);
self.add_constraints_from_sig(sig, variance);
~"(" + strs.connect(",") + ")"
}
ty_closure(ref f) => {
- closure_to_str(cx, f)
+ closure_to_str(cx, *f)
}
ty_bare_fn(ref f) => {
bare_fn_to_str(cx, f.purity, f.abis, None, &f.sig)