Fixes #35922.
Fixes #35930.
Part of #35233.
r? @GuillaumeGomez
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`");
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,
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() {}
// 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() {
}