Skip to content

Commit

Permalink
Remove profiler_builtins crate
Browse files Browse the repository at this point in the history
  • Loading branch information
bogon-right committed Oct 23, 2022
1 parent e74143e commit 36068ca
Show file tree
Hide file tree
Showing 18 changed files with 16 additions and 154 deletions.
8 changes: 0 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2736,13 +2736,6 @@ dependencies = [
"std",
]

[[package]]
name = "profiler_builtins"
version = "0.0.0"
dependencies = [
"cc",
]

[[package]]
name = "psm"
version = "0.1.16"
Expand Down Expand Up @@ -4682,7 +4675,6 @@ dependencies = [
"object 0.26.2",
"panic_abort",
"panic_unwind",
"profiler_builtins",
"rand 0.7.3",
"rustc-demangle",
"std_detect",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),
gated!(
profiler_runtime, Normal, template!(Word), WarnFollowing,
"the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
"the `#[profiler_runtime]` attribute is used to identify the crate \
which contains the profiler runtime and will never be stable",
),

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ impl<'a> CrateLoader<'a> {
|| !(self.sess.instrument_coverage()
|| self.sess.opts.unstable_opts.profile
|| self.sess.opts.cg.profile_generate.enabled())
|| self.sess.opts.unstable_opts.profiler_runtime == "profiler_builtins"
{
return;
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
"proc_macro",
"panic_abort",
"panic_unwind",
"profiler_builtins",
"rtstartup",
"rustc-std-workspace-core",
"rustc-std-workspace-alloc",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ options! {
no_parallel_llvm: bool = (false, parse_no_flag, [UNTRACKED],
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
"prevent automatic injection of the profiler_builtins crate"),
"prevent automatic injection of the profiler runtime"),
no_unique_section_names: bool = (false, parse_bool, [TRACKED],
"do not use unique names for text and data sections when -Z function-sections is used"),
normalize_docs: bool = (false, parse_bool, [TRACKED],
Expand Down
12 changes: 0 additions & 12 deletions library/profiler_builtins/Cargo.toml

This file was deleted.

89 changes: 0 additions & 89 deletions library/profiler_builtins/build.rs

This file was deleted.

8 changes: 0 additions & 8 deletions library/profiler_builtins/src/lib.rs

This file was deleted.

3 changes: 1 addition & 2 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
libc = { version = "0.2.126", default-features = false, features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.73" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
hashbrown = { version = "0.12", default-features = false, features = ['rustc-dep-of-std'] }
std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = ['rustc-dep-of-std'] }
Expand Down Expand Up @@ -57,7 +56,7 @@ backtrace = [
gimli-symbolize = []

panic-unwind = ["panic_unwind"]
profiler = ["profiler_builtins"]
profiler = []
compiler-builtins-c = ["alloc/compiler-builtins-c"]
compiler-builtins-mem = ["alloc/compiler-builtins-mem"]
compiler-builtins-no-asm = ["alloc/compiler-builtins-no-asm"]
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ impl<'a> ShouldRun<'a> {
/// `all_krates` should probably be removed at some point.
pub fn all_krates(mut self, name: &str) -> Self {
let mut set = BTreeSet::new();
for krate in self.builder.in_tree_crates(name, None) {
for krate in self.builder.in_tree_crates(name) {
let path = krate.local_path(self.builder);
set.insert(TaskPath { path, kind: Some(self.kind) });
}
Expand All @@ -419,7 +419,7 @@ impl<'a> ShouldRun<'a> {
///
/// `make_run` will be called a single time with all matching command-line paths.
pub fn crate_or_deps(self, name: &str) -> Self {
let crates = self.builder.in_tree_crates(name, None);
let crates = self.builder.in_tree_crates(name);
self.crates(crates)
}

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl Step for Std {
// Explicitly pass -p for all dependencies krates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather
// than just the leaf crate.
for krate in builder.in_tree_crates("test", Some(target)) {
for krate in builder.in_tree_crates("test") {
cargo.arg("-p").arg(krate.name);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ impl Step for Rustc {
// Explicitly pass -p for all compiler krates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather
// than just the leaf crate.
for krate in builder.in_tree_crates("rustc-main", Some(target)) {
for krate in builder.in_tree_crates("rustc-main") {
cargo.arg("-p").arg(krate.name);
}

Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car

builder.update_submodule(&Path::new("src").join("llvm-project"));
let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt");
// Note that `libprofiler_builtins/build.rs` also computes this so if
// you're changing something here please also change that.
cargo.env("RUST_COMPILER_RT_ROOT", &compiler_builtins_root);
" compiler-builtins-c"
} else {
Expand Down Expand Up @@ -617,7 +615,7 @@ impl Step for Rustc {
const DEFAULT: bool = false;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let mut crates = run.builder.in_tree_crates("rustc-main", None);
let mut crates = run.builder.in_tree_crates("rustc-main");
for (i, krate) in crates.iter().enumerate() {
if krate.name == "rustc-main" {
crates.swap_remove(i);
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,9 @@ impl Step for Rustc {
paths.into_iter().map(|p| builder.crate_paths[p]).collect()
};
// Find dependencies for top level crates.
let compiler_crates = root_crates.iter().flat_map(|krate| {
builder.in_tree_crates(krate, Some(target)).into_iter().map(|krate| krate.name)
});
let compiler_crates = root_crates
.iter()
.flat_map(|krate| builder.in_tree_crates(krate).into_iter().map(|krate| krate.name));

let mut to_open = None;
for krate in compiler_crates {
Expand Down
6 changes: 1 addition & 5 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ impl Build {
/// Returns a Vec of all the dependencies of the given root crate,
/// including transitive dependencies and the root itself. Only includes
/// "local" crates (those in the local source tree, not from a registry).
fn in_tree_crates(&self, root: &str, target: Option<TargetSelection>) -> Vec<&Crate> {
fn in_tree_crates(&self, root: &str) -> Vec<&Crate> {
let mut ret = Vec::new();
let mut list = vec![INTERNER.intern_str(root)];
let mut visited = HashSet::new();
Expand All @@ -1386,10 +1386,6 @@ impl Build {
// the future, we may want to consider just filtering all
// build and dev dependencies in metadata::build.
if visited.insert(dep)
&& (dep != "profiler_builtins"
|| target
.map(|t| self.config.profiler_enabled(t))
.unwrap_or_else(|| self.config.any_profiler_enabled()))
&& (dep != "rustc_codegen_llvm" || self.config.llvm_enabled())
{
list.push(*dep);
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions src/test/rustdoc-ui/z-help.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
-Z no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests
-Z no-link=val -- compile without linking
-Z no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)
-Z no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate
-Z no-profiler-runtime=val -- prevent automatic injection of the profiler runtime
-Z no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used
-Z normalize-docs=val -- normalize associated items in rustdoc when generating documentation
-Z oom=val -- panic strategy for out-of-memory handling
Expand Down Expand Up @@ -123,7 +123,7 @@
-Z profile-closures=val -- profile size of closures
-Z profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path)
-Z profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)
-Z profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)
-Z profiler-runtime=val -- name of the profiler runtime crate to automatically inject
-Z query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no)
-Z randomize-layout=val -- randomize the layout of types (default: no)
-Z relax-elf-relocations=val -- whether ELF relocations can be relaxed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate which contains the profiler runtime and will never be stable
error[E0658]: the `#[profiler_runtime]` attribute is used to identify the crate which contains the profiler runtime and will never be stable
--> $DIR/feature-gate-profiler-runtime.rs:1:1
|
LL | #![profiler_runtime]
Expand Down
9 changes: 0 additions & 9 deletions src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3722,15 +3722,6 @@ This feature is internal to the Rust compiler and is not intended for general us
The tracking issue for this feature is: [#42524](https://github.com/rust-lang/rust/issues/42524).
------------------------
"##,
},
Lint {
label: "profiler_runtime_lib",
description: r##"# `profiler_runtime_lib`
This feature is internal to the Rust compiler and is not intended for general use.
------------------------
"##,
},
Expand Down

0 comments on commit 36068ca

Please sign in to comment.