From a3e54b59f9779b800d067645d59e92bdc3ce53c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 7 Apr 2020 18:07:26 -0700 Subject: [PATCH] Do not suggest adding type param when `use` is already suggested Fix #70365, cc #70572. --- src/librustc_resolve/lib.rs | 3 +-- src/test/ui/privacy/privacy-ns1.stderr | 4 ---- src/test/ui/suggestions/no-extern-crate-in-type.stderr | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 21f43b6fd4f..525a0955c0a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2480,8 +2480,7 @@ fn report_with_use_injections(&mut self, krate: &Crate) { let (span, found_use) = UsePlacementFinder::check(krate, node_id); if !candidates.is_empty() { diagnostics::show_candidates(&mut err, span, &candidates, better, found_use); - } - if let Some((span, msg, sugg, appl)) = suggestion { + } else if let Some((span, msg, sugg, appl)) = suggestion { err.span_suggestion(span, msg, sugg, appl); } err.emit(); diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 66e9b78f676..45ca00f55ab 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -63,10 +63,6 @@ LL | use foo2::Bar; | LL | use foo3::Bar; | -help: you might be missing a type parameter - | -LL | fn test_glob3() { - | ^^^^^ error[E0107]: wrong number of const arguments: expected 0, found 1 --> $DIR/privacy-ns1.rs:35:17 diff --git a/src/test/ui/suggestions/no-extern-crate-in-type.stderr b/src/test/ui/suggestions/no-extern-crate-in-type.stderr index 0a73a269134..22aad3b0a9f 100644 --- a/src/test/ui/suggestions/no-extern-crate-in-type.stderr +++ b/src/test/ui/suggestions/no-extern-crate-in-type.stderr @@ -8,10 +8,6 @@ help: possible candidate is found in another module, you can import it into scop | LL | use foo::Foo; | -help: you might be missing a type parameter - | -LL | type Output = Option; - | ^^^^^ error: aborting due to previous error