Skip to content

Changing build.profiler forces an unnecessary rebuild of std #131812

Closed

Description

@Zalathar

In theory, opening config.toml and toggling build.profiler between false and true should be cheap. Setting it to true should cause the profiler runtime to be built, without rebuilding std. And setting it to false should simply cause the rest of the build to pretend that any previously-built compiler runtime doesn't exist.

In practice, toggling build.profiler does trigger a rebuild of std, which also naturally triggers a rebuild of the compiler.

I think this is an artifact of library/profiler_runtime being considered an optional dependency of std. And I think that is just an artifact of how the profiler runtime was originally added (#42433), not something that inherently has to be true.

Of course, the tricky part will be fixing this without accidentally breaking anything.

Activity

  1. added
    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    on Oct 17, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 17, 2024
  3. added
    E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.
    E-needs-investigationCall for participation: This issues needs some investigation to determine current status
    E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.
    on Oct 17, 2024
  4. Zalathar commented on Oct 17, 2024

    @Zalathar
    MemberAuthor

    I think bootstrap itself is behaving correctly here, in that if the profiler runtime really were a dependency of std, then enabling it should trigger a std rebuild.

    So it's more of a questionable configuration, in that it really shouldn't be a dependency.

    Also, toggling the profiler off/on is presumably not very common, especially now that the profiler can be built without the src/llvm-project submodule (#129295). So this should be a pretty low priority relative to its difficulty.

  5. onur-ozkan commented on Oct 17, 2024

    @onur-ozkan
    Contributor

    Additional note: "profiler" feature can still be enabled on std through this option:

    #std-features = ["panic_unwind"]
    even if we remove it from the build.profiler logic.

  6. added
    C-discussionCategory: Discussion or questions that doesn't represent real issues.
    and removed
    E-needs-investigationCall for participation: This issues needs some investigation to determine current status
    E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.
    on Oct 17, 2024
  7. Zalathar commented on Oct 17, 2024

    @Zalathar
    MemberAuthor

    I looked into this briefly, and the fix turns out to have been simpler than I was expecting (fingers crossed), so I've filed #131816.

  8. added 2 commits that reference this issue on Oct 17, 2024
    e9f26d2
    c926476
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

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-discussionCategory: Discussion or questions that doesn't represent real issues.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions