rustc: Remove ty::arg
This commit is contained in:
parent
191fdda46a
commit
9c80cf548a
@ -653,7 +653,7 @@ pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
|
||||
item, tcx, cdata);
|
||||
let name = item_name(intr, item);
|
||||
let arg_tys = match ty::get(ctor_ty).sty {
|
||||
ty::ty_bare_fn(ref f) => f.sig.inputs.map(|a| a.ty),
|
||||
ty::ty_bare_fn(ref f) => copy f.sig.inputs,
|
||||
_ => ~[], // Nullary enum variant.
|
||||
};
|
||||
match variant_disr_val(item) {
|
||||
|
@ -126,12 +126,6 @@ pub fn parse_trait_ref_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ct
|
||||
parse_trait_ref(st, conv)
|
||||
}
|
||||
|
||||
pub fn parse_arg_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
|
||||
conv: conv_did) -> ty::arg {
|
||||
let st = parse_state_from_data(data, crate_num, pos, tcx);
|
||||
parse_arg(st, conv)
|
||||
}
|
||||
|
||||
fn parse_path(st: @mut PState) -> @ast::Path {
|
||||
let mut idents: ~[ast::ident] = ~[];
|
||||
fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
|
||||
@ -471,12 +465,6 @@ fn parse_onceness(c: char) -> ast::Onceness {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_arg(st: @mut PState, conv: conv_did) -> ty::arg {
|
||||
ty::arg {
|
||||
ty: parse_ty(st, conv)
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_closure_ty(st: @mut PState, conv: conv_did) -> ty::ClosureTy {
|
||||
let sigil = parse_sigil(st);
|
||||
let purity = parse_purity(next(st));
|
||||
@ -505,9 +493,9 @@ fn parse_bare_fn_ty(st: @mut PState, conv: conv_did) -> ty::BareFnTy {
|
||||
|
||||
fn parse_sig(st: @mut PState, conv: conv_did) -> ty::FnSig {
|
||||
assert!((next(st) == '['));
|
||||
let mut inputs: ~[ty::arg] = ~[];
|
||||
let mut inputs = ~[];
|
||||
while peek(st) != ']' {
|
||||
inputs.push(ty::arg { ty: parse_ty(st, conv) });
|
||||
inputs.push(parse_ty(st, conv));
|
||||
}
|
||||
st.pos += 1u; // eat the ']'
|
||||
let ret_ty = parse_ty(st, conv);
|
||||
|
@ -344,10 +344,6 @@ fn enc_sigil(w: @io::Writer, sigil: Sigil) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enc_arg(w: @io::Writer, cx: @ctxt, arg: ty::arg) {
|
||||
enc_ty(w, cx, arg.ty);
|
||||
}
|
||||
|
||||
fn enc_purity(w: @io::Writer, p: purity) {
|
||||
match p {
|
||||
pure_fn => w.write_char('p'),
|
||||
@ -389,8 +385,8 @@ fn enc_closure_ty(w: @io::Writer, cx: @ctxt, ft: &ty::ClosureTy) {
|
||||
|
||||
fn enc_fn_sig(w: @io::Writer, cx: @ctxt, fsig: &ty::FnSig) {
|
||||
w.write_char('[');
|
||||
for fsig.inputs.each |arg| {
|
||||
enc_arg(w, cx, *arg);
|
||||
for fsig.inputs.each |ty| {
|
||||
enc_ty(w, cx, *ty);
|
||||
}
|
||||
w.write_char(']');
|
||||
enc_ty(w, cx, fsig.output);
|
||||
|
@ -526,8 +526,8 @@ fn encode_method_map_entry(ecx: @e::EncodeContext,
|
||||
ebml_w: &mut writer::Encoder,
|
||||
mme: method_map_entry) {
|
||||
do ebml_w.emit_struct("method_map_entry", 3) |ebml_w| {
|
||||
do ebml_w.emit_struct_field("self_arg", 0u) |ebml_w| {
|
||||
ebml_w.emit_arg(ecx, mme.self_arg);
|
||||
do ebml_w.emit_struct_field("self_ty", 0u) |ebml_w| {
|
||||
ebml_w.emit_ty(ecx, mme.self_ty);
|
||||
}
|
||||
do ebml_w.emit_struct_field("explicit_self", 2u) |ebml_w| {
|
||||
mme.explicit_self.encode(ebml_w);
|
||||
@ -546,8 +546,8 @@ impl read_method_map_entry_helper for reader::Decoder {
|
||||
-> method_map_entry {
|
||||
do self.read_struct("method_map_entry", 3) |this| {
|
||||
method_map_entry {
|
||||
self_arg: this.read_struct_field("self_arg", 0, |this| {
|
||||
this.read_arg(xcx)
|
||||
self_ty: this.read_struct_field("self_ty", 0u, |this| {
|
||||
this.read_ty(xcx)
|
||||
}),
|
||||
explicit_self: this.read_struct_field("explicit_self",
|
||||
2,
|
||||
@ -712,7 +712,6 @@ impl get_ty_str_ctxt for e::EncodeContext {
|
||||
}
|
||||
|
||||
trait ebml_writer_helpers {
|
||||
fn emit_arg(&mut self, ecx: @e::EncodeContext, arg: ty::arg);
|
||||
fn emit_ty(&mut self, ecx: @e::EncodeContext, ty: ty::t);
|
||||
fn emit_vstore(&mut self, ecx: @e::EncodeContext, vstore: ty::vstore);
|
||||
fn emit_tys(&mut self, ecx: @e::EncodeContext, tys: &[ty::t]);
|
||||
@ -737,12 +736,6 @@ impl ebml_writer_helpers for writer::Encoder {
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_arg(&mut self, ecx: @e::EncodeContext, arg: ty::arg) {
|
||||
do self.emit_opaque |this| {
|
||||
tyencode::enc_arg(this.writer, ecx.ty_str_ctxt(), arg);
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_tys(&mut self, ecx: @e::EncodeContext, tys: &[ty::t]) {
|
||||
do self.emit_from_vec(tys) |this, ty| {
|
||||
this.emit_ty(ecx, *ty)
|
||||
@ -943,7 +936,6 @@ impl doc_decoder_helpers for ebml::Doc {
|
||||
}
|
||||
|
||||
trait ebml_decoder_decoder_helpers {
|
||||
fn read_arg(&mut self, xcx: @ExtendedDecodeContext) -> ty::arg;
|
||||
fn read_ty(&mut self, xcx: @ExtendedDecodeContext) -> ty::t;
|
||||
fn read_tys(&mut self, xcx: @ExtendedDecodeContext) -> ~[ty::t];
|
||||
fn read_type_param_def(&mut self, xcx: @ExtendedDecodeContext)
|
||||
@ -958,17 +950,6 @@ trait ebml_decoder_decoder_helpers {
|
||||
}
|
||||
|
||||
impl ebml_decoder_decoder_helpers for reader::Decoder {
|
||||
fn read_arg(&mut self, xcx: @ExtendedDecodeContext) -> ty::arg {
|
||||
do self.read_opaque |this, doc| {
|
||||
tydecode::parse_arg_data(
|
||||
doc.data,
|
||||
xcx.dcx.cdata.cnum,
|
||||
doc.start,
|
||||
xcx.dcx.tcx,
|
||||
|s, a| this.convert_def_id(xcx, s, a))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_ty(&mut self, xcx: @ExtendedDecodeContext) -> ty::t {
|
||||
// Note: regions types embed local node ids. In principle, we
|
||||
// should translate these node ids into the new decode
|
||||
|
@ -32,12 +32,9 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
|
||||
let outputs = do ia.outputs.map |&(c, out)| {
|
||||
constraints.push(copy *c);
|
||||
|
||||
let aoutty = ty::arg {
|
||||
ty: expr_ty(bcx, out)
|
||||
};
|
||||
aoutputs.push(unpack_result!(bcx, {
|
||||
callee::trans_arg_expr(bcx,
|
||||
aoutty,
|
||||
expr_ty(bcx, out),
|
||||
ty::ByCopy,
|
||||
out,
|
||||
&mut cleanups,
|
||||
@ -50,13 +47,9 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
|
||||
_ => fail!("Expression must be addr of")
|
||||
};
|
||||
|
||||
let outty = ty::arg {
|
||||
ty: expr_ty(bcx, e)
|
||||
};
|
||||
|
||||
unpack_result!(bcx, {
|
||||
callee::trans_arg_expr(bcx,
|
||||
outty,
|
||||
expr_ty(bcx, e),
|
||||
ty::ByCopy,
|
||||
e,
|
||||
&mut cleanups,
|
||||
@ -75,13 +68,9 @@ pub fn trans_inline_asm(bcx: block, ia: &ast::inline_asm) -> block {
|
||||
let inputs = do ia.inputs.map |&(c, in)| {
|
||||
constraints.push(copy *c);
|
||||
|
||||
let inty = ty::arg {
|
||||
ty: expr_ty(bcx, in)
|
||||
};
|
||||
|
||||
unpack_result!(bcx, {
|
||||
callee::trans_arg_expr(bcx,
|
||||
inty,
|
||||
expr_ty(bcx, in),
|
||||
ty::ByCopy,
|
||||
in,
|
||||
&mut cleanups,
|
||||
|
@ -1701,7 +1701,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
|
||||
bcx: block,
|
||||
args: &[ast::arg],
|
||||
raw_llargs: &[ValueRef],
|
||||
arg_tys: &[ty::arg]) -> block {
|
||||
arg_tys: &[ty::t]) -> block {
|
||||
let _icx = fcx.insn_ctxt("copy_args_to_allocas");
|
||||
let mut bcx = bcx;
|
||||
|
||||
@ -1720,7 +1720,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
|
||||
}
|
||||
|
||||
for uint::range(0, arg_tys.len()) |arg_n| {
|
||||
let arg_ty = &arg_tys[arg_n];
|
||||
let arg_ty = arg_tys[arg_n];
|
||||
let raw_llarg = raw_llargs[arg_n];
|
||||
let arg_id = args[arg_n].id;
|
||||
|
||||
@ -1732,15 +1732,15 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
|
||||
// This alloca should be optimized away by LLVM's mem-to-reg pass in
|
||||
// the event it's not truly needed.
|
||||
// only by value if immediate:
|
||||
let llarg = if datum::appropriate_mode(arg_ty.ty).is_by_value() {
|
||||
let alloc = alloc_ty(bcx, arg_ty.ty);
|
||||
let llarg = if datum::appropriate_mode(arg_ty).is_by_value() {
|
||||
let alloc = alloc_ty(bcx, arg_ty);
|
||||
Store(bcx, raw_llarg, alloc);
|
||||
alloc
|
||||
} else {
|
||||
raw_llarg
|
||||
};
|
||||
|
||||
add_clean(bcx, llarg, arg_ty.ty);
|
||||
add_clean(bcx, llarg, arg_ty);
|
||||
|
||||
bcx = _match::bind_irrefutable_pat(bcx,
|
||||
args[arg_n].pat,
|
||||
@ -1987,7 +1987,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
|
||||
Some(&local_mem(x)) => x,
|
||||
_ => fail!("trans_enum_variant: how do we know this works?"),
|
||||
};
|
||||
let arg_ty = arg_tys[i].ty;
|
||||
let arg_ty = arg_tys[i];
|
||||
memcpy_ty(bcx, lldestptr, llarg, arg_ty);
|
||||
}
|
||||
build_return(bcx);
|
||||
@ -2061,7 +2061,7 @@ pub fn trans_tuple_struct(ccx: @CrateContext,
|
||||
local_mem")
|
||||
}
|
||||
};
|
||||
let arg_ty = arg_tys[i].ty;
|
||||
let arg_ty = arg_tys[i];
|
||||
memcpy_ty(bcx, lldestptr, llarg, arg_ty);
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ pub enum AutorefArg {
|
||||
// temp_cleanups: cleanups that should run only if failure occurs before the
|
||||
// call takes place:
|
||||
pub fn trans_arg_expr(bcx: block,
|
||||
formal_ty: ty::arg,
|
||||
formal_arg_ty: ty::t,
|
||||
self_mode: ty::SelfMode,
|
||||
arg_expr: @ast::expr,
|
||||
temp_cleanups: &mut ~[ValueRef],
|
||||
@ -683,9 +683,9 @@ pub fn trans_arg_expr(bcx: block,
|
||||
let _icx = bcx.insn_ctxt("trans_arg_expr");
|
||||
let ccx = bcx.ccx();
|
||||
|
||||
debug!("trans_arg_expr(formal_ty=(%s), self_mode=%?, arg_expr=%s, \
|
||||
debug!("trans_arg_expr(formal_arg_ty=(%s), self_mode=%?, arg_expr=%s, \
|
||||
ret_flag=%?)",
|
||||
formal_ty.ty.repr(bcx.tcx()),
|
||||
formal_arg_ty.repr(bcx.tcx()),
|
||||
self_mode,
|
||||
arg_expr.repr(bcx.tcx()),
|
||||
ret_flag.map(|v| bcx.val_str(*v)));
|
||||
@ -734,9 +734,9 @@ pub fn trans_arg_expr(bcx: block,
|
||||
// "undef" value, as such a value should never
|
||||
// be inspected. It's important for the value
|
||||
// to have type lldestty (the callee's expected type).
|
||||
let llformal_ty = type_of::type_of(ccx, formal_ty.ty);
|
||||
let llformal_arg_ty = type_of::type_of(ccx, formal_arg_ty);
|
||||
unsafe {
|
||||
val = llvm::LLVMGetUndef(llformal_ty);
|
||||
val = llvm::LLVMGetUndef(llformal_arg_ty);
|
||||
}
|
||||
} else {
|
||||
// FIXME(#3548) use the adjustments table
|
||||
@ -784,16 +784,16 @@ pub fn trans_arg_expr(bcx: block,
|
||||
}
|
||||
}
|
||||
|
||||
if formal_ty.ty != arg_datum.ty {
|
||||
if formal_arg_ty != arg_datum.ty {
|
||||
// this could happen due to e.g. subtyping
|
||||
let llformal_ty = type_of::type_of_explicit_arg(ccx, &formal_ty);
|
||||
let llformal_ty = match self_mode {
|
||||
ty::ByRef => T_ptr(llformal_ty),
|
||||
ty::ByCopy => llformal_ty,
|
||||
let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, &formal_arg_ty);
|
||||
let llformal_arg_ty = match self_mode {
|
||||
ty::ByRef => T_ptr(llformal_arg_ty),
|
||||
ty::ByCopy => llformal_arg_ty,
|
||||
};
|
||||
debug!("casting actual type (%s) to match formal (%s)",
|
||||
bcx.val_str(val), bcx.llty_str(llformal_ty));
|
||||
val = PointerCast(bcx, val, llformal_ty);
|
||||
bcx.val_str(val), bcx.llty_str(llformal_arg_ty));
|
||||
val = PointerCast(bcx, val, llformal_arg_ty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -785,7 +785,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span)
|
||||
cx.sess.span_bug(span, "debuginfo for rptr NYI")
|
||||
},
|
||||
ty::ty_bare_fn(ref barefnty) => {
|
||||
let inputs = do barefnty.sig.inputs.map |a| { a.ty };
|
||||
let inputs = barefnty.sig.inputs.map(|a| *a);
|
||||
let output = barefnty.sig.output;
|
||||
create_fn_ty(cx, t, inputs, output, span)
|
||||
},
|
||||
|
@ -29,7 +29,7 @@ use middle::trans::machine;
|
||||
use middle::trans::type_of::*;
|
||||
use middle::trans::type_of;
|
||||
use middle::ty;
|
||||
use middle::ty::{FnSig, arg};
|
||||
use middle::ty::FnSig;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use syntax::codemap::span;
|
||||
@ -94,7 +94,7 @@ fn foreign_signature(ccx: @CrateContext, fn_sig: &ty::FnSig)
|
||||
* values by pointer like we do.
|
||||
*/
|
||||
|
||||
let llarg_tys = fn_sig.inputs.map(|arg| type_of(ccx, arg.ty));
|
||||
let llarg_tys = fn_sig.inputs.map(|arg_ty| type_of(ccx, *arg_ty));
|
||||
let llret_ty = type_of::type_of(ccx, fn_sig.output);
|
||||
LlvmSignature {
|
||||
llarg_tys: llarg_tys,
|
||||
@ -820,7 +820,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
||||
region: ty::re_bound(ty::br_anon(0)),
|
||||
sig: FnSig {
|
||||
bound_lifetime_names: opt_vec::Empty,
|
||||
inputs: ~[ arg { ty: star_u8 } ],
|
||||
inputs: ~[ star_u8 ],
|
||||
output: ty::mk_nil()
|
||||
}
|
||||
});
|
||||
|
@ -25,7 +25,6 @@ use middle::trans::inline;
|
||||
use middle::trans::monomorphize;
|
||||
use middle::trans::type_of::*;
|
||||
use middle::ty;
|
||||
use middle::ty::arg;
|
||||
use middle::typeck;
|
||||
use util::common::indenter;
|
||||
use util::ppaux::Repr;
|
||||
@ -155,12 +154,10 @@ pub fn trans_self_arg(bcx: block,
|
||||
let mut temp_cleanups = ~[];
|
||||
|
||||
// Compute the type of self.
|
||||
let self_arg = arg {
|
||||
ty: monomorphize_type(bcx, mentry.self_arg.ty)
|
||||
};
|
||||
let self_ty = monomorphize_type(bcx, mentry.self_ty);
|
||||
|
||||
let result = trans_arg_expr(bcx,
|
||||
self_arg,
|
||||
self_ty,
|
||||
mentry.self_mode,
|
||||
base,
|
||||
&mut temp_cleanups,
|
||||
|
@ -284,13 +284,8 @@ pub impl Reflector {
|
||||
let sym = mangle_internal_name_by_path_and_seq(ccx,
|
||||
sub_path,
|
||||
"get_disr");
|
||||
let args = [
|
||||
ty::arg {
|
||||
ty: opaqueptrty
|
||||
}
|
||||
];
|
||||
|
||||
let llfty = type_of_fn(ccx, args, ty::mk_int());
|
||||
let llfty = type_of_fn(ccx, [opaqueptrty], ty::mk_int());
|
||||
let llfdecl = decl_internal_cdecl_fn(ccx.llmod, sym, llfty);
|
||||
let arg = unsafe {
|
||||
llvm::LLVMGetParam(llfdecl, first_real_arg as c_uint)
|
||||
@ -357,7 +352,7 @@ pub impl Reflector {
|
||||
let modeval = 5u; // "by copy"
|
||||
let extra = ~[self.c_uint(i),
|
||||
self.c_uint(modeval),
|
||||
self.c_tydesc(arg.ty)];
|
||||
self.c_tydesc(*arg)];
|
||||
self.visit(~"fn_input", extra);
|
||||
}
|
||||
let extra = ~[self.c_uint(retval),
|
||||
|
@ -19,21 +19,21 @@ use util::ppaux;
|
||||
|
||||
use syntax::ast;
|
||||
|
||||
pub fn arg_is_indirect(_: @CrateContext, arg: &ty::arg) -> bool {
|
||||
!ty::type_is_immediate(arg.ty)
|
||||
pub fn arg_is_indirect(_: @CrateContext, arg_ty: &ty::t) -> bool {
|
||||
!ty::type_is_immediate(*arg_ty)
|
||||
}
|
||||
|
||||
pub fn type_of_explicit_arg(ccx: @CrateContext, arg: &ty::arg) -> TypeRef {
|
||||
let llty = type_of(ccx, arg.ty);
|
||||
if arg_is_indirect(ccx, arg) {T_ptr(llty)} else {llty}
|
||||
pub fn type_of_explicit_arg(ccx: @CrateContext, arg_ty: &ty::t) -> TypeRef {
|
||||
let llty = type_of(ccx, *arg_ty);
|
||||
if arg_is_indirect(ccx, arg_ty) {T_ptr(llty)} else {llty}
|
||||
}
|
||||
|
||||
pub fn type_of_explicit_args(ccx: @CrateContext,
|
||||
inputs: &[ty::arg]) -> ~[TypeRef] {
|
||||
inputs.map(|arg| type_of_explicit_arg(ccx, arg))
|
||||
inputs: &[ty::t]) -> ~[TypeRef] {
|
||||
inputs.map(|arg_ty| type_of_explicit_arg(ccx, arg_ty))
|
||||
}
|
||||
|
||||
pub fn type_of_fn(cx: @CrateContext, inputs: &[ty::arg], output: ty::t)
|
||||
pub fn type_of_fn(cx: @CrateContext, inputs: &[ty::t], output: ty::t)
|
||||
-> TypeRef {
|
||||
unsafe {
|
||||
let mut atys: ~[TypeRef] = ~[];
|
||||
|
@ -78,7 +78,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
|
||||
ty::ty_bare_fn(ty::BareFnTy {sig: ref sig, _}) |
|
||||
ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => {
|
||||
for sig.inputs.each |arg| {
|
||||
type_needs(cx, use_repr, arg.ty);
|
||||
type_needs(cx, use_repr, *arg);
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
@ -331,17 +331,16 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
|
||||
node_type_needs(cx, use_tydesc, val.id);
|
||||
}
|
||||
expr_call(f, _, _) => {
|
||||
for ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx, f.id))).each |a| {
|
||||
type_needs(cx, use_repr, a.ty);
|
||||
for ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx, f.id)).each |a| {
|
||||
type_needs(cx, use_repr, *a);
|
||||
}
|
||||
}
|
||||
expr_method_call(rcvr, _, _, _, _) => {
|
||||
let base_ty = ty::node_id_to_type(cx.ccx.tcx, rcvr.id);
|
||||
type_needs(cx, use_repr, ty::type_autoderef(cx.ccx.tcx, base_ty));
|
||||
|
||||
for ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx,
|
||||
e.callee_id)).each |a| {
|
||||
type_needs(cx, use_repr, a.ty);
|
||||
for ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx, e.callee_id)).each |a| {
|
||||
type_needs(cx, use_repr, *a);
|
||||
}
|
||||
mark_for_method_call(cx, e.id, e.callee_id);
|
||||
}
|
||||
|
@ -47,11 +47,6 @@ use syntax;
|
||||
|
||||
// Data types
|
||||
|
||||
#[deriving(Eq, IterBytes)]
|
||||
pub struct arg {
|
||||
ty: t
|
||||
}
|
||||
|
||||
#[deriving(Eq)]
|
||||
pub struct field {
|
||||
ident: ast::ident,
|
||||
@ -392,7 +387,7 @@ pub struct ClosureTy {
|
||||
#[deriving(Eq)]
|
||||
pub struct FnSig {
|
||||
bound_lifetime_names: OptVec<ast::ident>,
|
||||
inputs: ~[arg],
|
||||
inputs: ~[t],
|
||||
output: t
|
||||
}
|
||||
|
||||
@ -1107,14 +1102,14 @@ fn mk_t(cx: ctxt, st: sty) -> t {
|
||||
}
|
||||
&ty_tup(ref ts) => for ts.each |tt| { flags |= get(*tt).flags; },
|
||||
&ty_bare_fn(ref f) => {
|
||||
for f.sig.inputs.each |a| { flags |= get(a.ty).flags; }
|
||||
for f.sig.inputs.each |a| { flags |= get(*a).flags; }
|
||||
flags |= get(f.sig.output).flags;
|
||||
// T -> _|_ is *not* _|_ !
|
||||
flags &= !(has_ty_bot as uint);
|
||||
}
|
||||
&ty_closure(ref f) => {
|
||||
flags |= rflags(f.region);
|
||||
for f.sig.inputs.each |a| { flags |= get(a.ty).flags; }
|
||||
for f.sig.inputs.each |a| { flags |= get(*a).flags; }
|
||||
flags |= get(f.sig.output).flags;
|
||||
// T -> _|_ is *not* _|_ !
|
||||
flags &= !(has_ty_bot as uint);
|
||||
@ -1298,7 +1293,7 @@ pub fn mk_bare_fn(cx: ctxt, fty: BareFnTy) -> t {
|
||||
}
|
||||
|
||||
pub fn mk_ctor_fn(cx: ctxt, input_tys: &[ty::t], output: ty::t) -> t {
|
||||
let input_args = input_tys.map(|t| arg { ty: *t });
|
||||
let input_args = input_tys.map(|t| *t);
|
||||
mk_bare_fn(cx,
|
||||
BareFnTy {
|
||||
purity: ast::pure_fn,
|
||||
@ -1372,11 +1367,11 @@ pub fn maybe_walk_ty(ty: t, f: &fn(t) -> bool) {
|
||||
}
|
||||
ty_tup(ref ts) => { for ts.each |tt| { maybe_walk_ty(*tt, f); } }
|
||||
ty_bare_fn(ref ft) => {
|
||||
for ft.sig.inputs.each |a| { maybe_walk_ty(a.ty, f); }
|
||||
for ft.sig.inputs.each |a| { maybe_walk_ty(*a, f); }
|
||||
maybe_walk_ty(ft.sig.output, f);
|
||||
}
|
||||
ty_closure(ref ft) => {
|
||||
for ft.sig.inputs.each |a| { maybe_walk_ty(a.ty, f); }
|
||||
for ft.sig.inputs.each |a| { maybe_walk_ty(*a, f); }
|
||||
maybe_walk_ty(ft.sig.output, f);
|
||||
}
|
||||
}
|
||||
@ -1387,11 +1382,7 @@ pub fn fold_sty_to_ty(tcx: ty::ctxt, sty: &sty, foldop: &fn(t) -> t) -> t {
|
||||
}
|
||||
|
||||
pub fn fold_sig(sig: &FnSig, fldop: &fn(t) -> t) -> FnSig {
|
||||
let args = do sig.inputs.map |arg| {
|
||||
arg {
|
||||
ty: fldop(arg.ty)
|
||||
}
|
||||
};
|
||||
let args = sig.inputs.map(|arg| fldop(*arg));
|
||||
|
||||
FnSig {
|
||||
bound_lifetime_names: copy sig.bound_lifetime_names,
|
||||
@ -2999,7 +2990,7 @@ pub fn ty_fn_sig(fty: t) -> FnSig {
|
||||
}
|
||||
|
||||
// Type accessors for substructures of types
|
||||
pub fn ty_fn_args(fty: t) -> ~[arg] {
|
||||
pub fn ty_fn_args(fty: t) -> ~[t] {
|
||||
match get(fty).sty {
|
||||
ty_bare_fn(ref f) => copy f.sig.inputs,
|
||||
ty_closure(ref f) => copy f.sig.inputs,
|
||||
@ -3103,7 +3094,7 @@ pub fn replace_closure_return_type(tcx: ctxt, fn_type: t, ret_type: t) -> t {
|
||||
|
||||
// Returns a vec of all the input and output types of fty.
|
||||
pub fn tys_in_fn_sig(sig: &FnSig) -> ~[t] {
|
||||
vec::append_one(sig.inputs.map(|a| a.ty), sig.output)
|
||||
vec::append_one(sig.inputs.map(|a| *a), sig.output)
|
||||
}
|
||||
|
||||
// Type accessors for AST nodes
|
||||
@ -4061,7 +4052,7 @@ pub fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[VariantInfo] {
|
||||
let ctor_ty = node_id_to_type(cx, variant.node.id);
|
||||
let arg_tys = {
|
||||
if args.len() > 0u {
|
||||
ty_fn_args(ctor_ty).map(|a| a.ty)
|
||||
ty_fn_args(ctor_ty).map(|a| *a)
|
||||
} else {
|
||||
~[]
|
||||
}
|
||||
|
@ -53,7 +53,7 @@
|
||||
*/
|
||||
|
||||
use middle::const_eval;
|
||||
use middle::ty::{arg, substs};
|
||||
use middle::ty::{substs};
|
||||
use middle::ty::{ty_param_substs_and_ty};
|
||||
use middle::ty;
|
||||
use middle::typeck::rscope::in_binding_rscope;
|
||||
@ -501,16 +501,12 @@ pub fn ty_of_arg<AC:AstConv,
|
||||
this: &AC,
|
||||
rscope: &RS,
|
||||
a: ast::arg,
|
||||
expected_ty: Option<ty::arg>)
|
||||
-> ty::arg {
|
||||
let ty = match a.ty.node {
|
||||
ast::ty_infer if expected_ty.is_some() => expected_ty.get().ty,
|
||||
expected_ty: Option<ty::t>)
|
||||
-> ty::t {
|
||||
match a.ty.node {
|
||||
ast::ty_infer if expected_ty.is_some() => expected_ty.get(),
|
||||
ast::ty_infer => this.ty_infer(a.ty.span),
|
||||
_ => ast_ty_to_ty(this, rscope, a.ty),
|
||||
};
|
||||
|
||||
arg {
|
||||
ty: ty
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1053,9 +1053,7 @@ pub impl<'self> LookupContext<'self> {
|
||||
self.fcx.write_ty(self.callee_id, fty);
|
||||
self.fcx.write_substs(self.callee_id, all_substs);
|
||||
method_map_entry {
|
||||
self_arg: arg {
|
||||
ty: candidate.rcvr_ty,
|
||||
},
|
||||
self_ty: candidate.rcvr_ty,
|
||||
self_mode: self_mode,
|
||||
explicit_self: candidate.method_ty.self_ty,
|
||||
origin: candidate.origin,
|
||||
|
@ -81,7 +81,7 @@ use middle::pat_util::pat_id_map;
|
||||
use middle::pat_util;
|
||||
use middle::ty::{FnSig, VariantInfo_};
|
||||
use middle::ty::{ty_param_bounds_and_ty, ty_param_substs_and_ty};
|
||||
use middle::ty::{substs, arg, param_ty};
|
||||
use middle::ty::{substs, param_ty};
|
||||
use middle::ty;
|
||||
use middle::typeck::astconv::AstConv;
|
||||
use middle::typeck::astconv::{ast_region_to_region, ast_ty_to_ty};
|
||||
@ -352,7 +352,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
|
||||
|
||||
relate_free_regions(tcx, opt_self_info.map(|s| s.self_ty), &fn_sig);
|
||||
|
||||
let arg_tys = fn_sig.inputs.map(|a| a.ty);
|
||||
let arg_tys = fn_sig.inputs.map(|a| *a);
|
||||
let ret_ty = fn_sig.output;
|
||||
|
||||
debug!("check_fn(arg_tys=%?, ret_ty=%?, opt_self_ty=%?)",
|
||||
@ -1192,7 +1192,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
fn check_argument_types(
|
||||
fcx: @mut FnCtxt,
|
||||
sp: span,
|
||||
fn_inputs: &[ty::arg],
|
||||
fn_inputs: &[ty::t],
|
||||
callee_expr: @ast::expr,
|
||||
args: &[@ast::expr],
|
||||
sugar: ast::CallSugar,
|
||||
@ -1211,7 +1211,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
let supplied_arg_count = args.len();
|
||||
let expected_arg_count = fn_inputs.len();
|
||||
let formal_tys = if expected_arg_count == supplied_arg_count {
|
||||
fn_inputs.map(|a| a.ty)
|
||||
fn_inputs.map(|a| *a)
|
||||
} else {
|
||||
let suffix = match sugar {
|
||||
ast::NoSugar => "",
|
||||
@ -1287,8 +1287,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
}
|
||||
}
|
||||
|
||||
fn err_args(len: uint) -> ~[ty::arg] {
|
||||
vec::from_fn(len, |_| ty::arg { ty: ty::mk_err() })
|
||||
fn err_args(len: uint) -> ~[ty::t] {
|
||||
vec::from_fn(len, |_| ty::mk_err())
|
||||
}
|
||||
|
||||
// A generic function for checking assignment expressions
|
||||
@ -1701,11 +1701,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
let fty = if error_happened {
|
||||
fty_sig = FnSig {
|
||||
bound_lifetime_names: opt_vec::Empty,
|
||||
inputs: fn_ty.sig.inputs.map(|_| {
|
||||
arg {
|
||||
ty: ty::mk_err()
|
||||
}
|
||||
}),
|
||||
inputs: fn_ty.sig.inputs.map(|_| ty::mk_err()),
|
||||
output: ty::mk_err()
|
||||
};
|
||||
ty::mk_err()
|
||||
@ -3132,24 +3128,23 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
|
||||
}
|
||||
disr_vals.push(*disr_val);
|
||||
let ctor_ty = ty::node_id_to_type(ccx.tcx, v.node.id);
|
||||
let arg_tys;
|
||||
|
||||
let this_disr_val = *disr_val;
|
||||
*disr_val += 1;
|
||||
|
||||
match v.node.kind {
|
||||
let arg_tys = match v.node.kind {
|
||||
ast::tuple_variant_kind(ref args) if args.len() > 0u => {
|
||||
arg_tys = Some(ty::ty_fn_args(ctor_ty).map(|a| a.ty));
|
||||
Some(ty::ty_fn_args(ctor_ty).map(|a| *a))
|
||||
}
|
||||
ast::tuple_variant_kind(_) => {
|
||||
arg_tys = Some(~[]);
|
||||
Some(~[])
|
||||
}
|
||||
ast::struct_variant_kind(_) => {
|
||||
arg_tys = Some(ty::lookup_struct_fields(
|
||||
Some(ty::lookup_struct_fields(
|
||||
ccx.tcx, local_def(v.node.id)).map(|cf|
|
||||
ty::node_id_to_type(ccx.tcx, cf.id.node)));
|
||||
ty::node_id_to_type(ccx.tcx, cf.id.node)))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
match arg_tys {
|
||||
None => {}
|
||||
@ -3454,11 +3449,6 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
fn param(ccx: @mut CrateCtxt, n: uint) -> ty::t {
|
||||
ty::mk_param(ccx.tcx, n, local_def(0))
|
||||
}
|
||||
fn arg(ty: ty::t) -> ty::arg {
|
||||
arg {
|
||||
ty: ty
|
||||
}
|
||||
}
|
||||
|
||||
let tcx = ccx.tcx;
|
||||
let (n_tps, inputs, output) = match *ccx.tcx.sess.str_of(it.ident) {
|
||||
@ -3466,15 +3456,13 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
~"pref_align_of" | ~"min_align_of" => (1u, ~[], ty::mk_uint()),
|
||||
~"init" => (1u, ~[], param(ccx, 0u)),
|
||||
~"uninit" => (1u, ~[], param(ccx, 0u)),
|
||||
~"forget" => (1u, ~[arg(param(ccx, 0u))], ty::mk_nil()),
|
||||
~"transmute" => (2, ~[ arg(param(ccx, 0)) ], param(ccx, 1)),
|
||||
~"forget" => (1u, ~[ param(ccx, 0) ], ty::mk_nil()),
|
||||
~"transmute" => (2, ~[ param(ccx, 0) ], param(ccx, 1)),
|
||||
~"move_val" | ~"move_val_init" => {
|
||||
(1u,
|
||||
~[
|
||||
arg(ty::mk_mut_rptr(tcx,
|
||||
ty::re_bound(ty::br_anon(0)),
|
||||
param(ccx, 0))),
|
||||
arg(param(ccx, 0u))
|
||||
ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)), param(ccx, 0)),
|
||||
param(ccx, 0u)
|
||||
],
|
||||
ty::mk_nil())
|
||||
}
|
||||
@ -3483,30 +3471,26 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
~"atomic_cxchg" | ~"atomic_cxchg_acq"| ~"atomic_cxchg_rel" => {
|
||||
(0,
|
||||
~[
|
||||
arg(ty::mk_mut_rptr(tcx,
|
||||
ty::re_bound(ty::br_anon(0)),
|
||||
ty::mk_int())),
|
||||
arg(ty::mk_int()),
|
||||
arg(ty::mk_int())
|
||||
ty::mk_mut_rptr(tcx,
|
||||
ty::re_bound(ty::br_anon(0)),
|
||||
ty::mk_int()),
|
||||
ty::mk_int(),
|
||||
ty::mk_int()
|
||||
],
|
||||
ty::mk_int())
|
||||
}
|
||||
~"atomic_load" | ~"atomic_load_acq" => {
|
||||
(0,
|
||||
~[
|
||||
arg(ty::mk_imm_rptr(tcx,
|
||||
ty::re_bound(ty::br_anon(0)),
|
||||
ty::mk_int()))
|
||||
ty::mk_imm_rptr(tcx, ty::re_bound(ty::br_anon(0)), ty::mk_int())
|
||||
],
|
||||
ty::mk_int())
|
||||
}
|
||||
~"atomic_store" | ~"atomic_store_rel" => {
|
||||
(0,
|
||||
~[
|
||||
arg(ty::mk_mut_rptr(tcx,
|
||||
ty::re_bound(ty::br_anon(0)),
|
||||
ty::mk_int())),
|
||||
arg(ty::mk_int())
|
||||
ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)), ty::mk_int()),
|
||||
ty::mk_int()
|
||||
],
|
||||
ty::mk_nil())
|
||||
}
|
||||
@ -3515,10 +3499,8 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
~"atomic_xchg_rel" | ~"atomic_xadd_rel" | ~"atomic_xsub_rel" => {
|
||||
(0,
|
||||
~[
|
||||
arg(ty::mk_mut_rptr(tcx,
|
||||
ty::re_bound(ty::br_anon(0)),
|
||||
ty::mk_int())),
|
||||
arg(ty::mk_int())
|
||||
ty::mk_mut_rptr(tcx, ty::re_bound(ty::br_anon(0)), ty::mk_int()),
|
||||
ty::mk_int()
|
||||
],
|
||||
ty::mk_int())
|
||||
}
|
||||
@ -3536,7 +3518,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
ty: tydesc_ty,
|
||||
mutbl: ast::m_imm
|
||||
});
|
||||
(0, ~[ arg(td_ptr), arg(visitor_object_ty) ], ty::mk_nil())
|
||||
(0, ~[ td_ptr, visitor_object_ty ], ty::mk_nil())
|
||||
}
|
||||
~"frame_address" => {
|
||||
let fty = ty::mk_closure(ccx.tcx, ty::ClosureTy {
|
||||
@ -3546,16 +3528,11 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
region: ty::re_bound(ty::br_anon(0)),
|
||||
sig: ty::FnSig {
|
||||
bound_lifetime_names: opt_vec::Empty,
|
||||
inputs: ~[
|
||||
arg {
|
||||
ty: ty::mk_imm_ptr(ccx.tcx,
|
||||
ty::mk_mach_uint(ast::ty_u8))
|
||||
}
|
||||
],
|
||||
inputs: ~[ty::mk_imm_ptr(ccx.tcx, ty::mk_mach_uint(ast::ty_u8))],
|
||||
output: ty::mk_nil()
|
||||
}
|
||||
});
|
||||
(0u, ~[ arg(fty) ], ty::mk_nil())
|
||||
(0u, ~[fty], ty::mk_nil())
|
||||
}
|
||||
~"morestack_addr" => {
|
||||
(0u, ~[], ty::mk_nil_ptr(ccx.tcx))
|
||||
@ -3563,101 +3540,102 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
|
||||
~"memmove32" => {
|
||||
(0,
|
||||
~[
|
||||
arg(ty::mk_ptr(tcx, ty::mt {
|
||||
ty::mk_ptr(tcx, ty::mt {
|
||||
ty: ty::mk_u8(),
|
||||
mutbl: ast::m_mutbl
|
||||
})),
|
||||
arg(ty::mk_ptr(tcx, ty::mt {
|
||||
}),
|
||||
ty::mk_ptr(tcx, ty::mt {
|
||||
ty: ty::mk_u8(),
|
||||
mutbl: ast::m_imm
|
||||
})),
|
||||
arg(ty::mk_u32())
|
||||
}),
|
||||
ty::mk_u32()
|
||||
],
|
||||
ty::mk_nil())
|
||||
}
|
||||
~"memmove64" => {
|
||||
(0,
|
||||
~[arg(ty::mk_ptr(tcx, ty::mt {
|
||||
ty: ty::mk_u8(),
|
||||
mutbl: ast::m_mutbl
|
||||
})),
|
||||
arg(ty::mk_ptr(tcx, ty::mt {
|
||||
ty: ty::mk_u8(),
|
||||
mutbl: ast::m_imm
|
||||
})),
|
||||
arg(ty::mk_u64())
|
||||
~[
|
||||
ty::mk_ptr(tcx, ty::mt {
|
||||
ty: ty::mk_u8(),
|
||||
mutbl: ast::m_mutbl
|
||||
}),
|
||||
ty::mk_ptr(tcx, ty::mt {
|
||||
ty: ty::mk_u8(),
|
||||
mutbl: ast::m_imm
|
||||
}),
|
||||
ty::mk_u64()
|
||||
],
|
||||
ty::mk_nil())
|
||||
}
|
||||
~"sqrtf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"sqrtf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"sqrtf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"sqrtf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"powif32" => {
|
||||
(0,
|
||||
~[ arg(ty::mk_f32()), arg(ty::mk_i32()) ],
|
||||
~[ ty::mk_f32(), ty::mk_i32() ],
|
||||
ty::mk_f32())
|
||||
}
|
||||
~"powif64" => {
|
||||
(0,
|
||||
~[ arg(ty::mk_f64()), arg(ty::mk_i32()) ],
|
||||
~[ ty::mk_f64(), ty::mk_i32() ],
|
||||
ty::mk_f64())
|
||||
}
|
||||
~"sinf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"sinf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"cosf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"cosf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"sinf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"sinf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"cosf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"cosf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"powf32" => {
|
||||
(0,
|
||||
~[ arg(ty::mk_f32()), arg(ty::mk_f32()) ],
|
||||
~[ ty::mk_f32(), ty::mk_f32() ],
|
||||
ty::mk_f32())
|
||||
}
|
||||
~"powf64" => {
|
||||
(0,
|
||||
~[ arg(ty::mk_f64()), arg(ty::mk_f64()) ],
|
||||
~[ ty::mk_f64(), ty::mk_f64() ],
|
||||
ty::mk_f64())
|
||||
}
|
||||
~"expf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"expf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"exp2f32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"exp2f64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"logf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"logf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"log10f32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"log10f64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"log2f32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"log2f64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"expf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"expf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"exp2f32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"exp2f64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"logf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"logf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"log10f32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"log10f64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"log2f32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"log2f64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"fmaf32" => {
|
||||
(0,
|
||||
~[ arg(ty::mk_f32()), arg(ty::mk_f32()), arg(ty::mk_f32()) ],
|
||||
~[ ty::mk_f32(), ty::mk_f32(), ty::mk_f32() ],
|
||||
ty::mk_f32())
|
||||
}
|
||||
~"fmaf64" => {
|
||||
(0,
|
||||
~[ arg(ty::mk_f64()), arg(ty::mk_f64()), arg(ty::mk_f64()) ],
|
||||
~[ ty::mk_f64(), ty::mk_f64(), ty::mk_f64() ],
|
||||
ty::mk_f64())
|
||||
}
|
||||
~"fabsf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"fabsf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"floorf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"floorf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"ceilf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"ceilf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"truncf32" => (0, ~[ arg(ty::mk_f32()) ], ty::mk_f32()),
|
||||
~"truncf64" => (0, ~[ arg(ty::mk_f64()) ], ty::mk_f64()),
|
||||
~"ctpop8" => (0, ~[ arg(ty::mk_i8()) ], ty::mk_i8()),
|
||||
~"ctpop16" => (0, ~[ arg(ty::mk_i16()) ], ty::mk_i16()),
|
||||
~"ctpop32" => (0, ~[ arg(ty::mk_i32()) ], ty::mk_i32()),
|
||||
~"ctpop64" => (0, ~[ arg(ty::mk_i64()) ], ty::mk_i64()),
|
||||
~"ctlz8" => (0, ~[ arg(ty::mk_i8()) ], ty::mk_i8()),
|
||||
~"ctlz16" => (0, ~[ arg(ty::mk_i16()) ], ty::mk_i16()),
|
||||
~"ctlz32" => (0, ~[ arg(ty::mk_i32()) ], ty::mk_i32()),
|
||||
~"ctlz64" => (0, ~[ arg(ty::mk_i64()) ], ty::mk_i64()),
|
||||
~"cttz8" => (0, ~[ arg(ty::mk_i8()) ], ty::mk_i8()),
|
||||
~"cttz16" => (0, ~[ arg(ty::mk_i16()) ], ty::mk_i16()),
|
||||
~"cttz32" => (0, ~[ arg(ty::mk_i32()) ], ty::mk_i32()),
|
||||
~"cttz64" => (0, ~[ arg(ty::mk_i64()) ], ty::mk_i64()),
|
||||
~"bswap16" => (0, ~[ arg(ty::mk_i16()) ], ty::mk_i16()),
|
||||
~"bswap32" => (0, ~[ arg(ty::mk_i32()) ], ty::mk_i32()),
|
||||
~"bswap64" => (0, ~[ arg(ty::mk_i64()) ], ty::mk_i64()),
|
||||
~"fabsf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"fabsf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"floorf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"floorf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"ceilf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"ceilf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"truncf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
|
||||
~"truncf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
|
||||
~"ctpop8" => (0, ~[ ty::mk_i8() ], ty::mk_i8()),
|
||||
~"ctpop16" => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
|
||||
~"ctpop32" => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
|
||||
~"ctpop64" => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
|
||||
~"ctlz8" => (0, ~[ ty::mk_i8() ], ty::mk_i8()),
|
||||
~"ctlz16" => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
|
||||
~"ctlz32" => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
|
||||
~"ctlz64" => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
|
||||
~"cttz8" => (0, ~[ ty::mk_i8() ], ty::mk_i8()),
|
||||
~"cttz16" => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
|
||||
~"cttz32" => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
|
||||
~"cttz64" => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
|
||||
~"bswap16" => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
|
||||
~"bswap32" => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
|
||||
~"bswap64" => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
|
||||
ref other => {
|
||||
tcx.sess.span_err(it.span,
|
||||
~"unrecognized intrinsic function: `" +
|
||||
|
@ -258,7 +258,7 @@ pub fn relate_free_regions(
|
||||
|
||||
let mut all_tys = ~[];
|
||||
for fn_sig.inputs.each |arg| {
|
||||
all_tys.push(arg.ty);
|
||||
all_tys.push(*arg);
|
||||
}
|
||||
for self_ty.each |&t| {
|
||||
all_tys.push(t);
|
||||
|
@ -13,7 +13,6 @@
|
||||
// substitutions.
|
||||
|
||||
use middle::pat_util;
|
||||
use middle::ty::arg;
|
||||
use middle::ty;
|
||||
use middle::typeck::check::{FnCtxt, SelfInfo};
|
||||
use middle::typeck::infer::{force_all, resolve_all, resolve_region};
|
||||
@ -63,14 +62,9 @@ fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::node_id) {
|
||||
match fcx.inh.method_map.find(&id) {
|
||||
None => {}
|
||||
Some(mme) => {
|
||||
for resolve_type_vars_in_type(fcx, sp, mme.self_arg.ty).each |t| {
|
||||
for resolve_type_vars_in_type(fcx, sp, mme.self_ty).each |t| {
|
||||
let method_map = fcx.ccx.method_map;
|
||||
let new_entry = method_map_entry {
|
||||
self_arg: arg {
|
||||
ty: *t
|
||||
},
|
||||
..*mme
|
||||
};
|
||||
let new_entry = method_map_entry { self_ty: *t, ..*mme };
|
||||
debug!("writeback::resolve_method_map_entry(id=%?, \
|
||||
new_entry=%?)",
|
||||
id, new_entry);
|
||||
|
@ -576,14 +576,10 @@ pub fn compare_impl_method(tcx: ty::ctxt,
|
||||
// represent the self argument (unless this is a static method).
|
||||
// This argument will have the *transformed* self type.
|
||||
for trait_m.transformed_self_ty.each |&t| {
|
||||
trait_fn_args.push(ty::arg {
|
||||
ty: t
|
||||
});
|
||||
trait_fn_args.push(t);
|
||||
}
|
||||
for impl_m.transformed_self_ty.each |&t| {
|
||||
impl_fn_args.push(ty::arg {
|
||||
ty: t
|
||||
});
|
||||
impl_fn_args.push(t);
|
||||
}
|
||||
|
||||
// Add in the normal arguments.
|
||||
|
@ -55,7 +55,7 @@
|
||||
// now.
|
||||
|
||||
use middle::ty::{FloatVar, FnSig, IntVar, TyVar};
|
||||
use middle::ty::{IntType, UintType, arg, substs};
|
||||
use middle::ty::{IntType, UintType, substs};
|
||||
use middle::ty;
|
||||
use middle::typeck::infer::glb::Glb;
|
||||
use middle::typeck::infer::lub::Lub;
|
||||
@ -95,7 +95,7 @@ pub trait Combine {
|
||||
b: &ty::ClosureTy) -> cres<ty::ClosureTy>;
|
||||
fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig>;
|
||||
fn flds(&self, a: ty::field, b: ty::field) -> cres<ty::field>;
|
||||
fn args(&self, a: ty::arg, b: ty::arg) -> cres<ty::arg>;
|
||||
fn args(&self, a: ty::t, b: ty::t) -> cres<ty::t>;
|
||||
fn sigils(&self, p1: ast::Sigil, p2: ast::Sigil) -> cres<ast::Sigil>;
|
||||
fn purities(&self, a: purity, b: purity) -> cres<purity>;
|
||||
fn abis(&self, a: AbiSet, b: AbiSet) -> cres<AbiSet>;
|
||||
@ -311,12 +311,9 @@ pub fn super_flds<C:Combine>(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn super_args<C:Combine>(this: &C, a: ty::arg, b: ty::arg)
|
||||
-> cres<ty::arg> {
|
||||
do this.contratys(a.ty, b.ty).chain |t| {
|
||||
Ok(arg {
|
||||
ty: t
|
||||
})
|
||||
pub fn super_args<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
|
||||
do this.contratys(a, b).chain |t| {
|
||||
Ok(t)
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,10 +404,7 @@ pub fn super_bare_fn_tys<C:Combine>(
|
||||
pub fn super_fn_sigs<C:Combine>(
|
||||
this: &C, a_f: &ty::FnSig, b_f: &ty::FnSig) -> cres<ty::FnSig>
|
||||
{
|
||||
fn argvecs<C:Combine>(this: &C,
|
||||
a_args: &[ty::arg],
|
||||
b_args: &[ty::arg]) -> cres<~[ty::arg]>
|
||||
{
|
||||
fn argvecs<C:Combine>(this: &C, a_args: &[ty::t], b_args: &[ty::t]) -> cres<~[ty::t]> {
|
||||
if vec::same_length(a_args, b_args) {
|
||||
map_vec2(a_args, b_args, |a, b| this.args(*a, *b))
|
||||
} else {
|
||||
|
@ -153,7 +153,7 @@ impl Combine for Glb {
|
||||
super_trait_stores(self, vk, a, b)
|
||||
}
|
||||
|
||||
fn args(&self, a: ty::arg, b: ty::arg) -> cres<ty::arg> {
|
||||
fn args(&self, a: ty::t, b: ty::t) -> cres<ty::t> {
|
||||
super_args(self, a, b)
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ impl Combine for Lub {
|
||||
super_trait_stores(self, vk, a, b)
|
||||
}
|
||||
|
||||
fn args(&self, a: ty::arg, b: ty::arg) -> cres<ty::arg> {
|
||||
fn args(&self, a: ty::t, b: ty::t) -> cres<ty::t> {
|
||||
super_args(self, a, b)
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ impl Combine for Sub {
|
||||
super_trait_stores(self, vk, a, b)
|
||||
}
|
||||
|
||||
fn args(&self, a: ty::arg, b: ty::arg) -> cres<ty::arg> {
|
||||
fn args(&self, a: ty::t, b: ty::t) -> cres<ty::t> {
|
||||
super_args(self, a, b)
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ impl InferStr for ty::t {
|
||||
impl InferStr for FnSig {
|
||||
fn inf_str(&self, cx: &InferCtxt) -> ~str {
|
||||
fmt!("(%s) -> %s",
|
||||
str::connect(self.inputs.map(|a| a.ty.inf_str(cx)), ", "),
|
||||
str::connect(self.inputs.map(|a| a.inf_str(cx)), ", "),
|
||||
self.output.inf_str(cx))
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ pub struct method_param {
|
||||
pub struct method_map_entry {
|
||||
// the type of the self parameter, which is not reflected in the fn type
|
||||
// (FIXME #3446)
|
||||
self_arg: ty::arg,
|
||||
self_ty: ty::t,
|
||||
|
||||
// the mode of `self`
|
||||
self_mode: ty::SelfMode,
|
||||
@ -351,22 +351,15 @@ fn check_start_fn_ty(ccx: @mut CrateCtxt,
|
||||
_ => ()
|
||||
}
|
||||
|
||||
fn arg(ty: ty::t) -> ty::arg {
|
||||
ty::arg {
|
||||
ty: ty
|
||||
}
|
||||
}
|
||||
|
||||
let se_ty = ty::mk_bare_fn(tcx, ty::BareFnTy {
|
||||
purity: ast::impure_fn,
|
||||
abis: abi::AbiSet::Rust(),
|
||||
sig: ty::FnSig {
|
||||
bound_lifetime_names: opt_vec::Empty,
|
||||
inputs: ~[
|
||||
arg(ty::mk_int()),
|
||||
arg(ty::mk_imm_ptr(tcx,
|
||||
ty::mk_imm_ptr(tcx, ty::mk_u8()))),
|
||||
arg(ty::mk_imm_ptr(tcx, ty::mk_u8()))
|
||||
ty::mk_int(),
|
||||
ty::mk_imm_ptr(tcx, ty::mk_imm_ptr(tcx, ty::mk_u8())),
|
||||
ty::mk_imm_ptr(tcx, ty::mk_u8())
|
||||
],
|
||||
output: ty::mk_int()
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str {
|
||||
|
||||
pub fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str {
|
||||
fmt!("fn%s -> %s",
|
||||
tys_to_str(cx, typ.inputs.map(|a| a.ty)),
|
||||
tys_to_str(cx, typ.inputs.map(|a| *a)),
|
||||
ty_to_str(cx, typ.output))
|
||||
}
|
||||
|
||||
@ -290,8 +290,8 @@ pub fn trait_ref_to_str(cx: ctxt, trait_ref: &ty::TraitRef) -> ~str {
|
||||
}
|
||||
|
||||
pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
|
||||
fn fn_input_to_str(cx: ctxt, input: ty::arg) -> ~str {
|
||||
ty_to_str(cx, input.ty)
|
||||
fn fn_input_to_str(cx: ctxt, input: ty::t) -> ~str {
|
||||
ty_to_str(cx, input)
|
||||
}
|
||||
fn bare_fn_to_str(cx: ctxt,
|
||||
purity: ast::purity,
|
||||
@ -685,18 +685,12 @@ impl Repr for typeck::method_map_entry {
|
||||
fmt!("method_map_entry {self_arg: %s, \
|
||||
explicit_self: %s, \
|
||||
origin: %s}",
|
||||
self.self_arg.repr(tcx),
|
||||
self.self_ty.repr(tcx),
|
||||
self.explicit_self.repr(tcx),
|
||||
self.origin.repr(tcx))
|
||||
}
|
||||
}
|
||||
|
||||
impl Repr for ty::arg {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
fmt!("(%s)", self.ty.repr(tcx))
|
||||
}
|
||||
}
|
||||
|
||||
impl Repr for typeck::method_origin {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
match self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user