Skip to content

Commit 44d9601

Browse files
committed
Auto merge of #30328 - sanxiyn:include-type-name, r=alexcrichton
Fix #30260.
2 parents f150c17 + 8740575 commit 44d9601

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

src/librustc/front/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
122122
// Pick the def data. This need not be unique, but the more
123123
// information we encapsulate into
124124
let def_data = match i.node {
125-
ItemDefaultImpl(..) | ItemImpl(..) => DefPathData::Impl,
125+
ItemDefaultImpl(..) | ItemImpl(..) => DefPathData::Impl(i.name),
126126
ItemEnum(..) | ItemStruct(..) | ItemTrait(..) => DefPathData::Type(i.name),
127127
ItemExternCrate(..) | ItemMod(..) => DefPathData::Mod(i.name),
128128
ItemStatic(..) | ItemConst(..) | ItemFn(..) => DefPathData::Value(i.name),

src/librustc/front/map/definitions.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub enum DefPathData {
7373
Misc,
7474

7575
// Different kinds of items and item-like things:
76-
Impl,
76+
Impl(ast::Name),
7777
Type(ast::Name),
7878
Mod(ast::Name),
7979
Value(ast::Name),
@@ -177,6 +177,7 @@ impl DefPathData {
177177
pub fn as_interned_str(&self) -> InternedString {
178178
use self::DefPathData::*;
179179
match *self {
180+
Impl(name) |
180181
Type(name) |
181182
Mod(name) |
182183
Value(name) |
@@ -212,10 +213,6 @@ impl DefPathData {
212213
InternedString::new("?")
213214
}
214215

215-
Impl => {
216-
InternedString::new("<impl>")
217-
}
218-
219216
ClosureExpr => {
220217
InternedString::new("<closure>")
221218
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-include ../tools.mk
2+
3+
# Check that symbol names for methods include type names, instead of <impl>.
4+
5+
OUT=$(TMPDIR)/lib.s
6+
7+
all:
8+
$(RUSTC) --crate-type staticlib --emit asm lib.rs
9+
grep Def $(OUT)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 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+
pub struct Def {
12+
pub id: i32,
13+
}
14+
15+
impl Def {
16+
pub fn new(id: i32) -> Def {
17+
Def { id: id }
18+
}
19+
}

0 commit comments

Comments
 (0)