Improve placement of use suggestions

This commit is contained in:
Oliver Schneider 2017-08-17 11:03:59 +02:00
parent 85eadf84f3
commit e0ba29c413
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
9 changed files with 181 additions and 37 deletions

View file

@ -6,7 +6,7 @@ error[E0425]: cannot find value `A` in module `namespaced_enums`
|
help: possible candidate is found in another module, you can import it into scope
|
12 | use namespaced_enums::Foo::A;
14 | use namespaced_enums::Foo::A;
|
error[E0425]: cannot find function `B` in module `namespaced_enums`
@ -17,7 +17,7 @@ error[E0425]: cannot find function `B` in module `namespaced_enums`
|
help: possible candidate is found in another module, you can import it into scope
|
12 | use namespaced_enums::Foo::B;
14 | use namespaced_enums::Foo::B;
|
error[E0422]: cannot find struct, variant or union type `C` in module `namespaced_enums`
@ -28,7 +28,7 @@ error[E0422]: cannot find struct, variant or union type `C` in module `namespace
|
help: possible candidate is found in another module, you can import it into scope
|
12 | use namespaced_enums::Foo::C;
14 | use namespaced_enums::Foo::C;
|
error: aborting due to 3 previous errors

View file

@ -6,7 +6,7 @@ error[E0405]: cannot find trait `OuterTrait` in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
16 | use issue_21221_3::outer::OuterTrait;
18 | use issue_21221_3::outer::OuterTrait;
|
error: cannot continue compilation due to previous error

View file

@ -6,7 +6,7 @@ error[E0405]: cannot find trait `T` in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
16 | use issue_21221_4::T;
18 | use issue_21221_4::T;
|
error: cannot continue compilation due to previous error

View file

@ -6,7 +6,7 @@ error[E0404]: expected trait, found type alias `Foo`
|
help: possible better candidate is found in another module, you can import it into scope
|
12 | use issue_3907::Foo;
14 | use issue_3907::Foo;
|
error: cannot continue compilation due to previous error

View file

@ -10,7 +10,7 @@ error[E0423]: expected value, found struct `Z`
|
help: possible better candidate is found in another module, you can import it into scope
|
15 | use m::n::Z;
16 | use m::n::Z;
|
error[E0423]: expected value, found struct `S`
@ -24,7 +24,7 @@ error[E0423]: expected value, found struct `S`
|
help: possible better candidate is found in another module, you can import it into scope
|
13 | use m::S;
15 | use m::S;
|
error[E0423]: expected value, found struct `xcrate::S`
@ -38,7 +38,7 @@ error[E0423]: expected value, found struct `xcrate::S`
|
help: possible better candidate is found in another module, you can import it into scope
|
13 | use m::S;
15 | use m::S;
|
error[E0603]: tuple struct `Z` is private

View file

@ -0,0 +1,27 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
macro_rules! y {
() => {}
}
mod m {
pub const A: i32 = 0;
}
fn main() {
y!();
let _ = A;
foo();
}
fn foo() {
type Dict<K, V> = HashMap<K, V>;
}

View file

@ -0,0 +1,38 @@
error[E0425]: cannot find value `A` in this scope
--> $DIR/use_suggestion_placement.rs:21:13
|
21 | let _ = A;
| ^ not found in this scope
|
help: possible candidate is found in another module, you can import it into scope
|
11 | use m::A;
|
error[E0412]: cannot find type `HashMap` in this scope
--> $DIR/use_suggestion_placement.rs:26:23
|
26 | type Dict<K, V> = HashMap<K, V>;
| ^^^^^^^ not found in this scope
|
help: possible candidates are found in other modules, you can import them into scope
|
11 | use std::collections::HashMap;
|
11 | use std::collections::hash_map::HashMap;
|
error[E0091]: type parameter `K` is unused
--> $DIR/use_suggestion_placement.rs:26:15
|
26 | type Dict<K, V> = HashMap<K, V>;
| ^ unused type parameter
error[E0091]: type parameter `V` is unused
--> $DIR/use_suggestion_placement.rs:26:18
|
26 | type Dict<K, V> = HashMap<K, V>;
| ^ unused type parameter
error: aborting due to 4 previous errors

View file

@ -1,11 +1,3 @@
error[E0577]: expected module, found struct `S`
--> $DIR/visibility-ty-params.rs:16:5
|
16 | m!{ S<u8> } //~ ERROR generic arguments in visibility path
| -^^^^
| |
| did you mean `m`?
error: generic arguments in visibility path
--> $DIR/visibility-ty-params.rs:16:6
|
@ -18,5 +10,13 @@ error: generic arguments in visibility path
20 | m!{ m<> } //~ ERROR generic arguments in visibility path
| ^^
error[E0577]: expected module, found struct `S`
--> $DIR/visibility-ty-params.rs:16:5
|
16 | m!{ S<u8> } //~ ERROR generic arguments in visibility path
| -^^^^
| |
| did you mean `m`?
error: aborting due to 3 previous errors