Skip to content

use suggestions for local paths are missing crate:: in edition 2018 #52202

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

Closed
zackmdavis opened this issue Jul 10, 2018 · 0 comments
Closed

use suggestions for local paths are missing crate:: in edition 2018 #52202

zackmdavis opened this issue Jul 10, 2018 · 0 comments

Comments

@zackmdavis
Copy link
Member

Consider the following program.

mod inner_mod {
    pub struct MyInnerStruct;
}

fn main() {
    let _s = MyInnerStruct {};
}

When compiled with --edition 2018 with the 6 July nightly, we get this error message:

error[E0422]: cannot find struct, variant or union type `MyInnerStruct` in this scope
 --> import_suggestion.rs:6:14
  |
6 |     let _s = MyInnerStruct {};
  |              ^^^^^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
  |
1 | use inner_mod::MyInnerStruct;
  |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0422`.

But if we take the suggestion literally (and continue using the 2018 edition), inner_mod is presumed to be a crate:

error[E0463]: can't find crate for `inner_mod`
 --> import_suggestion.rs:1:5
  |
1 | use inner_mod::MyInnerStruct;
  |     ^^^^^^^^^ can't find crate

error: aborting due to previous error

A pull request is forthcoming.

bors added a commit that referenced this issue Jul 10, 2018
…, r=oli-obk

correct import suggestions for edition 2018

For #52202.
@bors bors closed this as completed in 96b151b Jul 10, 2018
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

No branches or pull requests

1 participant