From aaeea7ffc36cd705116bf45f0479e51788ae33c5 Mon Sep 17 00:00:00 2001 From: mibac138 <5672750+mibac138@users.noreply.github.com> Date: Tue, 19 May 2020 22:12:41 +0200 Subject: [PATCH] Alter wording for `use foo::self` help --- src/librustc_resolve/diagnostics.rs | 4 ++-- src/test/ui/error-codes/E0429.stderr | 4 ++-- src/test/ui/issues/issue-45829/import-self.stderr | 4 ++-- src/test/ui/use/use-mod/use-mod-4.stderr | 8 ++++---- src/test/ui/use/use-mod/use-mod-5.stderr | 4 ++-- src/test/ui/use/use-mod/use-mod-6.stderr | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index e4f1d7a123d..ea237f1a04f 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -316,7 +316,7 @@ impl<'a> Resolver<'a> { // use foo::bar::self as abc -> foo::bar as abc err.span_suggestion( span, - "Remove `::self`..", + "consider importing the module directly", "".to_string(), Applicability::MachineApplicable, ); @@ -328,7 +328,7 @@ impl<'a> Resolver<'a> { (span_with_rename.shrink_to_hi(), "}".to_string()), ]; err.multipart_suggestion( - "..or add braces around `self`", + "alternatively, use the multi-path `use` syntax to import `self`", braces, Applicability::MachineApplicable, ); diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr index 457782583a5..c598803fa6c 100644 --- a/src/test/ui/error-codes/E0429.stderr +++ b/src/test/ui/error-codes/E0429.stderr @@ -4,11 +4,11 @@ error[E0429]: `self` imports are only allowed within a { } list LL | use std::fmt::self; | ^^^^^^ | -help: Remove `::self`.. +help: consider importing the module directly | LL | use std::fmt; | -- -help: ..or add braces around `self` +help: alternatively, use the multi-path `use` syntax to import `self` | LL | use std::fmt::{self}; | ^ ^ diff --git a/src/test/ui/issues/issue-45829/import-self.stderr b/src/test/ui/issues/issue-45829/import-self.stderr index 2ae2713b004..158e81cdd96 100644 --- a/src/test/ui/issues/issue-45829/import-self.stderr +++ b/src/test/ui/issues/issue-45829/import-self.stderr @@ -10,11 +10,11 @@ error[E0429]: `self` imports are only allowed within a { } list LL | use foo::self; | ^^^^^^ | -help: Remove `::self`.. +help: consider importing the module directly | LL | use foo; | -- -help: ..or add braces around `self` +help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::{self}; | ^ ^ diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index e01c2cbf732..a29bd07ac44 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -4,11 +4,11 @@ error[E0429]: `self` imports are only allowed within a { } list LL | use foo::self; | ^^^^^^ | -help: Remove `::self`.. +help: consider importing the module directly | LL | use foo; | -- -help: ..or add braces around `self` +help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::{self}; | ^ ^ @@ -19,11 +19,11 @@ error[E0429]: `self` imports are only allowed within a { } list LL | use std::mem::self; | ^^^^^^ | -help: Remove `::self`.. +help: consider importing the module directly | LL | use std::mem; | -- -help: ..or add braces around `self` +help: alternatively, use the multi-path `use` syntax to import `self` | LL | use std::mem::{self}; | ^ ^ diff --git a/src/test/ui/use/use-mod/use-mod-5.stderr b/src/test/ui/use/use-mod/use-mod-5.stderr index 859547fbc4d..ebb71c51293 100644 --- a/src/test/ui/use/use-mod/use-mod-5.stderr +++ b/src/test/ui/use/use-mod/use-mod-5.stderr @@ -4,11 +4,11 @@ error[E0429]: `self` imports are only allowed within a { } list LL | use foo::bar::self; | ^^^^^^ | -help: Remove `::self`.. +help: consider importing the module directly | LL | use foo::bar; | -- -help: ..or add braces around `self` +help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::bar::{self}; | ^ ^ diff --git a/src/test/ui/use/use-mod/use-mod-6.stderr b/src/test/ui/use/use-mod/use-mod-6.stderr index 0042325229a..36fdf9c75c7 100644 --- a/src/test/ui/use/use-mod/use-mod-6.stderr +++ b/src/test/ui/use/use-mod/use-mod-6.stderr @@ -4,11 +4,11 @@ error[E0429]: `self` imports are only allowed within a { } list LL | use foo::bar::self as abc; | ^^^^^^ | -help: Remove `::self`.. +help: consider importing the module directly | LL | use foo::bar as abc; | -- -help: ..or add braces around `self` +help: alternatively, use the multi-path `use` syntax to import `self` | LL | use foo::bar::{self as abc}; | ^ ^