Skip to content

no_std crates should not permit non-no_std dependencies #8798

@zesterer

Description

@zesterer

I couldn't find this exact problem mentioned elsewhere.

Problem

Cargo rightly produces errors for uses of std within a crate but will not complain about dependencies that rely on std when building for platforms that support std. This means that an implicit std requirement can quietly sneak into a project. It seems rather bizarre that cargo does not catch this issue.

Possible Solution(s)

  • Make cargo search for uses of std when building dependencies and produce an error
  • Do not permit std as a dependency in the dependency graph for no_std crates
  • Only permit dependencies that are explicitly tagged with #![no_std] for no_std crates

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-new-lintArea: new lintC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions