Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't suggest to use things which weren't found either. #38054

Closed
leoschwarz opened this issue Nov 28, 2016 · 6 comments · Fixed by #39443
Closed

Don't suggest to use things which weren't found either. #38054

leoschwarz opened this issue Nov 28, 2016 · 6 comments · Fixed by #39443
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@leoschwarz
Copy link

Sometimes it is very useful when rustc figures out that the faulty module use you just made is probably just a typo and directs you a potential match (thanks for that!). However it also directs you to potential matches which haven't been found either in certain cases, for example compiling

use DoesntExist1;
use DoesntExist2;

currently (2016-11-28) yields with both stable and nightly the following output:

error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?

While this is merely a suggestion displayed and shouldn't cause any harm at all maybe it might still be worth to check if what is suggested was actually found in the current scope. Or would that be too expensive (e.g. overhead in tracking what was already successfully imported and what not) and is thus left as is by design?

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 29, 2016
@jseyfried jseyfried added the A-resolve Area: Name resolution label Nov 30, 2016
@cyplo
Copy link
Contributor

cyplo commented Dec 28, 2016

Is this easy to fix ? If so - maybe worth marking as so and mentioning on Rust Weekly ?

@jseyfried
Copy link
Contributor

@cyplo Yeah, I believe this can be fixed by replacing these lines with _ => None,.

@jseyfried jseyfried added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Dec 28, 2016
@ioctaptceb
Copy link

I think I can take this, if it hasn't been worked on so far!

@tshepang
Copy link
Member

tshepang commented Jan 5, 2017

@ioctaptceb go for it

@ioctaptceb
Copy link

How can I assign myself?

@cyplo
Copy link
Contributor

cyplo commented Jan 10, 2017

Not sure if you can via github, due to permissions, but you can just start working on it :) There's a trace in the comments, anyone looking for more work would see them hopefully here in this issue.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 4, 2017
…, r=nikomatsakis

Don't suggest to use things which weren't found either

Fixes rust-lang#38054

The best code I can come up with, suggestions are welcome.

Basically, removing ```. Did you mean to use `DoesntExist1`?``` in the code below, because it is useless.

```rust
error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?
```
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 4, 2017
…, r=nikomatsakis

Don't suggest to use things which weren't found either

Fixes rust-lang#38054

The best code I can come up with, suggestions are welcome.

Basically, removing ```. Did you mean to use `DoesntExist1`?``` in the code below, because it is useless.

```rust
error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?
```
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
…, r=nikomatsakis

Don't suggest to use things which weren't found either

Fixes rust-lang#38054

The best code I can come up with, suggestions are welcome.

Basically, removing ```. Did you mean to use `DoesntExist1`?``` in the code below, because it is useless.

```rust
error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?
```
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
…, r=nikomatsakis

Don't suggest to use things which weren't found either

Fixes rust-lang#38054

The best code I can come up with, suggestions are welcome.

Basically, removing ```. Did you mean to use `DoesntExist1`?``` in the code below, because it is useless.

```rust
error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants