Skip to content

Move attributes from crate source into Cargo.toml where appropriate #41701

Closed

Description

@hanna-kruppe

The compiler and std crates in-tree have a few attributes in their source code (lib.rs) that are conventionally set in the Cargo.toml file. I'd say this just wasn't cleaned up when rustbuild became the only build system, and should be cleaned up.

Possibly incomplete list of such attributes:

  • #![crate_name]
  • #![crate_type]

Note that some crates have different crate types in between Cargo.toml than in lib.rs (e.g., compiler crates seem to have only dylib in Cargo.toml, dylib and rlib in the source code). I'm not sure which one takes precedence, but my build directory seems to contain only dylibs and not rlibs for those crates, so I assume the Cargo.toml wins.

cc @alexcrichton -- is the above correct?

Activity

  1. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.
    on May 2, 2017
  2. daniellockyer commented on May 2, 2017

    @daniellockyer

    If this is correct, I'd like to take this.

  3. alexcrichton commented on May 2, 2017

    @alexcrichton
    Member

    Sounds good to me! I think that because Cargo unconditionally passes --crate-type and --crate-name that all the annotations in the source can just be deleted, they should all already be in as much sync as they need to be.

  4. divagant-martian commented on May 8, 2017

    @divagant-martian

    isn't this issue closed now?

  5. Mark-Simulacrum commented on May 8, 2017

    @Mark-Simulacrum
    Member

    Oh, wait, not the pull request is still open.

  6. added a commit that references this issue on Aug 25, 2017
    83fcd4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions