From 5c2c19aa89d5c855ac34a8978612fbd4f038872c Mon Sep 17 00:00:00 2001 From: Luke Hinds Date: Tue, 9 Aug 2016 22:31:57 +0100 Subject: [PATCH 1/2] Update error message for E0253 #35512 Fixes #35512. Part of #35233. --- src/librustc_resolve/resolve_imports.rs | 4 +++- src/test/compile-fail/E0253.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 6986f99926e1e..1e40aa7d18766 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -505,7 +505,9 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { } Success(binding) if !binding.is_importable() => { let msg = format!("`{}` is not directly importable", target); - span_err!(self.session, directive.span, E0253, "{}", &msg); + struct_span_err!(self.session, directive.span, E0253, "{}", &msg) + .span_label(directive.span, &format!("cannot be imported directly")) + .emit(); // Do not import this illegal binding. Import a dummy binding and pretend // everything is fine self.import_dummy_binding(module, directive); diff --git a/src/test/compile-fail/E0253.rs b/src/test/compile-fail/E0253.rs index 28fcf4452b3e8..6093f7a81fea1 100644 --- a/src/test/compile-fail/E0253.rs +++ b/src/test/compile-fail/E0253.rs @@ -14,6 +14,8 @@ mod foo { } } -use foo::MyTrait::do_something; //~ ERROR E0253 +use foo::MyTrait::do_something; + //~^ ERROR E0253 + //~|NOTE not directly importable fn main() {} From c974749be8dccd2cf15409f8248e392a85574141 Mon Sep 17 00:00:00 2001 From: Luke Hinds Date: Wed, 10 Aug 2016 19:15:39 +0100 Subject: [PATCH 2/2] Update E0253.rs changed error text --- src/test/compile-fail/E0253.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/compile-fail/E0253.rs b/src/test/compile-fail/E0253.rs index 6093f7a81fea1..5a06c01241b4b 100644 --- a/src/test/compile-fail/E0253.rs +++ b/src/test/compile-fail/E0253.rs @@ -16,6 +16,6 @@ mod foo { use foo::MyTrait::do_something; //~^ ERROR E0253 - //~|NOTE not directly importable + //~|NOTE cannot be imported directly fn main() {}