-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #10217 : alexcrichton/rust/less-reachable, r=pcwalton
Previously, all functions called by a reachable function were considered reachable, but this is only the case if the original function was possibly inlineable (if it's type generic or #[inline]-flagged).
- Loading branch information
Showing
4 changed files
with
130 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use std::unstable::dynamic_lib::DynamicLibrary; | ||
|
||
#[no_mangle] | ||
pub fn foo() { bar(); } | ||
|
||
pub fn foo2<T>() { | ||
fn bar2() { | ||
bar(); | ||
} | ||
bar2(); | ||
} | ||
|
||
#[no_mangle] | ||
fn bar() { } | ||
|
||
#[no_mangle] | ||
fn baz() { } | ||
|
||
pub fn test() { | ||
let lib = DynamicLibrary::open(None).unwrap(); | ||
unsafe { | ||
assert!(lib.symbol::<int>("foo").is_ok()); | ||
assert!(lib.symbol::<int>("baz").is_err()); | ||
assert!(lib.symbol::<int>("bar").is_err()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// aux-build:linkage-visibility.rs | ||
// xfail-fast windows doesn't like aux-build | ||
|
||
extern mod foo(name = "linkage-visibility"); | ||
|
||
fn main() { | ||
foo::test(); | ||
foo::foo2::<int>(); | ||
foo::foo(); | ||
} |