Skip to content

Commit bb71c99

Browse files
ZalatharKobzol
authored andcommitted
Describe how to use rust-analyzer with rmake.rs (#2191)
1 parent 027bbb3 commit bb71c99

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/tests/compiletest.md

+40
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,46 @@ $ COMPILETEST_FORCE_STAGE0=1 x test --stage 0 tests/run-make/<test-name>
441441

442442
Of course, some tests will not successfully *run* in this way.
443443

444+
#### Using rust-analyzer with `rmake.rs`
445+
446+
Like other test programs, the `rmake.rs` scripts used by run-make tests do not
447+
have rust-analyzer integration by default.
448+
449+
To work around this when working on a particular test, temporarily create a
450+
`Cargo.toml` file in the test's directory
451+
(e.g. `tests/run-make/sysroot-crates-are-unstable/Cargo.toml`)
452+
with these contents:
453+
454+
<div class="warning">
455+
Be careful not to add this `Cargo.toml` or its `Cargo.lock` to your actual PR!
456+
</div>
457+
458+
```toml
459+
# Convince cargo that this isn't part of an enclosing workspace.
460+
[workspace]
461+
462+
[package]
463+
name = "rmake"
464+
version = "0.1.0"
465+
edition = "2021"
466+
467+
[dependencies]
468+
run_make_support = { path = "../../../src/tools/run-make-support" }
469+
470+
[[bin]]
471+
name = "rmake"
472+
path = "rmake.rs"
473+
```
474+
475+
Then add a corresponding entry to `"rust-analyzer.linkedProjects"`
476+
(e.g. in `.vscode/settings.json`):
477+
478+
```json
479+
"rust-analyzer.linkedProjects": [
480+
"tests/run-make/sysroot-crates-are-unstable/Cargo.toml"
481+
],
482+
```
483+
444484
#### Using Makefiles (legacy)
445485

446486
<div class="warning">

0 commit comments

Comments
 (0)