Skip to content

Commit 81c9e13

Browse files
committed
dev configs
1 parent c268b39 commit 81c9e13

File tree

8 files changed

+165
-8
lines changed

8 files changed

+165
-8
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix

.gitignore

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ Session.vim
1717
.cproject
1818
.idea
1919
*.iml
20-
.vscode
2120
.project
2221
.vim/
23-
.helix/
24-
.zed/
2522
.favorites.json
2623
.settings/
2724
.vs/
@@ -34,8 +31,6 @@ Session.vim
3431
!/tests/run-make/thumb-none-qemu/example/.cargo
3532

3633
## Configuration
37-
/bootstrap.toml
38-
/config.toml
3934
/Makefile
4035
config.mk
4136
config.stamp
@@ -48,7 +43,8 @@ no_llvm_build
4843
/llvm/
4944
/mingw-build/
5045
/build
51-
/build-rust-analyzer
46+
/build-rust-analyzer/*
47+
!/build-rust-analyzer/cache
5248
/dist/
5349
/unicode-downloads
5450
/target
@@ -95,12 +91,10 @@ tests/rustdoc-gui/src/**.lock
9591
test-dashboard/
9692

9793
## direnv
98-
/.envrc
9994
/.direnv/
10095

10196
## nix
10297
/flake.nix
10398
flake.lock
104-
/default.nix
10599

106100
# Before adding new lines, see the comment at the top.

.helix/languages.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This config uses a separate build directory for rust-analyzer,
2+
# so that r-a's checks don't block user `x` commands and vice-verse.
3+
# R-a's build directory is located in `build/rust-analyzer`.
4+
#
5+
# To build rustfmt and proc macro server for r-a run the following command:
6+
# ```
7+
# x b proc-macro-srv-cli rustfmt --stage 0 --build-dir build/rust-analyzer
8+
# ```
9+
10+
[language-server.rust-analyzer.config]
11+
linkedProjects = [
12+
"Cargo.toml",
13+
# "compiler/rustc_codegen_cranelift/Cargo.toml",
14+
# "compiler/rustc_codegen_gcc/Cargo.toml",
15+
# "library/Cargo.toml",
16+
# "src/bootstrap/Cargo.toml",
17+
# "src/tools/rust-analyzer/Cargo.toml",
18+
]
19+
20+
[language-server.rust-analyzer.config.check]
21+
invocationLocation = "root"
22+
invocationStrategy = "once"
23+
overrideCommand = [
24+
"./check.sh",
25+
"--json-output",
26+
]
27+
28+
[language-server.rust-analyzer.config.rustfmt]
29+
overrideCommand = [
30+
"build-rust-analyzer/host/rustfmt/bin/rustfmt",
31+
"--edition=2024"
32+
]
33+
34+
[language-server.rust-analyzer.config.procMacro]
35+
server = "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
36+
enable = true
37+
38+
[language-server.rust-analyzer.config.rustc]
39+
source = "./Cargo.toml"
40+
41+
[language-server.rust-analyzer.config.cargo]
42+
sysrootSrc = "./library"
43+
44+
[language-server.rust-analyzer.config.cargo.extraEnv]
45+
RUSTC_BOOTSTRAP = "1"
46+
47+
[language-server.rust-analyzer.config.cargo.buildScripts]
48+
enable = true
49+
invocationLocation = "root"
50+
invocationStrategy = "once"
51+
overrideCommand = [
52+
"./check.sh",
53+
"--json-output",
54+
]

.vscode/settings.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"git.detectSubmodulesLimit": 20,
3+
"rust-analyzer.check.invocationStrategy": "once",
4+
"rust-analyzer.check.overrideCommand": [
5+
"./check.sh",
6+
"--json-output"
7+
],
8+
"rust-analyzer.linkedProjects": [
9+
"Cargo.toml",
10+
// "compiler/rustc_codegen_cranelift/Cargo.toml",
11+
// "compiler/rustc_codegen_gcc/Cargo.toml",
12+
// "library/Cargo.toml",
13+
// "src/bootstrap/Cargo.toml",
14+
// "src/tools/rust-analyzer/Cargo.toml"
15+
],
16+
"rust-analyzer.rustfmt.overrideCommand": [
17+
"${workspaceFolder}/build/host/rustfmt/bin/rustfmt",
18+
"--edition=2024"
19+
],
20+
"rust-analyzer.procMacro.server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv",
21+
"rust-analyzer.procMacro.enable": true,
22+
"rust-analyzer.cargo.buildScripts.enable": true,
23+
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
24+
"rust-analyzer.cargo.buildScripts.overrideCommand": [
25+
"./check.sh",
26+
"--json-output"
27+
],
28+
"rust-analyzer.cargo.sysrootSrc": "./library",
29+
"rust-analyzer.rustc.source": "./Cargo.toml",
30+
"rust-analyzer.cargo.extraEnv": {
31+
"RUSTC_BOOTSTRAP": "1"
32+
},
33+
"rust-analyzer.server.extraEnv": {
34+
"RUSTUP_TOOLCHAIN": "nightly"
35+
},
36+
"files.associations": {
37+
"*.fixed": "rust",
38+
"*.pp": "rust",
39+
"*.mir": "rust"
40+
}
41+
}

build-rust-analyzer/cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../build/cache/

check.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
: "${DIR:="build-rust-analyzer"}"
4+
exec ./x check --build-dir "${DIR}" "$@"

config.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Includes one of the default files in src/bootstrap/defaults
2+
profile = "compiler"
3+
change-id = 148795
4+
5+
[llvm]
6+
download-ci-llvm = true
7+
assertions = true
8+
9+
[build]
10+
submodules = false
11+
# optimized-compiler-builtins = true
12+
low-priority = true
13+
14+
[rust]
15+
download-rustc = false
16+
debug-assertions = true
17+
18+
debug = true
19+
# verify-llvm-ir = true
20+
# codegen-backends = ["llvm", "cranelift", "gcc"]
21+
22+
# debuginfo-level = 2
23+
24+
# codegen-units = 2
25+
incremental = true
26+
# frame-pointers = true
27+
28+
optimize-tests = false
29+
verbose-tests = false
30+
31+
deny-warnings = false
32+
33+
backtrace-on-ice = true
34+
break-on-ice = true
35+
36+
parallel-frontend-threads = 0

shell.nix

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
pkgs ? import <nixpkgs> { },
3+
}:
4+
let
5+
inherit (pkgs) lib stdenv;
6+
in
7+
pkgs.mkShell {
8+
preferLocalBuild = true;
9+
allowSubstitutes = false;
10+
11+
inherit stdenv;
12+
13+
name = "rustc-dev";
14+
15+
packages = [
16+
stdenv.cc.libc.out
17+
stdenv.cc.libc.static
18+
];
19+
20+
env = {
21+
RUSTC_ICE = 0;
22+
LD_LIBRARY_PATH = lib.makeLibraryPath [
23+
stdenv.cc.cc.lib
24+
];
25+
};
26+
}

0 commit comments

Comments
 (0)