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

Prelude not imported in rustc_span #8815

Closed
Tracked by #8915
jonas-schievink opened this issue May 12, 2021 · 0 comments · Fixed by #9097
Closed
Tracked by #8915

Prelude not imported in rustc_span #8815

jonas-schievink opened this issue May 12, 2021 · 0 comments · Fixed by #9097
Labels
A-nameres name, path and module resolution S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

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))
@jonas-schievink jonas-schievink added S-actionable Someone could pick this issue up and work on it right now A-nameres name, path and module resolution labels May 12, 2021
@bors bors bot closed this as completed in 4f63e79 Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-nameres name, path and module resolution S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant