Skip to content

Commit

Permalink
Remove depdencies of profiler_builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
Donough Liu authored and bogon-right committed Sep 4, 2022
1 parent a2cdcb3 commit 2ae928b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2723,8 +2723,6 @@ name = "profiler_builtins"
version = "0.0.0"
dependencies = [
"cc",
"compiler_builtins",
"core",
]

[[package]]
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::errors::{
ConflictingGlobalAlloc, CrateNotPanicRuntime, GlobalAllocRequired, NoMultipleGlobalAlloc,
NoPanicStrategy, NoTransitiveNeedsDep, NotProfilerRuntime, ProfilerBuiltinsNeedsCore,
NoPanicStrategy, NoTransitiveNeedsDep, NotProfilerRuntime,
};
use crate::locator::{CrateError, CrateLocator, CratePaths};
use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob};
Expand Down Expand Up @@ -759,7 +759,7 @@ impl<'a> CrateLoader<'a> {
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) {
if self.sess.opts.unstable_opts.no_profiler_runtime
|| !(self.sess.instrument_coverage()
|| self.sess.opts.unstable_opts.profile
Expand All @@ -771,9 +771,6 @@ impl<'a> CrateLoader<'a> {
info!("loading profiler");

let name = Symbol::intern(&self.sess.opts.unstable_opts.profiler_runtime);
if name == sym::profiler_builtins && self.sess.contains_name(&krate.attrs, sym::no_core) {
self.sess.emit_err(ProfilerBuiltinsNeedsCore);
}

let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { return; };
let data = self.cstore.get_crate_data(cnum);
Expand Down Expand Up @@ -927,7 +924,7 @@ impl<'a> CrateLoader<'a> {
}

pub fn postprocess(&mut self, krate: &ast::Crate) {
self.inject_profiler_runtime(krate);
self.inject_profiler_runtime();
self.inject_allocator_crate(krate);
self.inject_panic_runtime(krate);

Expand Down
4 changes: 0 additions & 4 deletions library/profiler_builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@ test = false
bench = false
doc = false

[dependencies]
core = { path = "../core" }
compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] }

[build-dependencies]
cc = "1.0.69"
6 changes: 2 additions & 4 deletions library/profiler_builtins/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#![no_std]
#![feature(profiler_runtime)]
#![feature(no_core, profiler_runtime, staged_api)]
#![no_core]
#![profiler_runtime]
#![unstable(
feature = "profiler_runtime_lib",
reason = "internal implementation detail of rustc right now",
issue = "none"
)]
#![allow(unused_features)]
#![feature(staged_api)]

0 comments on commit 2ae928b

Please sign in to comment.