rustc: more pattern cleanup
This commit is contained in:
parent
5ce5ee86bc
commit
65bd46c8a5
24 changed files with 74 additions and 79 deletions
|
@ -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,
|
map_struct_def(struct_def, node_item(i, item_path), i.ident, i.id, cx,
|
||||||
v);
|
v);
|
||||||
}
|
}
|
||||||
item_trait(tps, traits, methods) => {
|
item_trait(_, traits, methods) => {
|
||||||
// Map trait refs to their parent classes. This is
|
// Map trait refs to their parent classes. This is
|
||||||
// so we can find the self_ty
|
// so we can find the self_ty
|
||||||
for traits.each |p| {
|
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=%?)",
|
fmt!("foreign item %s with abi %? (id=%?)",
|
||||||
path_ident_to_str(*path, item.ident, itr), 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=%?)",
|
fmt!("method %s in %s (id=%?)",
|
||||||
*itr.get(m.ident), path_to_str(*path, itr), 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);
|
let m = ast_util::trait_method_to_ty_method(*tm);
|
||||||
fmt!("method %s in %s (id=%?)",
|
fmt!("method %s in %s (id=%?)",
|
||||||
*itr.get(m.ident), path_to_str(*path, itr), 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=%?)",
|
fmt!("variant %s in %s (id=%?)",
|
||||||
*itr.get(variant.node.name), path_to_str(*path, itr), 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,
|
cx: ext_ctxt, &&it: @ast::item,
|
||||||
fld: ast_fold) -> Option<@ast::item> {
|
fld: ast_fold) -> Option<@ast::item> {
|
||||||
match it.node {
|
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]);
|
let extname = cx.parse_sess().interner.get(pth.idents[0]);
|
||||||
match exts.find(*extname) {
|
match exts.find(*extname) {
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -504,7 +504,7 @@ fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) {
|
||||||
Some(p_id) => {
|
Some(p_id) => {
|
||||||
fn select(cx: ext_ctxt, m: matchable) -> match_result {
|
fn select(cx: ext_ctxt, m: matchable) -> match_result {
|
||||||
return match m {
|
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")
|
_ => 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 {
|
match elts[0u].node {
|
||||||
expr_mac(mac) => {
|
expr_mac(mac) => {
|
||||||
match mac.node {
|
match mac.node {
|
||||||
mac_invoc(pth, invoc_arg, body) => {
|
mac_invoc(pth, invoc_arg, _) => {
|
||||||
match path_to_ident(pth) {
|
match path_to_ident(pth) {
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
let id_str = cx.str_of(id);
|
let id_str = cx.str_of(id);
|
||||||
|
|
|
@ -378,7 +378,7 @@ impl printer {
|
||||||
if !self.scan_stack_empty {
|
if !self.scan_stack_empty {
|
||||||
let x = self.scan_top();
|
let x = self.scan_top();
|
||||||
match copy self.token[x] {
|
match copy self.token[x] {
|
||||||
BEGIN(b) => {
|
BEGIN(_) => {
|
||||||
if k > 0 {
|
if k > 0 {
|
||||||
self.size[self.scan_pop()] = self.size[x] +
|
self.size[self.scan_pop()] = self.size[x] +
|
||||||
self.right_total;
|
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>) {
|
fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
|
||||||
match ni.node {
|
match ni.node {
|
||||||
foreign_item_fn(fd, purity, tps) => {
|
foreign_item_fn(fd, _, tps) => {
|
||||||
v.visit_ty_params(tps, e, v);
|
v.visit_ty_params(tps, e, v);
|
||||||
visit_fn_decl(fd, e, v);
|
visit_fn_decl(fd, e, v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,7 @@ impl gather_loan_ctxt {
|
||||||
arm_id: ast::node_id, alt_id: ast::node_id) {
|
arm_id: ast::node_id, alt_id: ast::node_id) {
|
||||||
do self.bccx.cat_pattern(discr_cmt, root_pat) |cmt, pat| {
|
do self.bccx.cat_pattern(discr_cmt, root_pat) |cmt, pat| {
|
||||||
match pat.node {
|
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 {
|
match bm {
|
||||||
ast::bind_by_value | ast::bind_by_move => {
|
ast::bind_by_value | ast::bind_by_move => {
|
||||||
// copying does not borrow anything, so no check
|
// copying does not borrow anything, so no check
|
||||||
|
|
|
@ -113,9 +113,9 @@ impl loan_ctxt {
|
||||||
// then the memory is freed.
|
// then the memory is freed.
|
||||||
self.loan_unstable_deref(cmt, cmt_base, req_mutbl)
|
self.loan_unstable_deref(cmt, cmt_base, req_mutbl)
|
||||||
}
|
}
|
||||||
cat_deref(cmt1, _, unsafe_ptr) |
|
cat_deref(_, _, unsafe_ptr) |
|
||||||
cat_deref(cmt1, _, gc_ptr) |
|
cat_deref(_, _, gc_ptr) |
|
||||||
cat_deref(cmt1, _, region_ptr(_)) => {
|
cat_deref(_, _, region_ptr(_)) => {
|
||||||
// Aliased data is simply not lendable.
|
// Aliased data is simply not lendable.
|
||||||
self.bccx.tcx.sess.span_bug(
|
self.bccx.tcx.sess.span_bug(
|
||||||
cmt.span,
|
cmt.span,
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl preserve_condition {
|
||||||
fn combine(pc: preserve_condition) -> preserve_condition {
|
fn combine(pc: preserve_condition) -> preserve_condition {
|
||||||
match self {
|
match self {
|
||||||
pc_ok => {pc}
|
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.
|
// Grab the class data that we care about.
|
||||||
let class_fields, class_id;
|
let class_fields, class_id;
|
||||||
match ty::get(left_ty).struct {
|
match ty::get(left_ty).struct {
|
||||||
ty::ty_class(cid, substs) => {
|
ty::ty_class(cid, _) => {
|
||||||
class_id = cid;
|
class_id = cid;
|
||||||
class_fields = ty::lookup_class_fields(tcx, class_id);
|
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 {
|
fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
|
||||||
match tcx.def_map.find(pat.id) {
|
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 {
|
if vec::len(*ty::enum_variants(tcx, enum_id)) != 1u {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ fn check_item_recursion(sess: session, ast_map: ast_map::map,
|
||||||
|
|
||||||
fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {
|
fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {
|
||||||
match e.node {
|
match e.node {
|
||||||
expr_path(path) => {
|
expr_path(*) => {
|
||||||
match env.def_map.find(e.id) {
|
match env.def_map.find(e.id) {
|
||||||
Some(def_const(def_id)) => {
|
Some(def_const(def_id)) => {
|
||||||
match env.ast_map.get(def_id.node) {
|
match env.ast_map.get(def_id.node) {
|
||||||
|
|
|
@ -417,7 +417,7 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
|
||||||
either::Right(ast::foreign_abi_rust_intrinsic) => {
|
either::Right(ast::foreign_abi_rust_intrinsic) => {
|
||||||
for nmod.items.each |ni| {
|
for nmod.items.each |ni| {
|
||||||
match ni.node {
|
match ni.node {
|
||||||
ast::foreign_item_fn(decl, _, tps) => {
|
ast::foreign_item_fn(decl, _, _) => {
|
||||||
check_foreign_fn(cx, it.id, decl);
|
check_foreign_fn(cx, it.id, decl);
|
||||||
}
|
}
|
||||||
ast::foreign_item_const(*) => {} // XXX: Not implemented.
|
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 {
|
match s.node {
|
||||||
ast::stmt_semi(@{id: id,
|
ast::stmt_semi(@{id: id,
|
||||||
callee_id: _,
|
callee_id: _,
|
||||||
node: ast::expr_path(@path),
|
node: ast::expr_path(_),
|
||||||
span: _}, _) => {
|
span: _}, _) => {
|
||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
path_statement, id, it.id,
|
path_statement, id, it.id,
|
||||||
|
|
|
@ -338,18 +338,13 @@ impl IrMaps {
|
||||||
let vk = self.var_kinds[*var];
|
let vk = self.var_kinds[*var];
|
||||||
debug!("Node %d is a last use of variable %?", expr_id, vk);
|
debug!("Node %d is a last use of variable %?", expr_id, vk);
|
||||||
match vk {
|
match vk {
|
||||||
Arg(id, name, by_move) |
|
Arg(id, _, by_move) |
|
||||||
Arg(id, name, by_copy) |
|
Arg(id, _, by_copy) |
|
||||||
Local(LocalInfo {id:id, ident:name,
|
Local(LocalInfo {id: id, kind: FromLetNoInitializer, _}) |
|
||||||
kind: FromLetNoInitializer, _}) |
|
Local(LocalInfo {id: id, kind: FromLetWithInitializer, _}) |
|
||||||
Local(LocalInfo {id:id, ident:name,
|
Local(LocalInfo {id: id, kind: FromMatch(bind_by_value), _}) |
|
||||||
kind: FromLetWithInitializer, _}) |
|
Local(LocalInfo {id: id, kind: FromMatch(bind_by_ref(_)), _}) |
|
||||||
Local(LocalInfo {id:id, ident:name,
|
Local(LocalInfo {id: id, kind: FromMatch(bind_by_move), _}) => {
|
||||||
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), _}) => {
|
|
||||||
let v = match self.last_use_map.find(expr_id) {
|
let v = match self.last_use_map.find(expr_id) {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => {
|
None => {
|
||||||
|
@ -1493,7 +1488,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||||
visit::visit_expr(expr, self, vt);
|
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);
|
let caps = (*self.ir).captures(expr);
|
||||||
for (*caps).each |cap| {
|
for (*caps).each |cap| {
|
||||||
let var = self.variable_from_rdef(cap.rv, expr.span);
|
let var = self.variable_from_rdef(cap.rv, expr.span);
|
||||||
|
|
|
@ -378,7 +378,7 @@ impl &mem_categorization_ctxt {
|
||||||
mutbl:m_imm, ty:expr_ty}
|
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 ty = ty::node_id_to_type(self.tcx, fn_node_id);
|
||||||
let proto = ty::ty_fn_proto(ty);
|
let proto = ty::ty_fn_proto(ty);
|
||||||
match proto {
|
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| {
|
for ty::lookup_class_fields(tcx, did).each |fld| {
|
||||||
if fld.ident == f_name {
|
if fld.ident == f_name {
|
||||||
let m = match fld.mutability {
|
let m = match fld.mutability {
|
||||||
|
|
|
@ -529,7 +529,7 @@ struct NameBindings {
|
||||||
|
|
||||||
fn span_for_namespace(namespace: Namespace) -> Option<span> {
|
fn span_for_namespace(namespace: Namespace) -> Option<span> {
|
||||||
match self.def_for_namespace(namespace) {
|
match self.def_for_namespace(namespace) {
|
||||||
Some(d) => {
|
Some(_) => {
|
||||||
match namespace {
|
match namespace {
|
||||||
TypeNS => self.type_span,
|
TypeNS => self.type_span,
|
||||||
ValueNS => self.value_span,
|
ValueNS => self.value_span,
|
||||||
|
@ -866,7 +866,7 @@ struct Resolver {
|
||||||
|
|
||||||
visit_mod(module_, sp, item.id, new_parent, visitor);
|
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,
|
let (name_bindings, new_parent) = self.add_child(atom, parent,
|
||||||
~[ModuleNS], sp);
|
~[ModuleNS], sp);
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ struct Resolver {
|
||||||
def_const(local_def(item.id)),
|
def_const(local_def(item.id)),
|
||||||
sp);
|
sp);
|
||||||
}
|
}
|
||||||
item_fn(decl, purity, _, _) => {
|
item_fn(_, purity, _, _) => {
|
||||||
let (name_bindings, new_parent) = self.add_child(atom, parent,
|
let (name_bindings, new_parent) = self.add_child(atom, parent,
|
||||||
~[ValueNS], sp);
|
~[ValueNS], sp);
|
||||||
|
|
||||||
|
@ -1217,7 +1217,7 @@ struct Resolver {
|
||||||
self.add_child(name, parent, ~[ValueNS], foreign_item.span);
|
self.add_child(name, parent, ~[ValueNS], foreign_item.span);
|
||||||
|
|
||||||
match foreign_item.node {
|
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);
|
let def = def_fn(local_def(foreign_item.id), purity);
|
||||||
(*name_bindings).define_value(Public, def, foreign_item.span);
|
(*name_bindings).define_value(Public, def, foreign_item.span);
|
||||||
|
|
||||||
|
@ -1227,7 +1227,7 @@ struct Resolver {
|
||||||
visit_foreign_item(foreign_item, new_parent, visitor);
|
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));
|
let def = def_const(local_def(foreign_item.id));
|
||||||
(*name_bindings).define_value(Public, def, foreign_item.span);
|
(*name_bindings).define_value(Public, def, foreign_item.span);
|
||||||
|
|
||||||
|
@ -1319,8 +1319,8 @@ struct Resolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def_fn(def_id, _) | def_static_method(def_id, _) |
|
def_fn(*) | def_static_method(*) | def_const(*) |
|
||||||
def_const(def_id) | def_variant(_, def_id) => {
|
def_variant(*) => {
|
||||||
debug!("(building reduced graph for external \
|
debug!("(building reduced graph for external \
|
||||||
crate) building value %s", final_ident);
|
crate) building value %s", final_ident);
|
||||||
(*child_name_bindings).define_value(Public, def, dummy_sp());
|
(*child_name_bindings).define_value(Public, def, dummy_sp());
|
||||||
|
@ -2710,7 +2710,7 @@ struct Resolver {
|
||||||
body_id);
|
body_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MethodRibKind(item_id, method_id) => {
|
MethodRibKind(item_id, _) => {
|
||||||
// If the def is a ty param, and came from the parent
|
// If the def is a ty param, and came from the parent
|
||||||
// item, it's ok
|
// item, it's ok
|
||||||
match def {
|
match def {
|
||||||
|
@ -2954,7 +2954,7 @@ struct Resolver {
|
||||||
visitor);
|
visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreign_item_const(item_type) => {
|
foreign_item_const(_) => {
|
||||||
visit_foreign_item(foreign_item, (),
|
visit_foreign_item(foreign_item, (),
|
||||||
visitor);
|
visitor);
|
||||||
}
|
}
|
||||||
|
@ -3033,7 +3033,7 @@ struct Resolver {
|
||||||
f();
|
f();
|
||||||
|
|
||||||
match type_parameters {
|
match type_parameters {
|
||||||
HasTypeParameters(type_parameters, _, _, _) => {
|
HasTypeParameters(*) => {
|
||||||
(*self.type_ribs).pop();
|
(*self.type_ribs).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4228,7 +4228,7 @@ struct Resolver {
|
||||||
fmt!("use of undeclared label \
|
fmt!("use of undeclared label \
|
||||||
`%s`", self.session.str_of(
|
`%s`", self.session.str_of(
|
||||||
label))),
|
label))),
|
||||||
Some(dl_def(def @ def_label(id))) =>
|
Some(dl_def(def @ def_label(_))) =>
|
||||||
self.record_def(expr.id, def),
|
self.record_def(expr.id, def),
|
||||||
Some(_) =>
|
Some(_) =>
|
||||||
self.session.span_bug(expr.span,
|
self.session.span_bug(expr.span,
|
||||||
|
@ -4514,7 +4514,7 @@ struct Resolver {
|
||||||
atoms.push(name);
|
atoms.push(name);
|
||||||
current_module = module_;
|
current_module = module_;
|
||||||
}
|
}
|
||||||
BlockParentLink(module_, node_id) => {
|
BlockParentLink(module_, _) => {
|
||||||
atoms.push(syntax::parse::token::special_idents::opaque);
|
atoms.push(syntax::parse::token::special_idents::opaque);
|
||||||
current_module = module_;
|
current_module = module_;
|
||||||
}
|
}
|
||||||
|
@ -4555,7 +4555,7 @@ struct Resolver {
|
||||||
let mut module_repr;
|
let mut module_repr;
|
||||||
match (*import_resolution).target_for_namespace(ModuleNS) {
|
match (*import_resolution).target_for_namespace(ModuleNS) {
|
||||||
None => { module_repr = ~""; }
|
None => { module_repr = ~""; }
|
||||||
Some(target) => {
|
Some(_) => {
|
||||||
module_repr = ~" module:?";
|
module_repr = ~" module:?";
|
||||||
// XXX
|
// XXX
|
||||||
}
|
}
|
||||||
|
@ -4564,7 +4564,7 @@ struct Resolver {
|
||||||
let mut value_repr;
|
let mut value_repr;
|
||||||
match (*import_resolution).target_for_namespace(ValueNS) {
|
match (*import_resolution).target_for_namespace(ValueNS) {
|
||||||
None => { value_repr = ~""; }
|
None => { value_repr = ~""; }
|
||||||
Some(target) => {
|
Some(_) => {
|
||||||
value_repr = ~" value:?";
|
value_repr = ~" value:?";
|
||||||
// XXX
|
// XXX
|
||||||
}
|
}
|
||||||
|
@ -4573,7 +4573,7 @@ struct Resolver {
|
||||||
let mut type_repr;
|
let mut type_repr;
|
||||||
match (*import_resolution).target_for_namespace(TypeNS) {
|
match (*import_resolution).target_for_namespace(TypeNS) {
|
||||||
None => { type_repr = ~""; }
|
None => { type_repr = ~""; }
|
||||||
Some(target) => {
|
Some(_) => {
|
||||||
type_repr = ~" type:?";
|
type_repr = ~" type:?";
|
||||||
// XXX
|
// XXX
|
||||||
}
|
}
|
||||||
|
|
|
@ -2621,7 +2621,7 @@ fn unify_mode(cx: ctxt, modes: expected_found<ast::mode>)
|
||||||
(m1, m2) if (m1 == m2) => {
|
(m1, m2) if (m1 == m2) => {
|
||||||
result::ok(m1)
|
result::ok(m1)
|
||||||
}
|
}
|
||||||
(ast::infer(id1), ast::infer(id2)) => {
|
(ast::infer(_), ast::infer(id2)) => {
|
||||||
cx.inferred_modes.insert(id2, m1);
|
cx.inferred_modes.insert(id2, m1);
|
||||||
result::ok(m1)
|
result::ok(m1)
|
||||||
}
|
}
|
||||||
|
@ -2629,7 +2629,7 @@ fn unify_mode(cx: ctxt, modes: expected_found<ast::mode>)
|
||||||
cx.inferred_modes.insert(id, m);
|
cx.inferred_modes.insert(id, m);
|
||||||
result::ok(m1)
|
result::ok(m1)
|
||||||
}
|
}
|
||||||
(m1, m2) => {
|
(_, _) => {
|
||||||
result::err(terr_mode_mismatch(modes))
|
result::err(terr_mode_mismatch(modes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3325,7 +3325,7 @@ fn normalize_ty(cx: ctxt, t: t) -> t {
|
||||||
// This type has a vstore. Get rid of it
|
// This type has a vstore. Get rid of it
|
||||||
mk_estr(cx, normalize_vstore(vstore)),
|
mk_estr(cx, normalize_vstore(vstore)),
|
||||||
|
|
||||||
ty_rptr(region, mt) =>
|
ty_rptr(_, mt) =>
|
||||||
// This type has a region. Get rid of it
|
// This type has a region. Get rid of it
|
||||||
mk_rptr(cx, re_static, normalize_mt(cx, mt)),
|
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 tcx = ccx.tcx;
|
||||||
let main_t = ty::node_id_to_type(tcx, main_id);
|
let main_t = ty::node_id_to_type(tcx, main_id);
|
||||||
match ty::get(main_t).struct {
|
match ty::get(main_t).struct {
|
||||||
ty::ty_fn({purity: ast::impure_fn, proto: ty::proto_bare, bounds,
|
ty::ty_fn({purity: ast::impure_fn, proto: ty::proto_bare,
|
||||||
inputs, output, ret_style: ast::return_val}) => {
|
inputs, output, ret_style: ast::return_val, _}) => {
|
||||||
match tcx.items.find(main_id) {
|
match tcx.items.find(main_id) {
|
||||||
Some(ast_map::node_item(it,_)) => {
|
Some(ast_map::node_item(it,_)) => {
|
||||||
match it.node {
|
match it.node {
|
||||||
|
|
|
@ -478,10 +478,10 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
ast::item_enum(enum_definition, _) => {
|
ast::item_enum(enum_definition, _) => {
|
||||||
check_enum_variants(ccx, it.span, enum_definition.variants, it.id);
|
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);
|
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);
|
let rp = ccx.tcx.region_paramd_items.find(it.id);
|
||||||
debug!("item_impl %s with id %d rp %?",
|
debug!("item_impl %s with id %d rp %?",
|
||||||
ccx.tcx.sess.str_of(it.ident), it.id, 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) => {
|
ast::item_trait(_, _, trait_methods) => {
|
||||||
for trait_methods.each |trait_method| {
|
for trait_methods.each |trait_method| {
|
||||||
match trait_method {
|
match trait_method {
|
||||||
required(ty_m) => {
|
required(*) => {
|
||||||
// Nothing to do, since required methods don't have
|
// Nothing to do, since required methods don't have
|
||||||
// bodies to check.
|
// 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
|
// Watch out for a type like `enum t = @t`. Such a type would
|
||||||
// otherwise infinitely auto-deref. This is the only autoderef
|
// otherwise infinitely auto-deref. This is the only autoderef
|
||||||
// loop that needs to be concerned with this, as an error will be
|
// 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;
|
let tcx = fcx.ccx.tcx;
|
||||||
|
|
||||||
match lit.node {
|
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_int(_, t) => ty::mk_mach_int(tcx, t),
|
||||||
ast::lit_uint(_, t) => ty::mk_mach_uint(tcx, t),
|
ast::lit_uint(_, t) => ty::mk_mach_uint(tcx, t),
|
||||||
ast::lit_int_unsuffixed(_) => {
|
ast::lit_int_unsuffixed(_) => {
|
||||||
|
@ -898,7 +898,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
|_br| fcx.infcx.next_region_var(sp,
|
|_br| fcx.infcx.next_region_var(sp,
|
||||||
call_expr_id)).fn_ty
|
call_expr_id)).fn_ty
|
||||||
}
|
}
|
||||||
sty => {
|
_ => {
|
||||||
// I would like to make this span_err, but it's
|
// I would like to make this span_err, but it's
|
||||||
// really hard due to the way that expr_bind() is
|
// really hard due to the way that expr_bind() is
|
||||||
// written.
|
// written.
|
||||||
|
@ -1146,7 +1146,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
// supply the do keyword. Let's be more helpful in that situation.
|
// supply the do keyword. Let's be more helpful in that situation.
|
||||||
if op == ast::or {
|
if op == ast::or {
|
||||||
match ty::get(lhs_resolved_t).struct {
|
match ty::get(lhs_resolved_t).struct {
|
||||||
ty::ty_fn(f) => {
|
ty::ty_fn(_) => {
|
||||||
tcx.sess.span_note(
|
tcx.sess.span_note(
|
||||||
ex.span, ~"did you forget the 'do' keyword for the call?");
|
ex.span, ~"did you forget the 'do' keyword for the call?");
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1627,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
match fcx.mk_subty(false, expr.span,
|
match fcx.mk_subty(false, expr.span,
|
||||||
fty.output, ty::mk_bool(tcx)) {
|
fty.output, ty::mk_bool(tcx)) {
|
||||||
result::ok(_) => (),
|
result::ok(_) => (),
|
||||||
result::err(err) => {
|
result::err(_) => {
|
||||||
tcx.sess.span_fatal(
|
tcx.sess.span_fatal(
|
||||||
expr.span, fmt!("a `loop` function's last argument \
|
expr.span, fmt!("a `loop` function's last argument \
|
||||||
should return `bool`, not `%s`",
|
should return `bool`, not `%s`",
|
||||||
|
@ -2221,7 +2221,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
|
||||||
ast::tuple_variant_kind(_) | ast::struct_variant_kind(_) => {
|
ast::tuple_variant_kind(_) | ast::struct_variant_kind(_) => {
|
||||||
arg_tys = Some(~[]);
|
arg_tys = Some(~[]);
|
||||||
}
|
}
|
||||||
ast::enum_variant_kind(subvariants) => {
|
ast::enum_variant_kind(_) => {
|
||||||
arg_tys = None;
|
arg_tys = None;
|
||||||
do_check(ccx, sp, vs, id, disr_vals, disr_val, variants);
|
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));
|
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, nid));
|
||||||
return no_params(typ);
|
return no_params(typ);
|
||||||
}
|
}
|
||||||
ast::def_fn(id, ast::extern_fn) => {
|
ast::def_fn(_, ast::extern_fn) => {
|
||||||
// extern functions are just u8 pointers
|
// extern functions are just u8 pointers
|
||||||
return {
|
return {
|
||||||
bounds: @~[],
|
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_uniq => ty::vstore_uniq,
|
||||||
ast::vstore_box => ty::vstore_box,
|
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);
|
let r = fcx.infcx.next_region_var(e.span, e.id);
|
||||||
ty::vstore_slice(r)
|
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);
|
check_pat_variant(pcx, pat, path, Some(~[]), expected);
|
||||||
}
|
}
|
||||||
ast::pat_enum(path, subpats) => {
|
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_local(node_id, _) | def_arg(node_id, _) | def_self(node_id) |
|
||||||
def_binding(node_id, _) =>
|
def_binding(node_id, _) =>
|
||||||
return encl_region(tcx, 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)) {
|
match ty_fn_proto(fcx.node_ty(closure_id)) {
|
||||||
proto_bare =>
|
proto_bare =>
|
||||||
tcx.sess.bug(~"proto_bare in encl_region_of_def?!"),
|
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
|
// FIXME(#3148) -- in some cases, we need to capture a dependency
|
||||||
// between the regions found in operand the resulting region type.
|
// between the regions found in operand the resulting region type.
|
||||||
// See #3148 for more details.
|
// See #3148 for more details.
|
||||||
|
|
|
@ -117,7 +117,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
|
||||||
}
|
}
|
||||||
ty::bound_trait(ity) => {
|
ty::bound_trait(ity) => {
|
||||||
match ty::get(ity).struct {
|
match ty::get(ity).struct {
|
||||||
ty::ty_trait(idid, substs, _) => {
|
ty::ty_trait(idid, _, _) => {
|
||||||
if trait_id == idid {
|
if trait_id == idid {
|
||||||
debug!("(checking vtable) @0 relating ty to trait ty
|
debug!("(checking vtable) @0 relating ty to trait ty
|
||||||
with did %?", idid);
|
with did %?", idid);
|
||||||
|
@ -268,7 +268,7 @@ fn fixup_ty(fcx: @fn_ctxt,
|
||||||
for this bounded type parameter: %s",
|
for this bounded type parameter: %s",
|
||||||
fixup_err_to_str(e)))
|
fixup_err_to_str(e)))
|
||||||
}
|
}
|
||||||
result::err(e) => {
|
result::err(_) => {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -597,7 +597,7 @@ struct CoherenceChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
match item.node {
|
match item.node {
|
||||||
item_impl(ty_params, trait_refs, _, ast_methods) => {
|
item_impl(_, trait_refs, _, ast_methods) => {
|
||||||
let mut methods = ~[];
|
let mut methods = ~[];
|
||||||
|
|
||||||
for ast_methods.each |ast_method| {
|
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| {
|
for vec::each(*ty::trait_methods(tcx, did)) |trait_m| {
|
||||||
match vec::find(impl_ms, |impl_m| trait_m.ident == impl_m.mty.ident) {
|
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(
|
compare_impl_method(
|
||||||
ccx.tcx, span, impl_m, vec::len(tps),
|
ccx.tcx, span, impl_m, vec::len(tps),
|
||||||
trait_m, tpt.substs, selfty);
|
trait_m, tpt.substs, selfty);
|
||||||
|
@ -350,7 +350,7 @@ fn check_methods_against_trait(ccx: @crate_ctxt,
|
||||||
|
|
||||||
match vec::find(provided_methods, |provided_method|
|
match vec::find(provided_methods, |provided_method|
|
||||||
provided_method.ident == trait_m.ident) {
|
provided_method.ident == trait_m.ident) {
|
||||||
Some(m) => {
|
Some(_) => {
|
||||||
// If there's a provided method with the name we
|
// If there's a provided method with the name we
|
||||||
// want, then we're fine; nothing else to do.
|
// 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);
|
tcx.tcache.insert(local_def(it.id), tpt);
|
||||||
return tpt;
|
return tpt;
|
||||||
}
|
}
|
||||||
ast::item_trait(tps, _, ms) => {
|
ast::item_trait(tps, _, _) => {
|
||||||
let {bounds, substs} = mk_substs(ccx, tps, rp);
|
let {bounds, substs} = mk_substs(ccx, tps, rp);
|
||||||
let t = ty::mk_trait(tcx, local_def(it.id), substs, ty::vstore_box);
|
let t = ty::mk_trait(tcx, local_def(it.id), substs, ty::vstore_box);
|
||||||
let tpt = {bounds: bounds,
|
let tpt = {bounds: bounds,
|
||||||
|
|
|
@ -125,12 +125,12 @@ impl infer_ctxt {
|
||||||
match (a_bnd, b_bnd) {
|
match (a_bnd, b_bnd) {
|
||||||
(Some(a_bnd), Some(b_bnd)) => {
|
(Some(a_bnd), Some(b_bnd)) => {
|
||||||
match (ty::get(a_bnd).struct, ty::get(b_bnd).struct) {
|
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,
|
let nr_b = ty::mk_box(self.tcx, {ty: mt_b.ty,
|
||||||
mutbl: m_const});
|
mutbl: m_const});
|
||||||
self.crosspollinate(anmnt, a, nr_b, mt_b.mutbl, r_b)
|
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,
|
let nr_b = ty::mk_uniq(self.tcx, {ty: mt_b.ty,
|
||||||
mutbl: m_const});
|
mutbl: m_const});
|
||||||
self.crosspollinate(anmnt, a, nr_b, mt_b.mutbl, r_b)
|
self.crosspollinate(anmnt, a, nr_b, mt_b.mutbl, r_b)
|
||||||
|
@ -142,7 +142,7 @@ impl infer_ctxt {
|
||||||
self.crosspollinate(anmnt, a, nr_b, m_imm, r_b)
|
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)))
|
ty::ty_evec(mt_b, ty::vstore_slice(r_b)))
|
||||||
if is_borrowable(vs_a) => {
|
if is_borrowable(vs_a) => {
|
||||||
let nr_b = ty::mk_evec(self.tcx, {ty: mt_b.ty,
|
let nr_b = ty::mk_evec(self.tcx, {ty: mt_b.ty,
|
||||||
|
|
|
@ -508,7 +508,7 @@ impl RegionVarBindings {
|
||||||
ok(ty::re_static) // nothing lives longer than static
|
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.combine_vars(
|
||||||
self.lubs, a, b, span,
|
self.lubs, a, b, span,
|
||||||
|old_r, new_r| self.make_subregion(span, old_r, new_r))
|
|old_r, new_r| self.make_subregion(span, old_r, new_r))
|
||||||
|
@ -531,7 +531,7 @@ impl RegionVarBindings {
|
||||||
ok(r)
|
ok(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
(ty::re_var(v_id), _) | (_, ty::re_var(v_id)) => {
|
(ty::re_var(*), _) | (_, ty::re_var(*)) => {
|
||||||
self.combine_vars(
|
self.combine_vars(
|
||||||
self.glbs, a, b, span,
|
self.glbs, a, b, span,
|
||||||
|old_r, new_r| self.make_subregion(span, new_r, old_r))
|
|old_r, new_r| self.make_subregion(span, new_r, old_r))
|
||||||
|
|
Loading…
Reference in a new issue