Skip to content

Commit cc59f23

Browse files
---
yaml --- r: 69097 b: refs/heads/auto c: 72cf2ee h: refs/heads/master i: 69095: bdb2573 v: v3
1 parent 567dff6 commit cc59f23

File tree

3 files changed

+62
-23
lines changed

3 files changed

+62
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: a1c5c798c7b8d7b556144ed3ba286936fb8ba639
17+
refs/heads/auto: 72cf2ee1368d385fa13772fd70b7a9e748aaec6b
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/librustc/middle/trans/debuginfo.rs

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -280,30 +280,42 @@ pub fn create_function_metadata(fcx: fn_ctxt) -> DISubprogram {
280280

281281
let fnitem = cx.tcx.items.get_copy(&fcx.id);
282282
let (ident, ret_ty, id) = match fnitem {
283-
ast_map::node_item(ref item, _) => {
284-
match item.node {
285-
ast::item_fn(ast::fn_decl { output: ref ty, _}, _, _, _, _) => {
286-
(item.ident, ty, item.id)
287-
}
288-
_ => fcx.ccx.sess.span_bug(item.span,
289-
"create_function_metadata: item bound to non-function")
283+
ast_map::node_item(ref item, _) => {
284+
match item.node {
285+
ast::item_fn(ast::fn_decl { output: ref ty, _}, _, _, _, _) => {
286+
(item.ident, ty, item.id)
287+
}
288+
_ => fcx.ccx.sess.span_bug(item.span,
289+
"create_function_metadata: item bound to non-function")
290+
}
290291
}
291-
}
292-
ast_map::node_method(@ast::method { decl: ast::fn_decl { output: ref ty, _ },
293-
id: id, ident: ident, _}, _, _) => {
294-
(ident, ty, id)
295-
}
296-
ast_map::node_expr(ref expr) => {
297-
match expr.node {
298-
ast::expr_fn_block(ref decl, _) => {
299-
let name = gensym_name("fn");
300-
(name, &decl.output, expr.id)
301-
}
302-
_ => fcx.ccx.sess.span_bug(expr.span,
303-
"create_function_metadata: expected an expr_fn_block here")
292+
ast_map::node_method(@ast::method { decl: ast::fn_decl { output: ref ty, _ },
293+
id: id, ident: ident, _}, _, _) => {
294+
(ident, ty, id)
304295
}
305-
}
306-
_ => fcx.ccx.sess.bug("create_function_metadata: unexpected sort of node")
296+
ast_map::node_expr(ref expr) => {
297+
match expr.node {
298+
ast::expr_fn_block(ref decl, _) => {
299+
let name = gensym_name("fn");
300+
(name, &decl.output, expr.id)
301+
}
302+
_ => fcx.ccx.sess.span_bug(expr.span,
303+
"create_function_metadata: expected an expr_fn_block here")
304+
}
305+
}
306+
ast_map::node_trait_method(
307+
@ast::provided(
308+
@ast::method {
309+
decl: ast::fn_decl { output: ref ty, _ },
310+
id: id,
311+
ident: ident,
312+
_}
313+
),
314+
_def_id,
315+
_path) => {
316+
(ident, ty, id)
317+
}
318+
_ => fcx.ccx.sess.bug("create_function_metadata: unexpected sort of node")
307319
};
308320

309321
match dbg_cx(cx).created_functions.find(&id) {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:-Z debug-info
12+
13+
#[allow(default_methods)];
14+
15+
pub trait TraitWithDefaultMethod {
16+
pub fn method(self) {
17+
()
18+
}
19+
}
20+
21+
struct MyStruct;
22+
23+
impl TraitWithDefaultMethod for MyStruct { }
24+
25+
fn main() {
26+
MyStruct.method();
27+
}

0 commit comments

Comments
 (0)