Skip to content

Commit cf2a53a

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35670 - RockyTV:e0365, r=jonathandturner
Update error E0365 to new format Fixes rust-lang#35633 as part of rust-lang#35233. r? @jonathandturner
2 parents 153896c + a026e2c commit cf2a53a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/librustc_resolve/resolve_imports.rs

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

src/test/compile-fail/E0365.rs

Lines changed: 4 additions & 1 deletion
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)