Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: Encode the visibility of foreign items
The privacy pass of the compiler was previously not taking into account the privacy of foreign items, or bindings to external functions. This commit fixes this oversight by encoding the visibility of foreign items into the metadata for each crate. Any code relying on this will start to fail to compile and the bindings must be marked with `pub` to indicate that they can be used externally. Closes #16725 [breaking-change]
- Loading branch information
1 parent
17f79af
commit 1c76d55
Showing
4 changed files
with
35 additions
and
1 deletion.
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,14 @@ | ||
// Copyright 2014 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. | ||
|
||
extern { | ||
fn bar(); | ||
} | ||
|
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,19 @@ | ||
// Copyright 2014 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:issue-16725.rs | ||
|
||
extern crate foo = "issue-16725"; | ||
|
||
fn main() { | ||
unsafe { foo::bar(); } | ||
//~^ ERROR: function `bar` is private | ||
} | ||
|
1c76d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pcwalton
at alexcrichton@1c76d55
1c76d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/issue-16725 = 1c76d55 into auto
1c76d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/issue-16725 = 1c76d55 merged ok, testing candidate = 5fb2dfa
1c76d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/998
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/998
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/997
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/998
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/993
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/994
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/993
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/999
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/994
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/993
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/996
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/995
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/994
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/995
1c76d55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 5fb2dfa