Skip to content

Commit 8aa870c

Browse files
committed
---
yaml --- r: 23159 b: refs/heads/master c: b1ec0a5 h: refs/heads/master i: 23157: 851bac4 23155: 7faeeca 23151: 14e2277 v: v3
1 parent 54d7e38 commit 8aa870c

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0e0833e0b038ea3015a2036e0c9431f6c60db82f
2+
refs/heads/master: b1ec0a582e16cb6e21d9199c9b6df0f8c4c8f00c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/rustc/middle/trans/base.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5217,12 +5217,13 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
52175217
}
52185218

52195219
fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
5220+
debug!{"get_item_val(id=`%?`)", id};
52205221
let tcx = ccx.tcx;
52215222
match ccx.item_vals.find(id) {
52225223
some(v) => v,
52235224
none => {
52245225
let mut exprt = false;
5225-
let val = match check ccx.tcx.items.get(id) {
5226+
let val = match ccx.tcx.items.get(id) {
52265227
ast_map::node_item(i, pth) => {
52275228
let my_path = vec::append(*pth, ~[path_name(i.ident)]);
52285229
match check i.node {
@@ -5246,11 +5247,33 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
52465247
}
52475248
}
52485249
}
5250+
ast_map::node_trait_method(trait_method, _, pth) => {
5251+
debug!{"get_item_val(): processing a node_trait_method"};
5252+
match *trait_method {
5253+
ast::required(_) => {
5254+
ccx.sess.bug(~"unexpected variant: required trait method in \
5255+
get_item_val()");
5256+
}
5257+
ast::provided(m) => {
5258+
// FIXME (#2794): Default methods currently compiling but not
5259+
// linking successfully; not sure if this is correct. It's
5260+
// just copypasta from the node_method case.
5261+
exprt = true;
5262+
let mty = ty::node_id_to_type(ccx.tcx, id);
5263+
let pth =
5264+
vec::append(*pth, ~[path_name(@ccx.names(~"meth")),
5265+
path_name(m.ident)]);
5266+
let llfn = register_fn_full(ccx, m.span, pth, id, mty);
5267+
set_inline_hint_if_appr(m.attrs, llfn);
5268+
llfn
5269+
}
5270+
}
5271+
}
52495272
ast_map::node_method(m, impl_id, pth) => {
52505273
exprt = true;
52515274
let mty = ty::node_id_to_type(ccx.tcx, id);
52525275
let pth = vec::append(*pth, ~[path_name(@ccx.names(~"meth")),
5253-
path_name(m.ident)]);
5276+
path_name(m.ident)]);
52545277
let llfn = register_fn_full(ccx, m.span, pth, id, mty);
52555278
set_inline_hint_if_appr(m.attrs, llfn);
52565279
llfn
@@ -5310,6 +5333,9 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
53105333
set_inline_hint(llfn);
53115334
llfn
53125335
}
5336+
_ => {
5337+
ccx.sess.bug(~"get_item_val(): unexpected variant");
5338+
}
53135339
};
53145340
if !(exprt || ccx.reachable.contains_key(id)) {
53155341
lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage);

0 commit comments

Comments
 (0)