mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-29 08:54:50 +00:00
Allow injecting a profiler runtime into #![no_core]
crates
Now that the profiler runtime is itself `#![no_core]`, it can be a dependency of other no_core crates, including core.
This commit is contained in:
parent
bba3567386
commit
972663d8ec
@ -233,9 +233,6 @@ metadata_prev_alloc_error_handler =
|
||||
metadata_prev_global_alloc =
|
||||
previous global allocator defined here
|
||||
|
||||
metadata_profiler_builtins_needs_core =
|
||||
`profiler_builtins` crate (required by compiler options) is not compatible with crate attribute `#![no_core]`
|
||||
|
||||
metadata_raw_dylib_no_nul =
|
||||
link name must not contain NUL characters if link kind is `raw-dylib`
|
||||
|
||||
|
@ -799,7 +799,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
||||
self.inject_dependency_if(cnum, "a panic runtime", &|data| data.needs_panic_runtime());
|
||||
}
|
||||
|
||||
fn inject_profiler_runtime(&mut self, krate: &ast::Crate) {
|
||||
fn inject_profiler_runtime(&mut self) {
|
||||
let needs_profiler_runtime =
|
||||
self.sess.instrument_coverage() || self.sess.opts.cg.profile_generate.enabled();
|
||||
if !needs_profiler_runtime || self.sess.opts.unstable_opts.no_profiler_runtime {
|
||||
@ -809,10 +809,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
||||
info!("loading profiler");
|
||||
|
||||
let name = Symbol::intern(&self.sess.opts.unstable_opts.profiler_runtime);
|
||||
if name == sym::profiler_builtins && attr::contains_name(&krate.attrs, sym::no_core) {
|
||||
self.dcx().emit_err(errors::ProfilerBuiltinsNeedsCore);
|
||||
}
|
||||
|
||||
let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else {
|
||||
return;
|
||||
};
|
||||
@ -1046,7 +1042,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
||||
|
||||
pub fn postprocess(&mut self, krate: &ast::Crate) {
|
||||
self.inject_forced_externs();
|
||||
self.inject_profiler_runtime(krate);
|
||||
self.inject_profiler_runtime();
|
||||
self.inject_allocator_crate(krate);
|
||||
self.inject_panic_runtime(krate);
|
||||
|
||||
|
@ -339,10 +339,6 @@ pub struct NoPanicStrategy {
|
||||
pub strategy: PanicStrategy,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_profiler_builtins_needs_core)]
|
||||
pub struct ProfilerBuiltinsNeedsCore;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(metadata_not_profiler_runtime)]
|
||||
pub struct NotProfilerRuntime {
|
||||
|
Loading…
Reference in New Issue
Block a user