Skip to content

Commit 8ed8ac5

Browse files
committed
dev configs
1 parent 2cb4e7d commit 8ed8ac5

File tree

10 files changed

+231
-8
lines changed

10 files changed

+231
-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: 3 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,9 @@ no_llvm_build
4843
/llvm/
4944
/mingw-build/
5045
/build
51-
/build-rust-analyzer/
46+
/build-rust-analyzer/*
47+
!/build-rust-analyzer/bootstrap
48+
!/build-rust-analyzer/cache
5249
/dist/
5350
/unicode-downloads
5451
/target
@@ -91,12 +88,10 @@ node_modules
9188
tests/rustdoc-gui/src/**.lock
9289

9390
## direnv
94-
/.envrc
9591
/.direnv/
9692

9793
## nix
9894
/flake.nix
9995
flake.lock
100-
/default.nix
10196

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

.helix/languages.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
"--build-dir",
27+
"build-rust-analyzer",
28+
]
29+
30+
[language-server.rust-analyzer.config.rustfmt]
31+
overrideCommand = [
32+
"build-rust-analyzer/host/rustfmt/bin/rustfmt",
33+
"--edition=2024"
34+
]
35+
36+
[language-server.rust-analyzer.config.procMacro]
37+
server = "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
38+
enable = true
39+
40+
[language-server.rust-analyzer.config.rustc]
41+
source = "./Cargo.toml"
42+
43+
[language-server.rust-analyzer.config.cargo]
44+
sysrootSrc = "./library"
45+
46+
[language-server.rust-analyzer.config.cargo.extraEnv]
47+
RUSTC_BOOTSTRAP = "1"
48+
49+
[language-server.rust-analyzer.config.cargo.buildScripts]
50+
enable = true
51+
invocationLocation = "root"
52+
invocationStrategy = "once"
53+
overrideCommand = [
54+
"./check.sh",
55+
"--json-output",
56+
"--build-dir",
57+
"build-rust-analyzer",
58+
"--compile-time-deps"
59+
]

.vscode/settings.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
"--compile-time-deps"
28+
],
29+
"rust-analyzer.cargo.sysrootSrc": "./library",
30+
"rust-analyzer.rustc.source": "./Cargo.toml",
31+
"rust-analyzer.cargo.extraEnv": {
32+
"RUSTC_BOOTSTRAP": "1"
33+
},
34+
"rust-analyzer.server.extraEnv": {
35+
"RUSTUP_TOOLCHAIN": "nightly"
36+
},
37+
"files.associations": {
38+
"*.fixed": "rust",
39+
"*.pp": "rust",
40+
"*.mir": "rust"
41+
}
42+
}

.zed/settings.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"lsp": {
3+
"rust-analyzer": {
4+
"initialization_options": {
5+
"cargo": {
6+
"buildScripts": {
7+
"enable": true,
8+
"invocationLocation": "root",
9+
"invocationStrategy": "once",
10+
"overrideCommand": [
11+
"./check.sh",
12+
"--json-output",
13+
// "--compile-time-deps"
14+
]
15+
},
16+
"extraEnv": {
17+
"RUSTC_BOOTSTRAP": "1"
18+
},
19+
"sysrootSrc": "./library"
20+
},
21+
"check": {
22+
"invocationLocation": "root",
23+
"invocationStrategy": "once",
24+
"overrideCommand": [
25+
"./check.sh",
26+
"--json-output"
27+
]
28+
},
29+
"linkedProjects": [
30+
"Cargo.toml",
31+
"compiler/rustc_codegen_cranelift/Cargo.toml",
32+
"compiler/rustc_codegen_gcc/Cargo.toml",
33+
"library/Cargo.toml",
34+
"src/bootstrap/Cargo.toml",
35+
"src/tools/rust-analyzer/Cargo.toml"
36+
],
37+
"procMacro": {
38+
"enable": true,
39+
"server": "build/host/stage0/libexec/rust-analyzer-proc-macro-srv"
40+
},
41+
"rustc": {
42+
"source": "./Cargo.toml"
43+
},
44+
"rustfmt": {
45+
"overrideCommand": [
46+
"build/host/rustfmt/bin/rustfmt",
47+
"--edition=2024"
48+
]
49+
},
50+
"server": {
51+
"extraEnv": {
52+
"RUSTUP_TOOLCHAIN": "nightly"
53+
}
54+
}
55+
}
56+
}
57+
},
58+
"file_types": {
59+
"Rust": [
60+
"fixed",
61+
"pp",
62+
"mir"
63+
]
64+
}
65+
}

build-rust-analyzer/bootstrap

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

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
exec ./x check "$@"

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 = 146929
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
pkgs ? import <nixpkgs> { },
3+
}:
4+
let
5+
inherit (pkgs) lib stdenv;
6+
in
7+
pkgs.mkShellNoCC {
8+
inherit stdenv;
9+
name = "rustc-dev";
10+
11+
packages = [
12+
stdenv.cc
13+
];
14+
15+
env = {
16+
LD_LIBRARY_PATH = lib.makeLibraryPath [
17+
stdenv.cc.cc.lib
18+
];
19+
};
20+
}

0 commit comments

Comments
 (0)