Skip to content

Commit 6807349

Browse files
ktt3jaalexcrichton
authored andcommitted
privacy: Add publically-reexported foreign item to exported item set
Close #15740
1 parent 2daa097 commit 6807349

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/librustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl<'a> Visitor<()> for EmbargoVisitor<'a> {
325325
}
326326

327327
fn visit_foreign_item(&mut self, a: &ast::ForeignItem, _: ()) {
328-
if self.prev_exported && a.vis == ast::Public {
328+
if (self.prev_exported && a.vis == ast::Public) || self.reexports.contains(&a.id) {
329329
self.exported_items.insert(a.id);
330330
}
331331
}

src/test/compile-fail/lint-dead-code-3.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
extern crate libc;
1818

19+
pub use x = extern_foo;
20+
extern {
21+
fn extern_foo();
22+
}
23+
1924
struct Foo; //~ ERROR: code is never used
2025
impl Foo {
2126
fn foo(&self) { //~ ERROR: code is never used

0 commit comments

Comments
 (0)