From 2ae928bafa9493833a8f28ccf9eb0cd468f75e34 Mon Sep 17 00:00:00 2001 From: Donough Liu Date: Thu, 25 Aug 2022 19:43:48 +0100 Subject: [PATCH] Remove depdencies of `profiler_builtins` --- Cargo.lock | 2 -- compiler/rustc_metadata/src/creader.rs | 9 +++------ library/profiler_builtins/Cargo.toml | 4 ---- library/profiler_builtins/src/lib.rs | 6 ++---- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f1f16cbce216..4d4ce1ae06704 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2723,8 +2723,6 @@ name = "profiler_builtins" version = "0.0.0" dependencies = [ "cc", - "compiler_builtins", - "core", ] [[package]] diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index cfcceecbef40e..9e2f86d25980b 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -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}; @@ -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 @@ -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); @@ -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); diff --git a/library/profiler_builtins/Cargo.toml b/library/profiler_builtins/Cargo.toml index 3371dfa124253..a396b9c988e64 100644 --- a/library/profiler_builtins/Cargo.toml +++ b/library/profiler_builtins/Cargo.toml @@ -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" diff --git a/library/profiler_builtins/src/lib.rs b/library/profiler_builtins/src/lib.rs index 0c83bcee06ff4..3f5c17fb76db9 100644 --- a/library/profiler_builtins/src/lib.rs +++ b/library/profiler_builtins/src/lib.rs @@ -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)]