Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b0b374d

Browse files
committed
Auto merge of rust-lang#136779 - jieyouxu:rahhh, r=<try>
[DO NOT MERGE] `./x test rust-analyzer` I somehow made `./x test rust-analyzer` work on my machine[^machine], **but at what cost?** Not intended for merge but only as a reference. If we do want to land this, I'll need to tidy this up. Notes: - I abused a bunch of cargo features `in-rust-tree`. It probably doesn't need to be, and simply `--cfg` might work. I was trying to get the main rust-analyzer tests to build *at all*. Anything building is already a miracle. - I had to slap a bunch of the following to all the r-a crates to get the tests to build at all. I don't 100% understand why, but otherwise I get a whole ton of ``expected `rustc_lexer` to be available in rlib format`` build failures. ```rs #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))] #[cfg(all(feature = "in-rust-tree", test))] extern crate rustc_driver as _; ``` - Skipped one config test that was fixed on r-a master but not synced here in r-l/r yet. [^machine]: `x86_64-unknown-linux-gnu`, haven't bothered trying this on msvc yet. try-job: aarch64-gnu try-job: x86_64-apple-1 try-job: aarch64-apple try-job: i686-mingw-1 try-job: x86_64-mingw-1 try-job: i686-msvc-1 try-job: x86_64-msvc-1
2 parents 8c07d14 + 349c449 commit b0b374d

File tree

39 files changed

+690
-155
lines changed

39 files changed

+690
-155
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 188 additions & 121 deletions
Large diffs are not rendered by default.

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 360 additions & 20 deletions
Large diffs are not rendered by default.

src/bootstrap/src/core/builder/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::core::config::{DryRun, TargetSelection};
2121
use crate::utils::cache::Cache;
2222
use crate::utils::exec::{BootstrapCommand, command};
2323
use crate::utils::helpers::{self, LldThreads, add_dylib_path, exe, libdir, linker_args, t};
24-
use crate::{Build, Crate};
24+
use crate::{Build, Crate, trace};
2525

2626
mod cargo;
2727

@@ -971,6 +971,7 @@ impl<'a> Builder<'a> {
971971
test::Cargotest,
972972
test::Cargo,
973973
test::RustAnalyzer,
974+
test::RustAnalyzerProcMacroSrv,
974975
test::ErrorIndex,
975976
test::Distcheck,
976977
test::Nomicon,
@@ -1215,7 +1216,7 @@ impl<'a> Builder<'a> {
12151216
/// `Compiler` since all `Compiler` instances are meant to be obtained through this function,
12161217
/// since it ensures that they are valid (i.e., built and assembled).
12171218
pub fn compiler(&self, stage: u32, host: TargetSelection) -> Compiler {
1218-
self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } })
1219+
self.ensure(compile::Assemble { output_compiler: Compiler { stage, host } })
12191220
}
12201221

12211222
/// Similar to `compiler`, except handles the full-bootstrap option to
@@ -1331,6 +1332,8 @@ impl<'a> Builder<'a> {
13311332
return;
13321333
}
13331334

1335+
trace!(rustc_lib_paths = ?self.rustc_lib_paths(compiler));
1336+
13341337
add_dylib_path(self.rustc_lib_paths(compiler), cmd);
13351338
}
13361339

src/bootstrap/src/core/builder/tests.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ mod defaults {
352352
assert_eq!(
353353
first(cache.all::<compile::Assemble>()),
354354
&[
355-
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
356-
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
357-
compile::Assemble { target_compiler: Compiler { host: b, stage: 1 } },
355+
compile::Assemble { output_compiler: Compiler { host: a, stage: 0 } },
356+
compile::Assemble { output_compiler: Compiler { host: a, stage: 1 } },
357+
compile::Assemble { output_compiler: Compiler { host: b, stage: 1 } },
358358
]
359359
);
360360
assert_eq!(
@@ -632,10 +632,10 @@ mod dist {
632632
assert_eq!(
633633
first(cache.all::<compile::Assemble>()),
634634
&[
635-
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
636-
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
637-
compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
638-
compile::Assemble { target_compiler: Compiler { host: b, stage: 2 } },
635+
compile::Assemble { output_compiler: Compiler { host: a, stage: 0 } },
636+
compile::Assemble { output_compiler: Compiler { host: a, stage: 1 } },
637+
compile::Assemble { output_compiler: Compiler { host: a, stage: 2 } },
638+
compile::Assemble { output_compiler: Compiler { host: b, stage: 2 } },
639639
]
640640
);
641641
}
@@ -713,9 +713,9 @@ mod dist {
713713
assert_eq!(
714714
first(builder.cache.all::<compile::Assemble>()),
715715
&[
716-
compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
717-
compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
718-
compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
716+
compile::Assemble { output_compiler: Compiler { host: a, stage: 0 } },
717+
compile::Assemble { output_compiler: Compiler { host: a, stage: 1 } },
718+
compile::Assemble { output_compiler: Compiler { host: a, stage: 2 } },
719719
]
720720
);
721721
assert_eq!(

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@ vfs.workspace = true
3030
span.workspace = true
3131
intern.workspace = true
3232

33+
[features]
34+
in-rust-tree = []
35+
3336
[lints]
3437
workspace = true

src/tools/rust-analyzer/crates/base-db/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
//! base_db defines basic database traits. The concrete DB is defined by ide.
2+
3+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
4+
#[cfg(all(feature = "in-rust-tree", test))]
5+
extern crate rustc_driver as _;
6+
27
// FIXME: Rename this crate, base db is non descriptive
38
mod change;
49
mod input;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@ derive_arbitrary = "1.3.2"
3333
syntax-bridge.workspace = true
3434
syntax.workspace = true
3535

36+
[features]
37+
default = []
38+
in-rust-tree = []
39+
3640
[lints]
3741
workspace = true

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//! cfg defines conditional compiling options, `cfg` attribute parser and evaluator
22
3+
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
4+
#[cfg(all(feature = "in-rust-tree", test))]
5+
extern crate rustc_driver as _;
6+
37
mod cfg_expr;
48
mod dnf;
59
#[cfg(test)]

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ expect-test.workspace = true
5454
test-utils.workspace = true
5555
test-fixture.workspace = true
5656
syntax-bridge.workspace = true
57+
5758
[features]
5859
in-rust-tree = ["hir-expand/in-rust-tree"]
5960

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
//! actually true.
99
1010
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
11+
#[cfg(all(feature = "in-rust-tree", test))]
12+
extern crate rustc_driver as _;
1113

1214
#[cfg(feature = "in-rust-tree")]
1315
extern crate rustc_parse_format;

0 commit comments

Comments
 (0)