Skip to content

Commit

Permalink
Rollup merge of rust-lang#35670 - RockyTV:e0365, r=jonathandturner
Browse files Browse the repository at this point in the history
Update error E0365 to new format

Fixes rust-lang#35633 as part of rust-lang#35233.

r? @jonathandturner
  • Loading branch information
Jonathan Turner committed Aug 17, 2016
2 parents 73b5a93 + a026e2c commit 5b6e6dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, &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();
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/test/compile-fail/E0365.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

0 comments on commit 5b6e6dc

Please sign in to comment.