Skip to content

Commit b6f1e30

Browse files
committed
librustc: Add missing cases in kind and privacy checking to try to put out the burning tinderbox. rs=rustbot
1 parent 83a55ea commit b6f1e30

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

src/librustc/middle/kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
239239
debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr()));
240240
let id_to_use = match e.node {
241241
expr_index(*)|expr_assign_op(*)|
242-
expr_unary(*)|expr_binary(*) => e.callee_id,
242+
expr_unary(*)|expr_binary(*)|expr_method_call(*) => e.callee_id,
243243
_ => e.id
244244
};
245245

src/librustc/middle/privacy.rs

+27-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
use /*mod*/ syntax::ast;
55
use /*mod*/ syntax::visit;
66
use syntax::ast_map;
7-
use syntax::ast::{def_variant, expr_field, expr_struct, expr_unary, ident,
8-
item_class};
9-
use syntax::ast::{item_impl, item_trait, item_enum, local_crate, node_id,
10-
pat_struct};
11-
use syntax::ast::{private, provided, required};
7+
use syntax::ast::{def_variant, expr_field, expr_method_call, expr_struct};
8+
use syntax::ast::{expr_unary, ident, item_class, item_enum, item_impl};
9+
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, private};
10+
use syntax::ast::{provided, required};
1211
use syntax::ast_map::{node_item, node_method};
13-
use syntax::ast_util::{has_legacy_export_attr, is_local,
14-
visibility_to_privacy, Private, Public};
12+
use syntax::ast_util::{Private, Public, has_legacy_export_attr, is_local};
13+
use syntax::ast_util::{visibility_to_privacy};
1514
use ty::{ty_class, ty_enum};
1615
use typeck::{method_map, method_origin, method_param, method_self};
1716
use typeck::{method_static, method_trait};
@@ -213,6 +212,27 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
213212
_ => {}
214213
}
215214
}
215+
expr_method_call(base, _, _, _, _) => {
216+
match ty::get(ty::expr_ty(tcx, base)).sty {
217+
ty_class(id, _)
218+
if id.crate != local_crate ||
219+
!privileged_items.contains(&(id.node)) => {
220+
match method_map.find(expr.id) {
221+
None => {
222+
tcx.sess.span_bug(expr.span,
223+
~"method call not in \
224+
method map");
225+
}
226+
Some(entry) => {
227+
debug!("(privacy checking) checking \
228+
impl method");
229+
check_method(expr.span, &entry.origin);
230+
}
231+
}
232+
}
233+
_ => {}
234+
}
235+
}
216236
expr_struct(_, fields, _) => {
217237
match ty::get(ty::expr_ty(tcx, expr)).sty {
218238
ty_class(id, _) => {

0 commit comments

Comments
 (0)