Skip to content

run-make-support: add #[must_use] to helpers where suitable #125703

Closed

Description

@jieyouxu

For command wrappers like Rustc, they often have intermediate helper methods and actual "terminal" functions that executes the built command (e.g. run, run_fail, run_fail_assert_exit_code). Currently, it is easy to forget to call "terminal" functions.

For example,

rustc().input("foo.rs").arg("-Cprefer-dynamic");

does not actually execute and can unexpectedly silently pass. We should annotate intermediate helper methods with #[must_use] to ensure the built command is consumed, i.e. by executing the command.

Activity

  1. added
    A-testsuiteArea: The testsuite used to check the correctness of rustc
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on May 29, 2024
  2. self-assigned this
    on May 29, 2024
  3. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on May 29, 2024
  4. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on May 29, 2024
  5. jieyouxu commented on May 29, 2024

    @jieyouxu
    MemberAuthor

    Maybe even consider drop bombs for command wrappers?

  6. added a commit that references this issue on May 31, 2024
  7. added 3 commits that reference this issue on May 31, 2024
  8. jieyouxu commented on Jul 18, 2024

    @jieyouxu
    MemberAuthor

    Closing as mostly addressed in #125752.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-run-makeArea: port run-make Makefiles to rmake.rsA-testsuiteArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions