about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-24 10:35:29 -0700
committerGitHub <noreply@github.com>2016-08-24 10:35:29 -0700
commit2932db19b535a851a42e4c20ca2d901aff2b612f (patch)
treeb6cf9531beacc1a9d6627b0e68ddf78c34a8dd89 /src
parent411a85e2717ddd016fa4a3fbf5df5231018616ec (diff)
parent11e9b8de7db8d5500cbee2252f6afd870f186104 (diff)
downloadrust-2932db19b535a851a42e4c20ca2d901aff2b612f.tar.gz
rust-2932db19b535a851a42e4c20ca2d901aff2b612f.zip
Rollup merge of #35961 - 0xmohit:pr/error-codes-E0445-E0454, r=GuillaumeGomez
Update E0445 and E0454 to new error format

Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez
Diffstat (limited to 'src')
-rw-r--r--src/librustc_metadata/creader.rs6
-rw-r--r--src/librustc_privacy/lib.rs7
-rw-r--r--src/test/compile-fail/E0445.rs12
-rw-r--r--src/test/compile-fail/E0454.rs4
4 files changed, 21 insertions, 8 deletions
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index 4a656b180f2..46469efea6b 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -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`");
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index de9ddcd9342..028632ad7c0 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -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,
diff --git a/src/test/compile-fail/E0445.rs b/src/test/compile-fail/E0445.rs
index 6b360c60a0f..7c5c862a6f8 100644
--- a/src/test/compile-fail/E0445.rs
+++ b/src/test/compile-fail/E0445.rs
@@ -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() {}
diff --git a/src/test/compile-fail/E0454.rs b/src/test/compile-fail/E0454.rs
index 1439c3133d9..39887927c88 100644
--- a/src/test/compile-fail/E0454.rs
+++ b/src/test/compile-fail/E0454.rs
@@ -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() {
 }