rustc: more pattern cleanup
This commit is contained in:
parent
5ce5ee86bc
commit
65bd46c8a5
@ -223,7 +223,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
|
||||
map_struct_def(struct_def, node_item(i, item_path), i.ident, i.id, cx,
|
||||
v);
|
||||
}
|
||||
item_trait(tps, traits, methods) => {
|
||||
item_trait(_, traits, methods) => {
|
||||
// Map trait refs to their parent classes. This is
|
||||
// so we can find the self_ty
|
||||
for traits.each |p| {
|
||||
@ -318,16 +318,16 @@ fn node_id_to_str(map: map, id: node_id, itr: ident_interner) -> ~str {
|
||||
fmt!("foreign item %s with abi %? (id=%?)",
|
||||
path_ident_to_str(*path, item.ident, itr), abi, id)
|
||||
}
|
||||
Some(node_method(m, impl_did, path)) => {
|
||||
Some(node_method(m, _, path)) => {
|
||||
fmt!("method %s in %s (id=%?)",
|
||||
*itr.get(m.ident), path_to_str(*path, itr), id)
|
||||
}
|
||||
Some(node_trait_method(tm, impl_did, path)) => {
|
||||
Some(node_trait_method(tm, _, path)) => {
|
||||
let m = ast_util::trait_method_to_ty_method(*tm);
|
||||
fmt!("method %s in %s (id=%?)",
|
||||
*itr.get(m.ident), path_to_str(*path, itr), id)
|
||||
}
|
||||
Some(node_variant(variant, def_id, path)) => {
|
||||
Some(node_variant(variant, _, path)) => {
|
||||
fmt!("variant %s in %s (id=%?)",
|
||||
*itr.get(variant.node.name), path_to_str(*path, itr), id)
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ fn expand_item_mac(exts: hashmap<~str, syntax_extension>,
|
||||
cx: ext_ctxt, &&it: @ast::item,
|
||||
fld: ast_fold) -> Option<@ast::item> {
|
||||
match it.node {
|
||||
item_mac({node: mac_invoc_tt(pth, tts), span}) => {
|
||||
item_mac({node: mac_invoc_tt(pth, tts), _}) => {
|
||||
let extname = cx.parse_sess().interner.get(pth.idents[0]);
|
||||
match exts.find(*extname) {
|
||||
None => {
|
||||
|
@ -504,7 +504,7 @@ fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) {
|
||||
Some(p_id) => {
|
||||
fn select(cx: ext_ctxt, m: matchable) -> match_result {
|
||||
return match m {
|
||||
match_expr(e) => Some(leaf(specialize_match(m))),
|
||||
match_expr(*) => Some(leaf(specialize_match(m))),
|
||||
_ => cx.bug(~"broken traversal in p_t_s_r")
|
||||
}
|
||||
}
|
||||
@ -646,7 +646,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
match elts[0u].node {
|
||||
expr_mac(mac) => {
|
||||
match mac.node {
|
||||
mac_invoc(pth, invoc_arg, body) => {
|
||||
mac_invoc(pth, invoc_arg, _) => {
|
||||
match path_to_ident(pth) {
|
||||
Some(id) => {
|
||||
let id_str = cx.str_of(id);
|
||||
|
@ -378,7 +378,7 @@ fn check_stack(k: int) {
|
||||
if !self.scan_stack_empty {
|
||||
let x = self.scan_top();
|
||||
match copy self.token[x] {
|
||||
BEGIN(b) => {
|
||||
BEGIN(_) => {
|
||||
if k > 0 {
|
||||
self.size[self.scan_pop()] = self.size[x] +
|
||||
self.right_total;
|
||||
|
@ -250,7 +250,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
|
||||
|
||||
fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
|
||||
match ni.node {
|
||||
foreign_item_fn(fd, purity, tps) => {
|
||||
foreign_item_fn(fd, _, tps) => {
|
||||
v.visit_ty_params(tps, e, v);
|
||||
visit_fn_decl(fd, e, v);
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ fn gather_pat(discr_cmt: cmt, root_pat: @ast::pat,
|
||||
arm_id: ast::node_id, alt_id: ast::node_id) {
|
||||
do self.bccx.cat_pattern(discr_cmt, root_pat) |cmt, pat| {
|
||||
match pat.node {
|
||||
ast::pat_ident(bm, id, o_pat) if !self.pat_is_variant(pat) => {
|
||||
ast::pat_ident(bm, _, _) if !self.pat_is_variant(pat) => {
|
||||
match bm {
|
||||
ast::bind_by_value | ast::bind_by_move => {
|
||||
// copying does not borrow anything, so no check
|
||||
|
@ -113,9 +113,9 @@ fn loan(cmt: cmt, req_mutbl: ast::mutability) -> bckres<()> {
|
||||
// then the memory is freed.
|
||||
self.loan_unstable_deref(cmt, cmt_base, req_mutbl)
|
||||
}
|
||||
cat_deref(cmt1, _, unsafe_ptr) |
|
||||
cat_deref(cmt1, _, gc_ptr) |
|
||||
cat_deref(cmt1, _, region_ptr(_)) => {
|
||||
cat_deref(_, _, unsafe_ptr) |
|
||||
cat_deref(_, _, gc_ptr) |
|
||||
cat_deref(_, _, region_ptr(_)) => {
|
||||
// Aliased data is simply not lendable.
|
||||
self.bccx.tcx.sess.span_bug(
|
||||
cmt.span,
|
||||
|
@ -16,7 +16,7 @@ impl preserve_condition {
|
||||
fn combine(pc: preserve_condition) -> preserve_condition {
|
||||
match self {
|
||||
pc_ok => {pc}
|
||||
pc_if_pure(e) => {self}
|
||||
pc_if_pure(_) => {self}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
|
||||
// Grab the class data that we care about.
|
||||
let class_fields, class_id;
|
||||
match ty::get(left_ty).struct {
|
||||
ty::ty_class(cid, substs) => {
|
||||
ty::ty_class(cid, _) => {
|
||||
class_id = cid;
|
||||
class_fields = ty::lookup_class_fields(tcx, class_id);
|
||||
}
|
||||
@ -414,7 +414,7 @@ fn check_local(tcx: ty::ctxt, loc: @local, &&s: (), v: visit::vt<()>) {
|
||||
|
||||
fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
|
||||
match tcx.def_map.find(pat.id) {
|
||||
Some(def_variant(enum_id, var_id)) => {
|
||||
Some(def_variant(enum_id, _)) => {
|
||||
if vec::len(*ty::enum_variants(tcx, enum_id)) != 1u {
|
||||
return true;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ fn visit_item(it: @item, &&env: env, v: visit::vt<env>) {
|
||||
|
||||
fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {
|
||||
match e.node {
|
||||
expr_path(path) => {
|
||||
expr_path(*) => {
|
||||
match env.def_map.find(e.id) {
|
||||
Some(def_const(def_id)) => {
|
||||
match env.ast_map.get(def_id.node) {
|
||||
|
@ -417,7 +417,7 @@ fn check_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
|
||||
either::Right(ast::foreign_abi_rust_intrinsic) => {
|
||||
for nmod.items.each |ni| {
|
||||
match ni.node {
|
||||
ast::foreign_item_fn(decl, _, tps) => {
|
||||
ast::foreign_item_fn(decl, _, _) => {
|
||||
check_foreign_fn(cx, it.id, decl);
|
||||
}
|
||||
ast::foreign_item_const(*) => {} // XXX: Not implemented.
|
||||
@ -434,7 +434,7 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
|
||||
match s.node {
|
||||
ast::stmt_semi(@{id: id,
|
||||
callee_id: _,
|
||||
node: ast::expr_path(@path),
|
||||
node: ast::expr_path(_),
|
||||
span: _}, _) => {
|
||||
cx.sess.span_lint(
|
||||
path_statement, id, it.id,
|
||||
|
@ -338,18 +338,13 @@ fn add_last_use(expr_id: node_id, var: Variable) {
|
||||
let vk = self.var_kinds[*var];
|
||||
debug!("Node %d is a last use of variable %?", expr_id, vk);
|
||||
match vk {
|
||||
Arg(id, name, by_move) |
|
||||
Arg(id, name, by_copy) |
|
||||
Local(LocalInfo {id:id, ident:name,
|
||||
kind: FromLetNoInitializer, _}) |
|
||||
Local(LocalInfo {id:id, ident:name,
|
||||
kind: FromLetWithInitializer, _}) |
|
||||
Local(LocalInfo {id:id, ident:name,
|
||||
kind: FromMatch(bind_by_value), _}) |
|
||||
Local(LocalInfo {id:id, ident:name,
|
||||
kind: FromMatch(bind_by_ref(_)), _}) |
|
||||
Local(LocalInfo {id:id, ident:name,
|
||||
kind: FromMatch(bind_by_move), _}) => {
|
||||
Arg(id, _, by_move) |
|
||||
Arg(id, _, by_copy) |
|
||||
Local(LocalInfo {id: id, kind: FromLetNoInitializer, _}) |
|
||||
Local(LocalInfo {id: id, kind: FromLetWithInitializer, _}) |
|
||||
Local(LocalInfo {id: id, kind: FromMatch(bind_by_value), _}) |
|
||||
Local(LocalInfo {id: id, kind: FromMatch(bind_by_ref(_)), _}) |
|
||||
Local(LocalInfo {id: id, kind: FromMatch(bind_by_move), _}) => {
|
||||
let v = match self.last_use_map.find(expr_id) {
|
||||
Some(v) => v,
|
||||
None => {
|
||||
@ -1493,7 +1488,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||
visit::visit_expr(expr, self, vt);
|
||||
}
|
||||
|
||||
expr_fn(_, _, _, cap_clause) | expr_fn_block(_, _, cap_clause) => {
|
||||
expr_fn(*) | expr_fn_block(*) => {
|
||||
let caps = (*self.ir).captures(expr);
|
||||
for (*caps).each |cap| {
|
||||
let var = self.variable_from_rdef(cap.rv, expr.span);
|
||||
|
@ -378,7 +378,7 @@ fn cat_def(id: ast::node_id,
|
||||
mutbl:m_imm, ty:expr_ty}
|
||||
}
|
||||
|
||||
ast::def_upvar(upvid, inner, fn_node_id, _) => {
|
||||
ast::def_upvar(_, inner, fn_node_id, _) => {
|
||||
let ty = ty::node_id_to_type(self.tcx, fn_node_id);
|
||||
let proto = ty::ty_fn_proto(ty);
|
||||
match proto {
|
||||
@ -856,7 +856,7 @@ fn field_mutbl(tcx: ty::ctxt,
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::ty_class(did, substs) => {
|
||||
ty::ty_class(did, _) => {
|
||||
for ty::lookup_class_fields(tcx, did).each |fld| {
|
||||
if fld.ident == f_name {
|
||||
let m = match fld.mutability {
|
||||
|
@ -529,7 +529,7 @@ fn def_for_namespace(namespace: Namespace) -> Option<Definition> {
|
||||
|
||||
fn span_for_namespace(namespace: Namespace) -> Option<span> {
|
||||
match self.def_for_namespace(namespace) {
|
||||
Some(d) => {
|
||||
Some(_) => {
|
||||
match namespace {
|
||||
TypeNS => self.type_span,
|
||||
ValueNS => self.value_span,
|
||||
@ -866,7 +866,7 @@ fn build_reduced_graph_for_item(item: @item,
|
||||
|
||||
visit_mod(module_, sp, item.id, new_parent, visitor);
|
||||
}
|
||||
item_foreign_mod(foreign_module) => {
|
||||
item_foreign_mod(*) => {
|
||||
let (name_bindings, new_parent) = self.add_child(atom, parent,
|
||||
~[ModuleNS], sp);
|
||||
|
||||
@ -891,7 +891,7 @@ fn build_reduced_graph_for_item(item: @item,
|
||||
def_const(local_def(item.id)),
|
||||
sp);
|
||||
}
|
||||
item_fn(decl, purity, _, _) => {
|
||||
item_fn(_, purity, _, _) => {
|
||||
let (name_bindings, new_parent) = self.add_child(atom, parent,
|
||||
~[ValueNS], sp);
|
||||
|
||||
@ -1217,7 +1217,7 @@ fn build_reduced_graph_for_foreign_item(foreign_item: @foreign_item,
|
||||
self.add_child(name, parent, ~[ValueNS], foreign_item.span);
|
||||
|
||||
match foreign_item.node {
|
||||
foreign_item_fn(fn_decl, purity, type_parameters) => {
|
||||
foreign_item_fn(_, purity, type_parameters) => {
|
||||
let def = def_fn(local_def(foreign_item.id), purity);
|
||||
(*name_bindings).define_value(Public, def, foreign_item.span);
|
||||
|
||||
@ -1227,7 +1227,7 @@ fn build_reduced_graph_for_foreign_item(foreign_item: @foreign_item,
|
||||
visit_foreign_item(foreign_item, new_parent, visitor);
|
||||
}
|
||||
}
|
||||
foreign_item_const(item_type) => {
|
||||
foreign_item_const(*) => {
|
||||
let def = def_const(local_def(foreign_item.id));
|
||||
(*name_bindings).define_value(Public, def, foreign_item.span);
|
||||
|
||||
@ -1319,8 +1319,8 @@ fn handle_external_def(def: def, modules: hashmap<def_id, @Module>,
|
||||
}
|
||||
}
|
||||
}
|
||||
def_fn(def_id, _) | def_static_method(def_id, _) |
|
||||
def_const(def_id) | def_variant(_, def_id) => {
|
||||
def_fn(*) | def_static_method(*) | def_const(*) |
|
||||
def_variant(*) => {
|
||||
debug!("(building reduced graph for external \
|
||||
crate) building value %s", final_ident);
|
||||
(*child_name_bindings).define_value(Public, def, dummy_sp());
|
||||
@ -2710,7 +2710,7 @@ fn upvarify(ribs: @DVec<@Rib>, rib_index: uint, def_like: def_like,
|
||||
body_id);
|
||||
}
|
||||
}
|
||||
MethodRibKind(item_id, method_id) => {
|
||||
MethodRibKind(item_id, _) => {
|
||||
// If the def is a ty param, and came from the parent
|
||||
// item, it's ok
|
||||
match def {
|
||||
@ -2954,7 +2954,7 @@ fn resolve_item(item: @item, visitor: ResolveVisitor) {
|
||||
visitor);
|
||||
}
|
||||
}
|
||||
foreign_item_const(item_type) => {
|
||||
foreign_item_const(_) => {
|
||||
visit_foreign_item(foreign_item, (),
|
||||
visitor);
|
||||
}
|
||||
@ -3033,7 +3033,7 @@ fn with_type_parameter_rib(type_parameters: TypeParameters, f: fn()) {
|
||||
f();
|
||||
|
||||
match type_parameters {
|
||||
HasTypeParameters(type_parameters, _, _, _) => {
|
||||
HasTypeParameters(*) => {
|
||||
(*self.type_ribs).pop();
|
||||
}
|
||||
|
||||
@ -4228,7 +4228,7 @@ fn resolve_expr(expr: @expr, visitor: ResolveVisitor) {
|
||||
fmt!("use of undeclared label \
|
||||
`%s`", self.session.str_of(
|
||||
label))),
|
||||
Some(dl_def(def @ def_label(id))) =>
|
||||
Some(dl_def(def @ def_label(_))) =>
|
||||
self.record_def(expr.id, def),
|
||||
Some(_) =>
|
||||
self.session.span_bug(expr.span,
|
||||
@ -4514,7 +4514,7 @@ fn module_to_str(module_: @Module) -> ~str {
|
||||
atoms.push(name);
|
||||
current_module = module_;
|
||||
}
|
||||
BlockParentLink(module_, node_id) => {
|
||||
BlockParentLink(module_, _) => {
|
||||
atoms.push(syntax::parse::token::special_idents::opaque);
|
||||
current_module = module_;
|
||||
}
|
||||
@ -4555,7 +4555,7 @@ fn dump_module(module_: @Module) {
|
||||
let mut module_repr;
|
||||
match (*import_resolution).target_for_namespace(ModuleNS) {
|
||||
None => { module_repr = ~""; }
|
||||
Some(target) => {
|
||||
Some(_) => {
|
||||
module_repr = ~" module:?";
|
||||
// XXX
|
||||
}
|
||||
@ -4564,7 +4564,7 @@ fn dump_module(module_: @Module) {
|
||||
let mut value_repr;
|
||||
match (*import_resolution).target_for_namespace(ValueNS) {
|
||||
None => { value_repr = ~""; }
|
||||
Some(target) => {
|
||||
Some(_) => {
|
||||
value_repr = ~" value:?";
|
||||
// XXX
|
||||
}
|
||||
@ -4573,7 +4573,7 @@ fn dump_module(module_: @Module) {
|
||||
let mut type_repr;
|
||||
match (*import_resolution).target_for_namespace(TypeNS) {
|
||||
None => { type_repr = ~""; }
|
||||
Some(target) => {
|
||||
Some(_) => {
|
||||
type_repr = ~" type:?";
|
||||
// XXX
|
||||
}
|
||||
|
@ -2621,7 +2621,7 @@ fn unify_mode(cx: ctxt, modes: expected_found<ast::mode>)
|
||||
(m1, m2) if (m1 == m2) => {
|
||||
result::ok(m1)
|
||||
}
|
||||
(ast::infer(id1), ast::infer(id2)) => {
|
||||
(ast::infer(_), ast::infer(id2)) => {
|
||||
cx.inferred_modes.insert(id2, m1);
|
||||
result::ok(m1)
|
||||
}
|
||||
@ -2629,7 +2629,7 @@ fn unify_mode(cx: ctxt, modes: expected_found<ast::mode>)
|
||||
cx.inferred_modes.insert(id, m);
|
||||
result::ok(m1)
|
||||
}
|
||||
(m1, m2) => {
|
||||
(_, _) => {
|
||||
result::err(terr_mode_mismatch(modes))
|
||||
}
|
||||
}
|
||||
@ -3325,7 +3325,7 @@ fn normalize_vstore(vstore: vstore) -> vstore {
|
||||
// This type has a vstore. Get rid of it
|
||||
mk_estr(cx, normalize_vstore(vstore)),
|
||||
|
||||
ty_rptr(region, mt) =>
|
||||
ty_rptr(_, mt) =>
|
||||
// This type has a region. Get rid of it
|
||||
mk_rptr(cx, re_static, normalize_mt(cx, mt)),
|
||||
|
||||
|
@ -254,8 +254,8 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
|
||||
let tcx = ccx.tcx;
|
||||
let main_t = ty::node_id_to_type(tcx, main_id);
|
||||
match ty::get(main_t).struct {
|
||||
ty::ty_fn({purity: ast::impure_fn, proto: ty::proto_bare, bounds,
|
||||
inputs, output, ret_style: ast::return_val}) => {
|
||||
ty::ty_fn({purity: ast::impure_fn, proto: ty::proto_bare,
|
||||
inputs, output, ret_style: ast::return_val, _}) => {
|
||||
match tcx.items.find(main_id) {
|
||||
Some(ast_map::node_item(it,_)) => {
|
||||
match it.node {
|
||||
|
@ -478,10 +478,10 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
||||
ast::item_enum(enum_definition, _) => {
|
||||
check_enum_variants(ccx, it.span, enum_definition.variants, it.id);
|
||||
}
|
||||
ast::item_fn(decl, _, tps, body) => {
|
||||
ast::item_fn(decl, _, _, body) => {
|
||||
check_bare_fn(ccx, decl, body, it.id, None);
|
||||
}
|
||||
ast::item_impl(tps, _, ty, ms) => {
|
||||
ast::item_impl(_, _, ty, ms) => {
|
||||
let rp = ccx.tcx.region_paramd_items.find(it.id);
|
||||
debug!("item_impl %s with id %d rp %?",
|
||||
ccx.tcx.sess.str_of(it.ident), it.id, rp);
|
||||
@ -493,7 +493,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
||||
ast::item_trait(_, _, trait_methods) => {
|
||||
for trait_methods.each |trait_method| {
|
||||
match trait_method {
|
||||
required(ty_m) => {
|
||||
required(*) => {
|
||||
// Nothing to do, since required methods don't have
|
||||
// bodies to check.
|
||||
}
|
||||
@ -734,7 +734,7 @@ fn do_autoderef(fcx: @fn_ctxt, sp: span, t: ty::t) -> ty::t {
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
ty::ty_enum(did, substs) => {
|
||||
ty::ty_enum(did, _) => {
|
||||
// Watch out for a type like `enum t = @t`. Such a type would
|
||||
// otherwise infinitely auto-deref. This is the only autoderef
|
||||
// loop that needs to be concerned with this, as an error will be
|
||||
@ -761,7 +761,7 @@ fn check_lit(fcx: @fn_ctxt, lit: @ast::lit) -> ty::t {
|
||||
let tcx = fcx.ccx.tcx;
|
||||
|
||||
match lit.node {
|
||||
ast::lit_str(s) => ty::mk_estr(tcx, ty::vstore_slice(ty::re_static)),
|
||||
ast::lit_str(*) => ty::mk_estr(tcx, ty::vstore_slice(ty::re_static)),
|
||||
ast::lit_int(_, t) => ty::mk_mach_int(tcx, t),
|
||||
ast::lit_uint(_, t) => ty::mk_mach_uint(tcx, t),
|
||||
ast::lit_int_unsuffixed(_) => {
|
||||
@ -898,7 +898,7 @@ fn check_call_inner(
|
||||
|_br| fcx.infcx.next_region_var(sp,
|
||||
call_expr_id)).fn_ty
|
||||
}
|
||||
sty => {
|
||||
_ => {
|
||||
// I would like to make this span_err, but it's
|
||||
// really hard due to the way that expr_bind() is
|
||||
// written.
|
||||
@ -1146,7 +1146,7 @@ fn check_user_binop(fcx: @fn_ctxt, ex: @ast::expr,
|
||||
// supply the do keyword. Let's be more helpful in that situation.
|
||||
if op == ast::or {
|
||||
match ty::get(lhs_resolved_t).struct {
|
||||
ty::ty_fn(f) => {
|
||||
ty::ty_fn(_) => {
|
||||
tcx.sess.span_note(
|
||||
ex.span, ~"did you forget the 'do' keyword for the call?");
|
||||
}
|
||||
@ -1627,7 +1627,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool,
|
||||
match fcx.mk_subty(false, expr.span,
|
||||
fty.output, ty::mk_bool(tcx)) {
|
||||
result::ok(_) => (),
|
||||
result::err(err) => {
|
||||
result::err(_) => {
|
||||
tcx.sess.span_fatal(
|
||||
expr.span, fmt!("a `loop` function's last argument \
|
||||
should return `bool`, not `%s`",
|
||||
@ -2221,7 +2221,7 @@ fn do_check(ccx: @crate_ctxt, sp: span, vs: ~[ast::variant],
|
||||
ast::tuple_variant_kind(_) | ast::struct_variant_kind(_) => {
|
||||
arg_tys = Some(~[]);
|
||||
}
|
||||
ast::enum_variant_kind(subvariants) => {
|
||||
ast::enum_variant_kind(_) => {
|
||||
arg_tys = None;
|
||||
do_check(ccx, sp, vs, id, disr_vals, disr_val, variants);
|
||||
}
|
||||
@ -2306,7 +2306,7 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
|
||||
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, nid));
|
||||
return no_params(typ);
|
||||
}
|
||||
ast::def_fn(id, ast::extern_fn) => {
|
||||
ast::def_fn(_, ast::extern_fn) => {
|
||||
// extern functions are just u8 pointers
|
||||
return {
|
||||
bounds: @~[],
|
||||
@ -2458,7 +2458,7 @@ fn ast_expr_vstore_to_vstore(fcx: @fn_ctxt, e: @ast::expr, n: uint,
|
||||
}
|
||||
ast::vstore_uniq => ty::vstore_uniq,
|
||||
ast::vstore_box => ty::vstore_box,
|
||||
ast::vstore_slice(a_r) => {
|
||||
ast::vstore_slice(_) => {
|
||||
let r = fcx.infcx.next_region_var(e.span, e.id);
|
||||
ty::vstore_slice(r)
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
ast::pat_ident(_, path, c) => {
|
||||
ast::pat_ident(_, path, _) => {
|
||||
check_pat_variant(pcx, pat, path, Some(~[]), expected);
|
||||
}
|
||||
ast::pat_enum(path, subpats) => {
|
||||
|
@ -38,7 +38,7 @@ fn encl_region_of_def(fcx: @fn_ctxt, def: ast::def) -> ty::region {
|
||||
def_local(node_id, _) | def_arg(node_id, _) | def_self(node_id) |
|
||||
def_binding(node_id, _) =>
|
||||
return encl_region(tcx, node_id),
|
||||
def_upvar(local_id, subdef, closure_id, body_id) => {
|
||||
def_upvar(_, subdef, closure_id, body_id) => {
|
||||
match ty_fn_proto(fcx.node_ty(closure_id)) {
|
||||
proto_bare =>
|
||||
tcx.sess.bug(~"proto_bare in encl_region_of_def?!"),
|
||||
@ -205,7 +205,7 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) {
|
||||
};
|
||||
}
|
||||
|
||||
ast::expr_addr_of(_, operand) => {
|
||||
ast::expr_addr_of(*) => {
|
||||
// FIXME(#3148) -- in some cases, we need to capture a dependency
|
||||
// between the regions found in operand the resulting region type.
|
||||
// See #3148 for more details.
|
||||
|
@ -117,7 +117,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
|
||||
}
|
||||
ty::bound_trait(ity) => {
|
||||
match ty::get(ity).struct {
|
||||
ty::ty_trait(idid, substs, _) => {
|
||||
ty::ty_trait(idid, _, _) => {
|
||||
if trait_id == idid {
|
||||
debug!("(checking vtable) @0 relating ty to trait ty
|
||||
with did %?", idid);
|
||||
@ -268,7 +268,7 @@ fn fixup_ty(fcx: @fn_ctxt,
|
||||
for this bounded type parameter: %s",
|
||||
fixup_err_to_str(e)))
|
||||
}
|
||||
result::err(e) => {
|
||||
result::err(_) => {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ fn add_provided_methods(inherent_methods: ~[@MethodInfo],
|
||||
}
|
||||
|
||||
match item.node {
|
||||
item_impl(ty_params, trait_refs, _, ast_methods) => {
|
||||
item_impl(_, trait_refs, _, ast_methods) => {
|
||||
let mut methods = ~[];
|
||||
|
||||
for ast_methods.each |ast_method| {
|
||||
|
@ -331,7 +331,7 @@ fn check_methods_against_trait(ccx: @crate_ctxt,
|
||||
}
|
||||
for vec::each(*ty::trait_methods(tcx, did)) |trait_m| {
|
||||
match vec::find(impl_ms, |impl_m| trait_m.ident == impl_m.mty.ident) {
|
||||
Some({mty: impl_m, id, span}) => {
|
||||
Some({mty: impl_m, span, _}) => {
|
||||
compare_impl_method(
|
||||
ccx.tcx, span, impl_m, vec::len(tps),
|
||||
trait_m, tpt.substs, selfty);
|
||||
@ -350,7 +350,7 @@ fn check_methods_against_trait(ccx: @crate_ctxt,
|
||||
|
||||
match vec::find(provided_methods, |provided_method|
|
||||
provided_method.ident == trait_m.ident) {
|
||||
Some(m) => {
|
||||
Some(_) => {
|
||||
// If there's a provided method with the name we
|
||||
// want, then we're fine; nothing else to do.
|
||||
}
|
||||
@ -660,7 +660,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
|
||||
tcx.tcache.insert(local_def(it.id), tpt);
|
||||
return tpt;
|
||||
}
|
||||
ast::item_trait(tps, _, ms) => {
|
||||
ast::item_trait(tps, _, _) => {
|
||||
let {bounds, substs} = mk_substs(ccx, tps, rp);
|
||||
let t = ty::mk_trait(tcx, local_def(it.id), substs, ty::vstore_box);
|
||||
let tpt = {bounds: bounds,
|
||||
|
@ -125,12 +125,12 @@ fn is_borrowable(v: ty::vstore) -> bool {
|
||||
match (a_bnd, b_bnd) {
|
||||
(Some(a_bnd), Some(b_bnd)) => {
|
||||
match (ty::get(a_bnd).struct, ty::get(b_bnd).struct) {
|
||||
(ty::ty_box(mt_a), ty::ty_rptr(r_b, mt_b)) => {
|
||||
(ty::ty_box(*), ty::ty_rptr(r_b, mt_b)) => {
|
||||
let nr_b = ty::mk_box(self.tcx, {ty: mt_b.ty,
|
||||
mutbl: m_const});
|
||||
self.crosspollinate(anmnt, a, nr_b, mt_b.mutbl, r_b)
|
||||
}
|
||||
(ty::ty_uniq(mt_a), ty::ty_rptr(r_b, mt_b)) => {
|
||||
(ty::ty_uniq(*), ty::ty_rptr(r_b, mt_b)) => {
|
||||
let nr_b = ty::mk_uniq(self.tcx, {ty: mt_b.ty,
|
||||
mutbl: m_const});
|
||||
self.crosspollinate(anmnt, a, nr_b, mt_b.mutbl, r_b)
|
||||
@ -142,7 +142,7 @@ fn is_borrowable(v: ty::vstore) -> bool {
|
||||
self.crosspollinate(anmnt, a, nr_b, m_imm, r_b)
|
||||
}
|
||||
|
||||
(ty::ty_evec(mt_a, vs_a),
|
||||
(ty::ty_evec(_, vs_a),
|
||||
ty::ty_evec(mt_b, ty::vstore_slice(r_b)))
|
||||
if is_borrowable(vs_a) => {
|
||||
let nr_b = ty::mk_evec(self.tcx, {ty: mt_b.ty,
|
||||
|
@ -508,7 +508,7 @@ fn lub_regions(span: span, a: region, b: region) -> cres<region> {
|
||||
ok(ty::re_static) // nothing lives longer than static
|
||||
}
|
||||
|
||||
(ty::re_var(v_id), _) | (_, ty::re_var(v_id)) => {
|
||||
(ty::re_var(*), _) | (_, ty::re_var(*)) => {
|
||||
self.combine_vars(
|
||||
self.lubs, a, b, span,
|
||||
|old_r, new_r| self.make_subregion(span, old_r, new_r))
|
||||
@ -531,7 +531,7 @@ fn glb_regions(span: span, a: region, b: region) -> cres<region> {
|
||||
ok(r)
|
||||
}
|
||||
|
||||
(ty::re_var(v_id), _) | (_, ty::re_var(v_id)) => {
|
||||
(ty::re_var(*), _) | (_, ty::re_var(*)) => {
|
||||
self.combine_vars(
|
||||
self.glbs, a, b, span,
|
||||
|old_r, new_r| self.make_subregion(span, new_r, old_r))
|
||||
|
Loading…
Reference in New Issue
Block a user