Skip to content

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

Closed

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

Activity

  1. added
    A-HIRArea: The high-level intermediate representation (HIR)
    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
    on May 21, 2019
  2. added a commit that references this issue on Sep 7, 2019
  3. Centril commented on Dec 1, 2019

    @Centril
    Contributor

    This would be fixed by #60607.

  4. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Dec 1, 2019
  5. self-assigned this
    on Aug 4, 2020
  6. davidtwco commented on Aug 4, 2020

    @davidtwco
    Member

    Opened #75145 which fixes this.

  7. added a commit that references this issue on Aug 16, 2020
    3e5ce7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions