Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow injecting a profiler runtime into #![no_core] crates #133369

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Zalathar
Copy link
Contributor

An alternative to #133300, allowing -Cinstrument-coverage to be used with -Zbuild-std.

The incompatibility between profiler_builtins and #![no_core] crates appears to have been caused by profiler_builtins depending on core, and therefore conflicting with core (or minicore).

But that's a false dependency, because the profiler doesn't contain any actual Rust code. So we can just mark the profiler itself as #![no_core], and remove the incompatibility error.


For context, the error was originally added by #79958.

@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 23, 2024
@Zalathar
Copy link
Contributor Author

cc @Enselic @jieyouxu

@jieyouxu
Copy link
Member

jieyouxu commented Nov 23, 2024

I can't say I'm too familiar with profiler_builtins injection either, but cutting off the unnecessary dependency to core seems like a less fragile option than only skipping the profiler_builtins injection when building an .rlib.

@Zalathar Zalathar marked this pull request as ready for review November 24, 2024 03:59
@rustbot
Copy link
Collaborator

rustbot commented Nov 24, 2024

These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@Zalathar
Copy link
Contributor Author

r? compiler

It's possible to write a run-make test that actually runs cargo with -Zbuild-std and RUSTFLAGS="-Cinstrument-coverage", but it's a bit fiddly and takes 20+ seconds to run (since it builds its own libraries), so I'm not sure whether it's worth adding.

@jieyouxu
Copy link
Member

r? jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned fmease Nov 24, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this seems reasonable to me, just one nit. You can r=me with the nit.

compiler/rustc_metadata/src/creader.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Nov 24, 2024

@bors rollup=never (profiler runtime setup modifications)

Now that the profiler runtime is itself `#![no_core]`, it can be a dependency
of other no_core crates, including core.
@Zalathar
Copy link
Contributor Author

Addressed review feedback (diff).

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented Nov 24, 2024

📌 Commit 6798eca has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants