Skip to content

Commit f2a5690

Browse files
committed
Auto merge of rust-lang#17553 - Veykril:simplify-profile, r=Veykril
Move remaining codegen things to `xtask codegen`
2 parents 49984c3 + 77bca53 commit f2a5690

File tree

35 files changed

+1235
-1177
lines changed

35 files changed

+1235
-1177
lines changed

src/tools/rust-analyzer/Cargo.lock

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,6 @@ name = "countme"
221221
version = "3.0.1"
222222
source = "registry+https://github.com/rust-lang/crates.io-index"
223223
checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
224-
dependencies = [
225-
"dashmap",
226-
"once_cell",
227-
"rustc-hash",
228-
]
229224

230225
[[package]]
231226
name = "cov-mark"
@@ -548,7 +543,6 @@ dependencies = [
548543
"limit",
549544
"mbe",
550545
"once_cell",
551-
"profile",
552546
"ra-ap-rustc_abi",
553547
"ra-ap-rustc_parse_format",
554548
"rustc-hash",
@@ -1250,7 +1244,6 @@ dependencies = [
12501244
"expect-test",
12511245
"limit",
12521246
"ra-ap-rustc_lexer",
1253-
"sourcegen",
12541247
"stdx",
12551248
"tracing",
12561249
]
@@ -1400,13 +1393,9 @@ name = "profile"
14001393
version = "0.0.0"
14011394
dependencies = [
14021395
"cfg-if",
1403-
"countme",
1404-
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
14051396
"libc",
1406-
"once_cell",
14071397
"perf-event",
14081398
"tikv-jemalloc-ctl",
1409-
"tracing",
14101399
"windows-sys 0.52.0",
14111400
]
14121401

@@ -1681,7 +1670,6 @@ dependencies = [
16811670
"semver",
16821671
"serde",
16831672
"serde_json",
1684-
"sourcegen",
16851673
"stdx",
16861674
"syntax",
16871675
"test-fixture",
@@ -1880,13 +1868,6 @@ version = "1.1.1"
18801868
source = "registry+https://github.com/rust-lang/crates.io-index"
18811869
checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b"
18821870

1883-
[[package]]
1884-
name = "sourcegen"
1885-
version = "0.0.0"
1886-
dependencies = [
1887-
"xshell",
1888-
]
1889-
18901871
[[package]]
18911872
name = "span"
18921873
version = "0.0.0"

src/tools/rust-analyzer/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ ra-ap-rustc_abi = { version = "0.53.0", default-features = false }
9090
ra-ap-rustc_pattern_analysis = { version = "0.53.0", default-features = false }
9191

9292
# local crates that aren't published to crates.io. These should not have versions.
93-
sourcegen = { path = "./crates/sourcegen" }
9493
test-fixture = { path = "./crates/test-fixture" }
9594
test-utils = { path = "./crates/test-utils" }
9695

src/tools/rust-analyzer/crates/hir-def/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ stdx.workspace = true
3737
intern.workspace = true
3838
base-db.workspace = true
3939
syntax.workspace = true
40-
profile.workspace = true
4140
hir-expand.workspace = true
4241
mbe.workspace = true
4342
cfg.workspace = true

src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use hir_expand::{attrs::AttrId, db::ExpandDatabase, name::Name, AstId, MacroCall
88
use itertools::Itertools;
99
use la_arena::Idx;
1010
use once_cell::sync::Lazy;
11-
use profile::Count;
1211
use rustc_hash::{FxHashMap, FxHashSet};
1312
use smallvec::{smallvec, SmallVec};
1413
use stdx::format_to;
@@ -65,8 +64,6 @@ pub struct ImportId {
6564

6665
#[derive(Debug, Default, PartialEq, Eq)]
6766
pub struct ItemScope {
68-
_c: Count<Self>,
69-
7067
/// Defs visible in this scope. This includes `declarations`, but also
7168
/// imports. The imports belong to this module and can be resolved by using them on
7269
/// the `use_imports_*` fields.
@@ -722,7 +719,6 @@ impl ItemScope {
722719
pub(crate) fn shrink_to_fit(&mut self) {
723720
// Exhaustive match to require handling new fields.
724721
let Self {
725-
_c: _,
726722
types,
727723
values,
728724
macros,

src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests/intrinsics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ fn floating_point() {
426426
true,
427427
)),
428428
);
429+
#[allow(unknown_lints, clippy::unnecessary_min_or_max)]
429430
check_number(
430431
r#"
431432
extern "rust-intrinsic" {

src/tools/rust-analyzer/crates/ide-assists/src/tests/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Generated by `sourcegen_assists_docs`, do not edit by hand.
1+
//! Generated by `cargo codegen assists-doc-tests`, do not edit by hand.
22
33
use super::check_doc_test;
44

src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs

Lines changed: 1029 additions & 803 deletions
Large diffs are not rendered by default.

src/tools/rust-analyzer/crates/ide/src/hover/tests.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6138,7 +6138,7 @@ fn hover_feature() {
61386138
by the codegen backend, but not the MIR inliner.
61396139
61406140
```rust
6141-
#![feature(rustc_attrs, effects)]
6141+
#![feature(rustc_attrs)]
61426142
#![allow(internal_features)]
61436143
61446144
#[rustc_intrinsic]
@@ -6148,7 +6148,7 @@ fn hover_feature() {
61486148
Since these are just regular functions, it is perfectly ok to create the intrinsic twice:
61496149
61506150
```rust
6151-
#![feature(rustc_attrs, effects)]
6151+
#![feature(rustc_attrs)]
61526152
#![allow(internal_features)]
61536153
61546154
#[rustc_intrinsic]
@@ -6172,12 +6172,23 @@ fn hover_feature() {
61726172
Various intrinsics have native MIR operations that they correspond to. Instead of requiring
61736173
backends to implement both the intrinsic and the MIR operation, the `lower_intrinsics` pass
61746174
will convert the calls to the MIR operation. Backends do not need to know about these intrinsics
6175-
at all.
6175+
at all. These intrinsics only make sense without a body, and can either be declared as a "rust-intrinsic"
6176+
or as a `#[rustc_intrinsic]`. The body is never used, as calls to the intrinsic do not exist
6177+
anymore after MIR analyses.
61766178
61776179
## Intrinsics without fallback logic
61786180
61796181
These must be implemented by all backends.
61806182
6183+
### `#[rustc_intrinsic]` declarations
6184+
6185+
These are written like intrinsics with fallback bodies, but the body is irrelevant.
6186+
Use `loop {}` for the body or call the intrinsic recursively and add
6187+
`#[rustc_intrinsic_must_be_overridden]` to the function to ensure that backends don't
6188+
invoke the body.
6189+
6190+
### Legacy extern ABI based intrinsics
6191+
61816192
These are imported as if they were FFI functions, with the special
61826193
`rust-intrinsic` ABI. For example, if one was in a freestanding
61836194
context, but wished to be able to `transmute` between types, and

src/tools/rust-analyzer/crates/ide/src/status.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use ide_db::{
2020
};
2121
use itertools::Itertools;
2222
use profile::{memory_usage, Bytes};
23-
use std::env;
2423
use stdx::format_to;
2524
use syntax::{ast, Parse, SyntaxNode};
2625
use triomphe::Arc;
@@ -44,9 +43,6 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
4443
format_to!(buf, "{}\n", collect_query(LibrarySymbolsQuery.in_db(db)));
4544
format_to!(buf, "{}\n", collect_query(ModuleSymbolsQuery.in_db(db)));
4645
format_to!(buf, "{} in total\n", memory_usage());
47-
if env::var("RA_COUNT").is_ok() {
48-
format_to!(buf, "\nCounts:\n{}", profile::countme::get_all());
49-
}
5046

5147
format_to!(buf, "\nDebug info:\n");
5248
format_to!(buf, "{}\n", collect_query(AttrsQuery.in_db(db)));

src/tools/rust-analyzer/crates/parser/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ tracing = { workspace = true, optional = true }
2121
expect-test = "1.4.0"
2222

2323
stdx.workspace = true
24-
sourcegen.workspace = true
2524

2625
[features]
2726
default = ["tracing"]

src/tools/rust-analyzer/crates/parser/src/syntax_kind/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Generated by `sourcegen_ast`, do not edit by hand.
1+
//! Generated by `cargo codegen grammar`, do not edit by hand.
22
33
#![allow(bad_style, missing_docs, unreachable_pub)]
44
#[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`."]

src/tools/rust-analyzer/crates/parser/src/tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mod prefix_entries;
2-
mod sourcegen_inline_tests;
32
mod top_entries;
43

54
use std::{

src/tools/rust-analyzer/crates/profile/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ rust-version.workspace = true
1212
doctest = false
1313

1414
[dependencies]
15-
once_cell = "1.17.0"
16-
tracing.workspace = true
1715
cfg-if = "1.0.0"
18-
la-arena.workspace = true
1916
libc.workspace = true
20-
countme = { version = "3.0.1", features = ["enable"] }
2117
jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = true }
2218

2319
[target.'cfg(target_os = "linux")'.dependencies]

src/tools/rust-analyzer/crates/profile/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ pub use crate::{
1212
stop_watch::{StopWatch, StopWatchSpan},
1313
};
1414

15-
pub use countme;
16-
/// Include `_c: Count<Self>` field in important structs to count them.
17-
///
18-
/// To view the counts, run with `RA_COUNT=1`. The overhead of disabled count is
19-
/// almost zero.
20-
pub use countme::Count;
21-
2215
thread_local!(static IN_SCOPE: RefCell<bool> = const { RefCell::new(false) });
2316

2417
/// A wrapper around google_cpu_profiler.

src/tools/rust-analyzer/crates/profile/src/stop_watch.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ impl StopWatch {
2929
// When debugging rust-analyzer using rr, the perf-related syscalls cause it to abort.
3030
// We allow disabling perf by setting the env var `RA_DISABLE_PERF`.
3131

32-
use once_cell::sync::Lazy;
33-
static PERF_ENABLED: Lazy<bool> =
34-
Lazy::new(|| std::env::var_os("RA_DISABLE_PERF").is_none());
32+
use std::sync::OnceLock;
33+
static PERF_ENABLED: OnceLock<bool> = OnceLock::new();
3534

36-
if *PERF_ENABLED {
35+
if *PERF_ENABLED.get_or_init(|| std::env::var_os("RA_DISABLE_PERF").is_none()) {
3736
let mut counter = perf_event::Builder::new()
3837
.build()
3938
.map_err(|err| eprintln!("Failed to create perf counter: {err}"))

src/tools/rust-analyzer/crates/rust-analyzer/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ xshell.workspace = true
8181

8282
test-utils.workspace = true
8383
test-fixture.workspace = true
84-
sourcegen.workspace = true
8584
mbe.workspace = true
8685

8786
[features]

src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,6 @@ impl flags::AnalysisStats {
250250
}
251251
report_metric("total memory", total_span.memory.allocated.megabytes() as u64, "MB");
252252

253-
if env::var("RA_COUNT").is_ok() {
254-
eprintln!("{}", profile::countme::get_all());
255-
}
256-
257253
if self.source_stats {
258254
let mut total_file_size = Bytes::default();
259255
for e in ide_db::base_db::ParseQuery.in_db(db).entries::<Vec<_>>() {

src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
#![allow(clippy::disallowed_types)]
1212

1313
mod ratoml;
14-
#[cfg(not(feature = "in-rust-tree"))]
15-
mod sourcegen;
1614
mod support;
1715
mod testdir;
18-
mod tidy;
1916

2017
use std::{collections::HashMap, path::PathBuf, time::Instant};
2118

src/tools/rust-analyzer/crates/sourcegen/Cargo.toml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)