Skip to content

Commit a026e2c

Browse files
committed
Update error E0365 to new format
1 parent 92ae4ce commit a026e2c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/librustc_resolve/resolve_imports.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
582582
source);
583583
self.session.add_lint(PRIVATE_IN_PUBLIC, directive.id, directive.span, msg);
584584
} else {
585-
let msg = format!("`{}` is private, and cannot be reexported", source);
586-
let note_msg =
587-
format!("consider declaring type or module `{}` with `pub`", source);
588-
struct_span_err!(self.session, directive.span, E0365, "{}", &msg)
589-
.span_note(directive.span, &note_msg)
590-
.emit();
585+
let mut err = struct_span_err!(self.session, directive.span, E0365,
586+
"`{}` is private, and cannot be reexported",
587+
source);
588+
err.span_label(directive.span, &format!("reexport of private `{}`", source));
589+
err.note(&format!("consider declaring type or module `{}` with `pub`", source));
590+
err.emit();
591591
}
592592
}
593593

src/test/compile-fail/E0365.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ mod foo {
1212
pub const X: u32 = 1;
1313
}
1414

15-
pub use foo as foo2; //~ ERROR E0365
15+
pub use foo as foo2;
16+
//~^ ERROR `foo` is private, and cannot be reexported [E0365]
17+
//~| NOTE reexport of private `foo`
18+
//~| NOTE consider declaring type or module `foo` with `pub`
1619

1720
fn main() {}

0 commit comments

Comments
 (0)