Skip to content

extern crate ... as std overrides the injected crate on 2018 edition #61019

Closed
@matthewjasper

Description

@matthewjasper

On the 2018 edition the following code:

extern crate some_crate as std; // or as core with #![no_std]

will:

  • Try to resolve prelude::v1::* in some_crate, failing if it doesn't exist. This probably limits the plausible cases where this could happen to extern crate core as std, and extern crate core as std with #![no_std].
  • Use some_crate in any built-in derives and for HIR lowering.

I would expect that the prelude and derives/HIR lowering to always use the injected std/core. Paths starting with std should still resolve to the in the crate the user provided.

In the 2015 edition it creates a name conflict with the implicit extern crate std.

cc @petrochenkov @eddyb

Metadata

Metadata

Assignees

Labels

A-HIRArea: The high-level intermediate representation (HIR)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions