Skip to content

Prelude not imported in rustc_span #8815

@jonas-schievink

Description

@jonas-schievink

When editing https://github.com/rust-lang/rust/blob/e1ff91f439bc09f566da211c6449821b4e949279/compiler/rustc_span/src/lib.rs, items from the libstd prelude don't seem to be in scope (including macros exported via #[macro_export]). Manually accessing items from libstd and libcore does work, though.

Looking at the code we use to inject the prelude, this looks a bit questionable, since it relies on the order of dependencies:

https://github.com/rust-analyzer/rust-analyzer/blob/312f1fe20a6a0a8e69834c66f51b9abc9db5e0ce/crates/hir_def/src/nameres/collector.rs#L67-L73

However, this could also be caused by us not handling "cyclic" dev-dependencies correctly, because I see this in the output:

[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1165)) -> core(CrateId(191))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1165)) -> core(CrateId(191))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1165)) -> core(CrateId(191))

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-nameresname, path and module resolutionS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions