@@ -5217,12 +5217,13 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
5217
5217
}
5218
5218
5219
5219
fn get_item_val ( ccx : @crate_ctxt , id : ast:: node_id ) -> ValueRef {
5220
+ debug ! { "get_item_val(id=`%?`)" , id} ;
5220
5221
let tcx = ccx. tcx ;
5221
5222
match ccx. item_vals . find ( id) {
5222
5223
some( v) => v,
5223
5224
none => {
5224
5225
let mut exprt = false ;
5225
- let val = match check ccx. tcx . items . get ( id) {
5226
+ let val = match ccx. tcx . items . get ( id) {
5226
5227
ast_map:: node_item( i, pth) => {
5227
5228
let my_path = vec:: append ( * pth, ~[ path_name ( i. ident ) ] ) ;
5228
5229
match check i. node {
@@ -5246,11 +5247,33 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
5246
5247
}
5247
5248
}
5248
5249
}
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
+ }
5249
5272
ast_map:: node_method( m, impl_id, pth) => {
5250
5273
exprt = true ;
5251
5274
let mty = ty:: node_id_to_type ( ccx. tcx , id) ;
5252
5275
let pth = vec:: append ( * pth, ~[ path_name ( @ccx. names ( ~"meth") ) ,
5253
- path_name ( m. ident ) ] ) ;
5276
+ path_name ( m. ident ) ] ) ;
5254
5277
let llfn = register_fn_full ( ccx, m. span , pth, id, mty) ;
5255
5278
set_inline_hint_if_appr ( m. attrs , llfn) ;
5256
5279
llfn
@@ -5310,6 +5333,9 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
5310
5333
set_inline_hint ( llfn) ;
5311
5334
llfn
5312
5335
}
5336
+ _ => {
5337
+ ccx. sess . bug ( ~"get_item_val ( ) : unexpected variant") ;
5338
+ }
5313
5339
} ;
5314
5340
if !( exprt || ccx. reachable . contains_key ( id) ) {
5315
5341
lib:: llvm:: SetLinkage ( val, lib:: llvm:: InternalLinkage ) ;
0 commit comments