Skip to content

suggestions from other crates only work when an explicit extern crate is present #51212

Closed
@nikomatsakis

Description

@nikomatsakis

UPDATE: There has been some progress on this issue. crate:: prefixes now work, but you still don't get suggestions from other crates except when you write an explicit extern crate.

When you get name resolution suggestions from resolve after an error, they should use crate:: prefixes where appropriate.

Example (play):

#![feature(crate_visibility_modifier)]
#![feature(crate_in_paths)]

mod bar {
    crate struct Foo;
}

fn main() {
    Foo;
}

gives

error[E0425]: cannot find value `Foo` in this scope
 --> src/main.rs:9:5
  |
9 |     Foo;
  |     ^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
  |
4 | use bar::Foo;
  |

but I want to see use crate::bar::Foo suggested.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-edition-2018Area: The 2018 editionF-rust_2018_preview`#![feature(rust_2018_preview)]`P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-epochWorking group: Epoch (2018) management

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions