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

Better error message for certain classes of unresolved imports #6347

Merged
merged 4 commits into from
May 10, 2013
Merged

Better error message for certain classes of unresolved imports #6347

merged 4 commits into from
May 10, 2013

Conversation

emberian
Copy link
Member

@emberian emberian commented May 9, 2013

This improves error reporting for the following class of imports:

use foo::bar;

Where foo, the topmost module, is unresolved. It now results in:

/tmp/foo.rs:1:4: 1:7 error: unresolved import.  perhapsyou forgot an 'extern mod foo'?
/tmp/foo.rs:1 use foo::bar;
                  ^~~
/tmp/foo.rs:1:4: 1:12 error: failed to resolve import: foo::bar
/tmp/foo.rs:1 use foo::bar;
                  ^~~~~~~~
error: failed to resolve imports
error: aborting due to 3 previous errors

This is the first of a series of changes I plan on making to unresolved name error messages.

@emberian
Copy link
Member Author

emberian commented May 9, 2013

I assume you'll want me to squash these whitespace commits into the first?

@kud1ing
Copy link

kud1ing commented May 9, 2013

Would you mind changing perhaps you forgot an to maybe a missing?

@emberian
Copy link
Member Author

emberian commented May 9, 2013

Done

@kud1ing
Copy link

kud1ing commented May 9, 2013

Nice, thanks.

@emberian
Copy link
Member Author

emberian commented May 9, 2013

(haven't actually run that test yet, not at home with a decent computer)

@emberian
Copy link
Member Author

emberian commented May 9, 2013

tests pass, was that what you meant @catamorphism?

@emberian
Copy link
Member Author

Whoops, added license.

@catamorphism
Copy link
Contributor

@cmr - Thanks!

bors added a commit that referenced this pull request May 10, 2013
…rphism

This improves error reporting for the following class of imports:

```rust
use foo::bar;
```

Where foo, the topmost module, is unresolved. It now results in:

```text
/tmp/foo.rs:1:4: 1:7 error: unresolved import.  perhapsyou forgot an 'extern mod foo'?
/tmp/foo.rs:1 use foo::bar;
                  ^~~
/tmp/foo.rs:1:4: 1:12 error: failed to resolve import: foo::bar
/tmp/foo.rs:1 use foo::bar;
                  ^~~~~~~~
error: failed to resolve imports
error: aborting due to 3 previous errors
```

This is the first of a series of changes I plan on making to unresolved name error messages.
@bors bors closed this May 10, 2013
@bors bors merged commit 9cbab89 into rust-lang:incoming May 10, 2013
@emberian emberian deleted the unknown_module_resolve_error branch May 10, 2013 17:44
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 20, 2020
Changelog Rust 1.48

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

This changelog is **big**. Hacktoberfest was pretty good for us, even though we had too few reviewers.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants