Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update E0445 and E0454 to new error format #35961

Merged
merged 1 commit into from
Aug 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ fn register_native_lib(sess: &Session,
if name.is_empty() {
match span {
Some(span) => {
span_err!(sess, span, E0454,
"#[link(name = \"\")] given with empty name");
struct_span_err!(sess, span, E0454,
"#[link(name = \"\")] given with empty name")
.span_label(span, &format!("empty name given"))
.emit();
}
None => {
sess.err("empty library name given via `-l`");
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,11 @@ impl<'a, 'tcx: 'a, 'v> Visitor<'v> for SearchInterfaceForPrivateItemsVisitor<'a,
if !vis.is_at_least(self.required_visibility, &self.tcx.map) {
if self.tcx.sess.features.borrow().pub_restricted ||
self.old_error_set.contains(&trait_ref.ref_id) {
span_err!(self.tcx.sess, trait_ref.path.span, E0445,
"private trait in public interface");
struct_span_err!(self.tcx.sess, trait_ref.path.span, E0445,
"private trait in public interface")
.span_label(trait_ref.path.span, &format!(
"private trait can't be public"))
.emit();
} else {
self.tcx.sess.add_lint(lint::builtin::PRIVATE_IN_PUBLIC,
node_id,
Expand Down
12 changes: 9 additions & 3 deletions src/test/compile-fail/E0445.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ trait Foo {
fn dummy(&self) { }
}

pub trait Bar : Foo {} //~ ERROR E0445
pub struct Bar2<T: Foo>(pub T); //~ ERROR E0445
pub fn foo<T: Foo> (t: T) {} //~ ERROR E0445
pub trait Bar : Foo {}
//~^ ERROR private trait in public interface [E0445]
//~| NOTE private trait can't be public
pub struct Bar2<T: Foo>(pub T);
//~^ ERROR private trait in public interface [E0445]
//~| NOTE private trait can't be public
pub fn foo<T: Foo> (t: T) {}
//~^ ERROR private trait in public interface [E0445]
//~| NOTE private trait can't be public

fn main() {}
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0454.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[link(name = "")] extern {} //~ ERROR E0454
#[link(name = "")] extern {}
//~^ ERROR E0454
//~| NOTE empty name given

fn main() {
}