From b4791992a3f7f5331105761843c3a91e43241e0c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 6 Feb 2025 09:15:14 +0100 Subject: Run CI multiple times a day --- src/doc/rustc-dev-guide/.github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml index 3f810e2fbcc..7c414ce2641 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml @@ -6,8 +6,8 @@ on: - master pull_request: schedule: - # Run at 18:00 UTC every day - - cron: '0 18 * * *' + # Run multiple times a day as the successfull cached links are not checked every time. + - cron: '0 */3 * * *' jobs: ci: -- cgit 1.4.1-3-g733a5 From 28dfcd059819d542820095115cc8925534e81e85 Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 12 Feb 2025 21:03:34 -0500 Subject: document bootstrap logging --- .../building/bootstrapping/debugging-bootstrap.md | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md b/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md index 3f907e85dd6..75d789569de 100644 --- a/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md +++ b/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md @@ -1,7 +1,46 @@ # Debugging bootstrap +There are two main ways to debug bootstrap itself. The first is through println logging, and the second is through the `tracing` feature. + > FIXME: this section should be expanded +## `println` logging + +Bootstrap has extensive unstructured logging. Most of it is gated behind the `--verbose` flag (pass `-vv` for even more detail). + +If you want to know which `Step` ran a command, you could invoke bootstrap like so: + +``` +$ ./x dist rustc --dry-run -vv +learning about cargo +running: RUSTC_BOOTSTRAP="1" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "metadata" "--format-version" "1" "--no-deps" "--manifest-path" "/home/jyn/src/rust2/Cargo.toml" (failure_mode=Exit) (created at src/bootstrap/src/core/metadata.rs:81:25, executed at src/bootstrap/src/core/metadata.rs:92:50) +running: RUSTC_BOOTSTRAP="1" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "metadata" "--format-version" "1" "--no-deps" "--manifest-path" "/home/jyn/src/rust2/library/Cargo.toml" (failure_mode=Exit) (created at src/bootstrap/src/core/metadata.rs:81:25, executed at src/bootstrap/src/core/metadata.rs:92:50) +> Assemble { target_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } } + > Libdir { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu } + > Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, force_recompile: false } +Removing sysroot /home/jyn/src/rust2/build/tmp-dry-run/x86_64-unknown-linux-gnu/stage1 to avoid caching bugs + < Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, force_recompile: false } + < Libdir { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu } +... +``` + +This will go through all the recursive dependency calculations, where `Step`s internally call `builder.ensure()`, without actually running cargo or the compiler. + +In some cases, even this may not be enough logging (if so, please add more!). In that case, you can omit `--dry-run`, which will show the normal output inline with the debug logging: + +``` + c Sysroot { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu }, force_recompile: false } +using sysroot /home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage0-sysroot +Building stage0 library artifacts (x86_64-unknown-linux-gnu) +running: cd "/home/jyn/src/rust2" && env ... RUSTC_VERBOSE="2" RUSTC_WRAPPER="/home/jyn/src/rust2/build/bootstrap/debug/rustc" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-Zroot-dir=/home/jyn/src/rust2" "-v" "-v" "--manifest-path" "/home/jyn/src/rust2/library/sysroot/Cargo.toml" "--message-format" "json-render-diagnostics" + 0.293440230s INFO prepare_target{force=false package_id=sysroot v0.0.0 (/home/jyn/src/rust2/library/sysroot) target="sysroot"}: cargo::core::compiler::fingerprint: fingerprint error for sysroot v0.0.0 (/home/jyn/src/rust2/library/sysroot)/Build/TargetInner { name_inferred: true, ..: lib_target("sysroot", ["lib"], "/home/jyn/src/rust2/library/sysroot/src/lib.rs", Edition2021) } +... +``` + +In most cases this should not be necessary. + +TODO: we should convert all this to structured logging so it's easier to control precisely. + ## `tracing` in bootstrap Bootstrap has conditional [`tracing`][tracing] setup to provide structured logging. @@ -53,11 +92,11 @@ Checking stage0 bootstrap artifacts (x86_64-unknown-linux-gnu) Build completed successfully in 0:00:08 ``` -#### Controlling log output +#### Controlling tracing output The env var `BOOTSTRAP_TRACING` accepts a [`tracing` env-filter][tracing-env-filter]. -There are two orthogonal ways to control which kind of logs you want: +There are two orthogonal ways to control which kind of tracing logs you want: 1. You can specify the log **level**, e.g. `DEBUG` or `TRACE`. 2. You can also control the log **target**, e.g. `bootstrap` or `bootstrap::core::config` vs custom targets like `CONFIG_HANDLING`. -- cgit 1.4.1-3-g733a5 From 7d999a5e497beae6b5e2283fbe1e8edded929f80 Mon Sep 17 00:00:00 2001 From: yukang Date: Fri, 14 Feb 2025 13:43:55 +0800 Subject: add notes for perf issue --- src/doc/rustc-dev-guide/src/profiling/with_perf.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/src/profiling/with_perf.md b/src/doc/rustc-dev-guide/src/profiling/with_perf.md index 6cd98f886dd..51a22d18577 100644 --- a/src/doc/rustc-dev-guide/src/profiling/with_perf.md +++ b/src/doc/rustc-dev-guide/src/profiling/with_perf.md @@ -52,6 +52,13 @@ you made in the beginning. But there are some things to be aware of: - You probably don't want incremental messing about with your profile. So something like `CARGO_INCREMENTAL=0` can be helpful. +In case to avoid the issue of `addr2line xxx/elf: could not read first record` when reading +collected data from `cargo`, you may need use the latest version of `addr2line`: + +```bash +cargo install addr2line --features="bin" +``` + ### Gathering a perf profile from a `perf.rust-lang.org` test Often we want to analyze a specific test from `perf.rust-lang.org`. -- cgit 1.4.1-3-g733a5 From a21ffd87c3dca3381ded33fda36fb23cf7919d43 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 14 Feb 2025 07:23:10 +0100 Subject: Fix borked link --- src/doc/rustc-dev-guide/src/compiler-debugging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/src/compiler-debugging.md b/src/doc/rustc-dev-guide/src/compiler-debugging.md index e2097b26e5c..c16b3ee7abd 100644 --- a/src/doc/rustc-dev-guide/src/compiler-debugging.md +++ b/src/doc/rustc-dev-guide/src/compiler-debugging.md @@ -368,7 +368,7 @@ error: layout_of(&'a u32) = Layout { error: aborting due to previous error ``` -[`Layout`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/struct.Layout.html +[`Layout`]: https://doc.rust-lang.org/nightly/nightly-rustc/stable_mir/abi/struct.Layout.html ## Configuring CodeLLDB for debugging `rustc` -- cgit 1.4.1-3-g733a5 From 6714f1d93388b6d6bbcb4d491835fba51cdb2cb2 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 14 Feb 2025 07:26:43 +0100 Subject: Start using latest release where -f checks all local links --- src/doc/rustc-dev-guide/.github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml index 3f810e2fbcc..2bae8fcbdfa 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest env: MDBOOK_VERSION: 0.4.21 - MDBOOK_LINKCHECK2_VERSION: 0.8.1 + MDBOOK_LINKCHECK2_VERSION: 0.9.0 MDBOOK_MERMAID_VERSION: 0.12.6 MDBOOK_TOC_VERSION: 0.11.2 DEPLOY_DIR: book/html -- cgit 1.4.1-3-g733a5 From dce265224a7674814d4d81a81192bf9077ed2edd Mon Sep 17 00:00:00 2001 From: Florian Brucker Date: Sat, 15 Feb 2025 19:44:32 +0100 Subject: Fix examples to work with nightly-2025-02-13 While there were comments indicating which nightly versions the examples were tested with, those versions did not work for me: neither did the examples compile, nor did they produce the expected output. This commit fixes the compilation issues, using nightly-2025-02-13 for all examples (previously the version differed between the examples) and, in the case of the `rustc_driver` examples, also fixes the argument passing: rustc ignores the first argument, so we need to pass the filename as the second (otherwise we only get the help text printed). Note that the `rustc-interface-getting-diagnostics.rs` example still does not produce any output, which I assume is not how it is intended. However, I don't know enough to fix it. To avoid inconsistencies between the documented version and the actually required version I've moved the version comment from the Markdown into the Rust code where it hopefully won't be forgotten as easily. Finally I've clarified in the examples' README that you also need to use the proper nightly version when compiling the examples, not just when running them. --- src/doc/rustc-dev-guide/examples/README | 5 ++++- src/doc/rustc-dev-guide/examples/rustc-driver-example.rs | 14 ++++++++++++-- .../examples/rustc-driver-interacting-with-the-ast.rs | 16 +++++++++++++--- .../rustc-dev-guide/examples/rustc-interface-example.rs | 8 ++++---- .../examples/rustc-interface-getting-diagnostics.rs | 6 ++++-- .../src/rustc-driver/getting-diagnostics.md | 1 - .../src/rustc-driver/interacting-with-the-ast.md | 1 - 7 files changed, 37 insertions(+), 14 deletions(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/examples/README b/src/doc/rustc-dev-guide/examples/README index ca49dd74db2..05e44673700 100644 --- a/src/doc/rustc-dev-guide/examples/README +++ b/src/doc/rustc-dev-guide/examples/README @@ -4,7 +4,10 @@ For each example to compile, you will need to first run the following: To create an executable: - rustc rustc-driver-example.rs + rustup run nightly rustc rustc-driver-example.rs + +You might need to be more specific about the exact nightly version. See the comments at the top of +the examples for the version they were written for. To run an executable: diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs index 14998965ac8..984bd3e37ae 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs @@ -1,3 +1,5 @@ +// Tested with nightly-2025-02-13 + #![feature(rustc_private)] extern crate rustc_ast; @@ -73,7 +75,7 @@ impl rustc_driver::Callbacks for MyCallbacks { let hir = tcx.hir(); let item = hir.item(id); match item.kind { - rustc_hir::ItemKind::Static(_, _, _) | rustc_hir::ItemKind::Fn(_, _, _) => { + rustc_hir::ItemKind::Static(_, _, _) | rustc_hir::ItemKind::Fn { .. } => { let name = item.ident; let ty = tcx.type_of(item.hir_id().owner.def_id); println!("{name:?}:\t{ty:?}") @@ -87,5 +89,13 @@ impl rustc_driver::Callbacks for MyCallbacks { } fn main() { - run_compiler(&["main.rs".to_string()], &mut MyCallbacks); + run_compiler( + &[ + // The first argument, which in practice contains the name of the binary being executed + // (i.e. "rustc") is ignored by rustc. + "ignored".to_string(), + "main.rs".to_string(), + ], + &mut MyCallbacks, + ); } diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs index 9fcb16b0fca..98c6041d0be 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs @@ -1,3 +1,5 @@ +// Tested with nightly-2025-02-13 + #![feature(rustc_private)] extern crate rustc_ast; @@ -74,8 +76,8 @@ impl rustc_driver::Callbacks for MyCallbacks { for id in hir_krate.items() { let item = hir_krate.item(id); // Use pattern-matching to find a specific node inside the main function. - if let rustc_hir::ItemKind::Fn(_, _, body_id) = item.kind { - let expr = &tcx.hir().body(body_id).value; + if let rustc_hir::ItemKind::Fn { body, .. } = item.kind { + let expr = &tcx.hir().body(body).value; if let rustc_hir::ExprKind::Block(block, _) = expr.kind { if let rustc_hir::StmtKind::Let(let_stmt) = block.stmts[0].kind { if let Some(expr) = let_stmt.init { @@ -94,5 +96,13 @@ impl rustc_driver::Callbacks for MyCallbacks { } fn main() { - run_compiler(&["main.rs".to_string()], &mut MyCallbacks); + run_compiler( + &[ + // The first argument, which in practice contains the name of the binary being executed + // (i.e. "rustc") is ignored by rustc. + "ignored".to_string(), + "main.rs".to_string(), + ], + &mut MyCallbacks, + ); } diff --git a/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs b/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs index 30f48ea5297..70f27c2a82a 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs @@ -1,3 +1,5 @@ +// Tested with nightly-2025-02-13 + #![feature(rustc_private)] extern crate rustc_driver; @@ -9,8 +11,6 @@ extern crate rustc_interface; extern crate rustc_session; extern crate rustc_span; -use std::sync::Arc; - use rustc_errors::registry; use rustc_hash::FxHashMap; use rustc_session::config; @@ -56,7 +56,7 @@ fn main() { expanded_args: Vec::new(), ice_file: None, hash_untracked_state: None, - using_internal_features: Arc::default(), + using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES, }; rustc_interface::run_compiler(config, |compiler| { // Parse the program and print the syntax tree. @@ -68,7 +68,7 @@ fn main() { let hir = tcx.hir(); let item = hir.item(id); match item.kind { - rustc_hir::ItemKind::Static(_, _, _) | rustc_hir::ItemKind::Fn(_, _, _) => { + rustc_hir::ItemKind::Static(_, _, _) | rustc_hir::ItemKind::Fn { .. } => { let name = item.ident; let ty = tcx.type_of(item.hir_id().owner.def_id); println!("{name:?}:\t{ty:?}") diff --git a/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs b/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs index 2355cb85ab3..39b236e1783 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs @@ -1,3 +1,5 @@ +// Tested with nightly-2025-02-13 + #![feature(rustc_private)] extern crate rustc_data_structures; @@ -15,7 +17,7 @@ use std::sync::{Arc, Mutex}; use rustc_errors::emitter::Emitter; use rustc_errors::registry::{self, Registry}; use rustc_errors::translation::Translate; -use rustc_errors::{DiagCtxt, DiagInner, FluentBundle}; +use rustc_errors::{DiagInner, FluentBundle}; use rustc_session::config; use rustc_span::source_map::SourceMap; @@ -79,7 +81,7 @@ fn main() { expanded_args: Vec::new(), ice_file: None, hash_untracked_state: None, - using_internal_features: Arc::default(), + using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES, }; rustc_interface::run_compiler(config, |compiler| { let krate = rustc_interface::passes::parse(&compiler.sess); diff --git a/src/doc/rustc-dev-guide/src/rustc-driver/getting-diagnostics.md b/src/doc/rustc-dev-guide/src/rustc-driver/getting-diagnostics.md index e3ca323058c..1043df6ecb6 100644 --- a/src/doc/rustc-dev-guide/src/rustc-driver/getting-diagnostics.md +++ b/src/doc/rustc-dev-guide/src/rustc-driver/getting-diagnostics.md @@ -8,7 +8,6 @@ otherwise be printed to stderr. To get diagnostics from the compiler, configure [`rustc_interface::Config`] to output diagnostic to a buffer, and run [`TyCtxt.analysis`]. -The following was tested with `nightly-2024-09-16`: ```rust {{#include ../../examples/rustc-interface-getting-diagnostics.rs}} diff --git a/src/doc/rustc-dev-guide/src/rustc-driver/interacting-with-the-ast.md b/src/doc/rustc-dev-guide/src/rustc-driver/interacting-with-the-ast.md index 5eaa0c82c9e..f46418701a7 100644 --- a/src/doc/rustc-dev-guide/src/rustc-driver/interacting-with-the-ast.md +++ b/src/doc/rustc-dev-guide/src/rustc-driver/interacting-with-the-ast.md @@ -5,7 +5,6 @@ ## Getting the type of an expression To get the type of an expression, use the [`after_analysis`] callback to get a [`TyCtxt`]. -The following was tested with `nightly-2024-12-15`: ```rust {{#include ../../examples/rustc-driver-interacting-with-the-ast.rs}} -- cgit 1.4.1-3-g733a5 From fcfabc107691774ee3b15d9d771b4dc1d6a014bc Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Sat, 15 Feb 2025 23:03:42 +0100 Subject: Fix CI schedule --- src/doc/rustc-dev-guide/.github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml index 7c414ce2641..00c1c409271 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: pull_request: schedule: # Run multiple times a day as the successfull cached links are not checked every time. - - cron: '0 */3 * * *' + - cron: '0 */8 * * *' jobs: ci: -- cgit 1.4.1-3-g733a5 From 089af6704ba81d776351798bfdcc3df604671750 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Sun, 16 Feb 2025 13:21:34 +0100 Subject: Bump mdbook-linkcheck2 dependency version --- src/doc/rustc-dev-guide/.github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml index 2796c142084..22a4fb1901a 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest env: MDBOOK_VERSION: 0.4.21 - MDBOOK_LINKCHECK2_VERSION: 0.9.0 + MDBOOK_LINKCHECK2_VERSION: 0.9.1 MDBOOK_MERMAID_VERSION: 0.12.6 MDBOOK_TOC_VERSION: 0.11.2 DEPLOY_DIR: book/html -- cgit 1.4.1-3-g733a5 From 39667c5608c9683efd06107a8575d5763a0524c8 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 23 Feb 2025 22:07:09 -0500 Subject: document how to setup RA for nvim automatically --- src/doc/rustc-dev-guide/src/building/suggested.md | 33 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index 2c6c3fe1df8..77c9dc6e492 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -120,10 +120,35 @@ create a `.vim/coc-settings.json`. The settings can be edited with [`src/etc/rust_analyzer_settings.json`]. Another way is without a plugin, and creating your own logic in your -configuration. To do this you must translate the JSON to Lua yourself. The -translation is 1:1 and fairly straight-forward. It must be put in the -`["rust-analyzer"]` key of the setup table, which is [shown -here](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer). +configuration. The following code will work for any checkout of rust-lang/rust (newer than Febuary 2025): + +```lua +lspconfig.rust_analyzer.setup { + root_dir = function() + default = lspconfig.rust_analyzer.config_def.default_config.root_dir() + -- the default root detection uses the cargo workspace root. + -- but for rust-lang/rust, the standard library is in its own workspace. + -- use the git root instead. + compiler_config = vim.fs.joinpath(default, "../src/bootstrap/defaults/config.compiler.toml") + if vim.fs.basename(default) == "library" and vim.uv.fs_stat(compiler_config) then + return vim.fs.dirname(default) + end + return default + end, + on_init = function(client) + local path = client.workspace_folders[1].name + config = vim.fs.joinpath(path, "src/etc/rust_analyzer_zed.json") + if vim.uv.fs_stat(config) then + -- load rust-lang/rust settings + file = io.open(config) + json = vim.json.decode(file:read("*a")) + client.config.settings["rust-analyzer"] = json.lsp["rust-analyzer"].initialization_options + client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) + end + return true + end +} +``` If you would like to use the build task that is described above, you may either make your own command in your config, or you can install a plugin such as -- cgit 1.4.1-3-g733a5 From 25eac11f7bca365bbb310cbb77d1b9093c54f88d Mon Sep 17 00:00:00 2001 From: jyn Date: Mon, 24 Feb 2025 00:12:55 -0500 Subject: use lua locals Co-authored-by: DianQK --- src/doc/rustc-dev-guide/src/building/suggested.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index 77c9dc6e492..e2d50b31d04 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -125,11 +125,11 @@ configuration. The following code will work for any checkout of rust-lang/rust ( ```lua lspconfig.rust_analyzer.setup { root_dir = function() - default = lspconfig.rust_analyzer.config_def.default_config.root_dir() + local default = lspconfig.rust_analyzer.config_def.default_config.root_dir() -- the default root detection uses the cargo workspace root. -- but for rust-lang/rust, the standard library is in its own workspace. -- use the git root instead. - compiler_config = vim.fs.joinpath(default, "../src/bootstrap/defaults/config.compiler.toml") + local compiler_config = vim.fs.joinpath(default, "../src/bootstrap/defaults/config.compiler.toml") if vim.fs.basename(default) == "library" and vim.uv.fs_stat(compiler_config) then return vim.fs.dirname(default) end @@ -137,11 +137,11 @@ lspconfig.rust_analyzer.setup { end, on_init = function(client) local path = client.workspace_folders[1].name - config = vim.fs.joinpath(path, "src/etc/rust_analyzer_zed.json") + local config = vim.fs.joinpath(path, "src/etc/rust_analyzer_zed.json") if vim.uv.fs_stat(config) then -- load rust-lang/rust settings - file = io.open(config) - json = vim.json.decode(file:read("*a")) + local file = io.open(config) + local json = vim.json.decode(file:read("*a")) client.config.settings["rust-analyzer"] = json.lsp["rust-analyzer"].initialization_options client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) end -- cgit 1.4.1-3-g733a5 From 9423634997e4c0beab4dff936eaf91126a4a8d80 Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Tue, 25 Feb 2025 18:56:14 +0100 Subject: Fix posting message to Zulip --- src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index dc5395a19dd..b19eccf9eb8 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -111,4 +111,4 @@ jobs: to: 196385 type: "stream" topic: "Subtree sync automation" - content: ${{ steps.message.outputs.message }} + content: ${{ steps.create-message.outputs.message }} -- cgit 1.4.1-3-g733a5 From 46392d1661540e256fd9573d8f06c2784a58c983 Mon Sep 17 00:00:00 2001 From: Boxy Date: Tue, 25 Feb 2025 21:22:45 +0000 Subject: Preparing for merge from rustc --- src/doc/rustc-dev-guide/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doc/rustc-dev-guide') diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index 78e9ecdf174..ce21bb8ef39 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -124cc92199ffa924f6b4c7cc819a85b65e0c3984 +4ecd70ddd1039a3954056c1071e40278048476fa -- cgit 1.4.1-3-g733a5