Skip to content

Better error message for certain classes of unresolved imports#6347

Merged
bors merged 4 commits into
rust-lang:incomingfrom
emberian:unknown_module_resolve_error
May 10, 2013
Merged

Better error message for certain classes of unresolved imports#6347
bors merged 4 commits into
rust-lang:incomingfrom
emberian:unknown_module_resolve_error

Conversation

@emberian

@emberian emberian commented May 9, 2013

Copy link
Copy Markdown
Contributor

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

emberian commented May 9, 2013

Copy link
Copy Markdown
Contributor Author

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

@kud1ing

kud1ing commented May 9, 2013

Copy link
Copy Markdown

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

@emberian

emberian commented May 9, 2013

Copy link
Copy Markdown
Contributor Author

Done

@kud1ing

kud1ing commented May 9, 2013

Copy link
Copy Markdown

Nice, thanks.

@emberian

emberian commented May 9, 2013

Copy link
Copy Markdown
Contributor Author

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

@emberian

emberian commented May 9, 2013

Copy link
Copy Markdown
Contributor Author

tests pass, was that what you meant @catamorphism?

@emberian

Copy link
Copy Markdown
Contributor Author

Whoops, added license.

@catamorphism

Copy link
Copy Markdown
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.

4 participants