Skip to content

Commit 11634d9

Browse files
committed
---
yaml --- r: 275189 b: refs/heads/stable c: f8d6dcf h: refs/heads/master i: 275187: d6c7345
1 parent 98ba3aa commit 11634d9

File tree

6 files changed

+25
-14
lines changed

6 files changed

+25
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 3358fb11da258007d26cc27364455c610088d630
32+
refs/heads/stable: f8d6dcf46ec646a41d0dc222764cc0ed026ceb03
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern crate getopts;
5151
extern crate graphviz;
5252
extern crate libc;
5353
extern crate rbml;
54-
extern crate rustc_llvm;
54+
pub extern crate rustc_llvm as llvm;
5555
extern crate rustc_back;
5656
extern crate rustc_front;
5757
extern crate rustc_data_structures;
@@ -66,8 +66,6 @@ extern crate serialize as rustc_serialize; // used by deriving
6666
#[cfg(test)]
6767
extern crate test;
6868

69-
pub use rustc_llvm as llvm;
70-
7169
#[macro_use]
7270
mod macros;
7371

branches/stable/src/librustc_resolve/resolve_imports.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,23 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
402402
}
403403

404404
(_, &Success(name_binding)) if !name_binding.is_import() && directive.is_public => {
405-
// Disallow reexporting private items, excepting extern crates.
406-
if !name_binding.is_public() && !name_binding.is_extern_crate() {
407-
let msg = format!("`{}` is private, and cannot be reexported", source);
408-
let note_msg =
409-
format!("Consider declaring type or module `{}` with `pub`", source);
410-
struct_span_err!(self.resolver.session, directive.span, E0365, "{}", &msg)
411-
.span_note(directive.span, &note_msg)
412-
.emit();
405+
if !name_binding.is_public() {
406+
if name_binding.is_extern_crate() {
407+
let msg = format!("extern crate `{}` is private, and cannot be reexported \
408+
(error E0364), consider declaring with `pub`",
409+
source);
410+
self.resolver.session.add_lint(lint::builtin::PRIVATE_IN_PUBLIC,
411+
directive.id,
412+
directive.span,
413+
msg);
414+
} else {
415+
let msg = format!("`{}` is private, and cannot be reexported", source);
416+
let note_msg =
417+
format!("Consider declaring type or module `{}` with `pub`", source);
418+
struct_span_err!(self.resolver.session, directive.span, E0365, "{}", &msg)
419+
.span_note(directive.span, &note_msg)
420+
.emit();
421+
}
413422
} else if name_binding.defined_with(DefModifiers::PRIVATE_VARIANT) {
414423
let msg = format!("variant `{}` is private, and cannot be reexported \
415424
(error E0364), consider declaring its enum as `pub`",

branches/stable/src/librustc_trans/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern crate rustc;
4646
extern crate rustc_back;
4747
extern crate rustc_data_structures;
4848
extern crate rustc_front;
49-
extern crate rustc_llvm as llvm;
49+
pub extern crate rustc_llvm as llvm;
5050
extern crate rustc_mir;
5151
extern crate rustc_platform_intrinsics as intrinsics;
5252
extern crate serialize;

branches/stable/src/libstd/sys/unix/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use sys_common::net::{getsockopt, setsockopt};
2121
use time::Duration;
2222

2323
pub use sys::{cvt, cvt_r};
24-
pub use libc as netc;
24+
pub extern crate libc as netc;
2525

2626
pub type wrlen_t = size_t;
2727

branches/stable/src/test/compile-fail/private-variant-reexport.rs renamed to branches/stable/src/test/compile-fail/private-variant-and-crate-reexport.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#![feature(rustc_attrs)]
1212
#![allow(dead_code)]
1313

14+
extern crate core;
15+
pub use core as reexported_core; //~ WARN extern crate `core` is private, and cannot be reexported
16+
//~^ WARNING hard error
17+
1418
mod m1 {
1519
pub use ::E::V; //~ WARN variant `V` is private, and cannot be reexported
1620
//~^ WARNING hard error

0 commit comments

Comments
 (0)