]> git.lizzy.rs Git - rust.git/commitdiff
Update error E0365 to new format
authorAlexandre Oliveira <rockytvbr@gmail.com>
Sun, 14 Aug 2016 19:30:50 +0000 (16:30 -0300)
committerAlexandre Oliveira <rockytvbr@gmail.com>
Sun, 14 Aug 2016 19:33:25 +0000 (16:33 -0300)
src/librustc_resolve/resolve_imports.rs
src/test/compile-fail/E0365.rs

index 6986f99926e1e43d9dd07874d5d25b29a9d4d6df..67588912014ae74e6073108690d1c8e8d041eaf3 100644 (file)
@@ -582,12 +582,12 @@ fn resolve_import(&mut self, directive: &'b ImportDirective<'b>) -> ResolveResul
                                        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, &note_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();
                 }
             }
 
index 7b0fbcc6203d7db99cb92e2033cd4e3f03e7bc84..ea5fd6ed4772f044e7603b5e01c41dc239885670 100644 (file)
@@ -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() {}