diff options
| author | Jonathan Turner <jonathandturner@users.noreply.github.com> | 2016-08-17 06:25:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-17 06:25:25 -0700 |
| commit | 02a8e2c285ffda2c9b9bc6d41ff3d58ad00009c9 (patch) | |
| tree | 0757c30ffe16aa6ef2fdd53b444a2bb44ab22dfd | |
| parent | ea09b7d8c6eeeb8433bbdda50ffcc989d4f82fdf (diff) | |
| parent | a026e2c727312fc47b111cc29e684adec7caf341 (diff) | |
| download | rust-02a8e2c285ffda2c9b9bc6d41ff3d58ad00009c9.tar.gz rust-02a8e2c285ffda2c9b9bc6d41ff3d58ad00009c9.zip | |
Rollup merge of #35670 - RockyTV:e0365, r=jonathandturner
Update error E0365 to new format Fixes #35633 as part of #35233. r? @jonathandturner
| -rw-r--r-- | src/librustc_resolve/resolve_imports.rs | 12 | ||||
| -rw-r--r-- | src/test/compile-fail/E0365.rs | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 1e40aa7d187..e08a30e40d3 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -584,12 +584,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { source); self.session.add_lint(PRIVATE_IN_PUBLIC, directive.id, directive.span, msg); } else { - let msg = format!("`{}` is private, and cannot be reexported", source); - let note_msg = - format!("consider declaring type or module `{}` with `pub`", source); - struct_span_err!(self.session, directive.span, E0365, "{}", &msg) - .span_note(directive.span, ¬e_msg) - .emit(); + let mut err = struct_span_err!(self.session, directive.span, E0365, + "`{}` is private, and cannot be reexported", + source); + err.span_label(directive.span, &format!("reexport of private `{}`", source)); + err.note(&format!("consider declaring type or module `{}` with `pub`", source)); + err.emit(); } } diff --git a/src/test/compile-fail/E0365.rs b/src/test/compile-fail/E0365.rs index 7b0fbcc6203..ea5fd6ed477 100644 --- a/src/test/compile-fail/E0365.rs +++ b/src/test/compile-fail/E0365.rs @@ -12,6 +12,9 @@ mod foo { pub const X: u32 = 1; } -pub use foo as foo2; //~ ERROR E0365 +pub use foo as foo2; +//~^ ERROR `foo` is private, and cannot be reexported [E0365] +//~| NOTE reexport of private `foo` +//~| NOTE consider declaring type or module `foo` with `pub` fn main() {} |
