Skip to content

Commit 035db89

Browse files
michaelwoeristeralexcrichton
authored andcommitted
---
yaml --- r: 110567 b: refs/heads/master c: 5099b8c h: refs/heads/master i: 110565: 1a7d0e9 110563: 75d3023 110559: f123359 v: v3
1 parent 9d0e780 commit 035db89

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
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: c26d25466d93cefea6cf81ec3f0e64200a7150be
2+
refs/heads/master: 5099b8c863150675450631347436b7d220f4efd3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: e263ef1df7b892ed29e53313565eb05ab75e52f4
55
refs/heads/try: 597a645456b55e1c886ce15d23a192abdf4d55cf

trunk/src/librustc/middle/trans/debuginfo.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,13 @@ pub fn create_global_var_metadata(cx: &CrateContext,
293293
return;
294294
}
295295

296+
// Don't create debuginfo for globals inlined from other crates. The other crate should already
297+
// contain debuginfo for it. More importantly, the global might not even exist in un-inlined
298+
// form anywhere which would lead to a linker errors.
299+
if cx.external_srcs.borrow().contains_key(&node_id) {
300+
return;
301+
}
302+
296303
let var_item = cx.tcx.map.get(node_id);
297304

298305
let (ident, span) = match var_item {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2013-2014 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+
#![crate_type = "lib"]
12+
// compile-flags:-g
13+
14+
pub use private::P;
15+
16+
pub struct S {
17+
p: P,
18+
}
19+
20+
mod private {
21+
pub struct P {
22+
p: i32,
23+
}
24+
pub static THREE: P = P { p: 3 };
25+
}
26+
27+
pub static A: S = S { p: private::THREE };
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2013-2014 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+
// ignore-android: FIXME(#10381)
12+
13+
// aux-build:issue13213aux.rs
14+
extern crate issue13213aux;
15+
16+
// compile-flags:-g
17+
18+
// This tests make sure that we get no linker error when using a completely inlined static. Some
19+
// statics that are marked with AvailableExternallyLinkage in the importing crate, may actually not
20+
// be available because they have been optimized out from the exporting crate.
21+
fn main() {
22+
let b: issue13213aux::S = issue13213aux::A;
23+
zzz();
24+
}
25+
26+
fn zzz() {()}

0 commit comments

Comments
 (0)