about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2025-04-05Clean up `rustc-literal-escaper` usage in rust-analyzerGuillaume Gomez-5/+3
2025-04-04Update `rustc-literal-escaper` version to `0.0.2`Guillaume Gomez-4/+4
2025-04-04Remove usage of `rustc_lexer::unescape` in rust-analyzerGuillaume Gomez-18/+21
2025-04-01Support metadata version 10 in proc-macro-srvJakub Beránek-2/+2
2025-03-30Remove attribute `#[rustc_error]`Vadim Petrochenkov-4/+0
2025-03-16Suppress must_use for ControlFlow in rust-analyzerMichael Goulet-17/+17
2025-03-11Auto merge of #136932 - m-ou-se:fmt-width-precision-u16, r=scottmcmbors-1/+1
Reduce formatting `width` and `precision` to 16 bits This is part of https://github.com/rust-lang/rust/issues/99012 This is reduces the `width` and `precision` fields in format strings to 16 bits. They are currently full `usize`s, but it's a bit nonsensical that we need to support the case where someone wants to pad their value to eighteen quintillion spaces and/or have eighteen quintillion digits of precision. By reducing these fields to 16 bit, we can reduce `FormattingOptions` to 64 bits (see https://github.com/rust-lang/rust/pull/136974) and improve the in memory representation of `format_args!()`. (See additional context below.) This also fixes a bug where the width or precision is silently truncated when cross-compiling to a target with a smaller `usize`. By reducing the width and precision fields to the minimum guaranteed size of `usize`, 16 bits, this bug is eliminated. This is a breaking change, but affects almost no existing code. --- Details of this change: There are three ways to set a width or precision today: 1. Directly a formatting string, e.g. `println!("{a:1234}")` 2. Indirectly in a formatting string, e.g. `println!("{a:width$}", width=1234)` 3. Through the unstable `FormattingOptions::width` method. This PR: - Adds a compiler error for 1. (`println!("{a:9999999}")` no longer compiles and gives a clear error.) - Adds a runtime check for 2. (`println!("{a:width$}, width=9999999)` will panic.) - Changes the signatures of the (unstable) `FormattingOptions::[get_]width` methods to use a `u16` instead. --- Additional context for improving `FormattingOptions` and `fmt::Arguments`: All the formatting flags and options are currently: - The `+` flag (1 bit) - The `-` flag (1 bit) - The `#` flag (1 bit) - The `0` flag (1 bit) - The `x?` flag (1 bit) - The `X?` flag (1 bit) - The alignment (2 bits) - The fill character (21 bits) - Whether a width is specified (1 bit) - Whether a precision is specified (1 bit) - If used, the width (a full usize) - If used, the precision (a full usize) Everything except the last two can simply fit in a `u32` (those add up to 31 bits in total). If we can accept a max width and precision of u16::MAX, we can make a `FormattingOptions` that is exactly 64 bits in size; the same size as a thin reference on most platforms. If, additionally, we also limit the number of formatting arguments, we can also reduce the size of `fmt::Arguments` (that is, of a `format_args!()` expression).
2025-03-10Fix rust-analyzer for 16-bit fmt width and precision.Mara Bos-1/+1
2025-03-10Merge pull request #19331 from lnicola/sync-from-rustLaurențiu Nicola-246/+106
minor: Sync from downstream
2025-03-10Format codeLaurențiu Nicola-35/+43
2025-03-10Merge pull request #19328 from Veykril/push-umwykvoskvypLukas Wirth-25/+45
internal: Run proc-macro server tests as separate CI job
2025-03-10Fix simd layout testLaurențiu Nicola-1/+1
2025-03-10Bump rustc cratesLaurențiu Nicola-25/+20
2025-03-10Run proc-macro server tests are separate CI jobLukas Wirth-25/+45
Touch tt
2025-03-10Merge pull request #19330 from ChayimFriedman2/normalize-projectionLukas Wirth-503/+869
fix: Normalize projections in evaluated const display and layout calculation
2025-03-10Merge pull request #19079 from ChayimFriedman2/rename-conflictLukas Wirth-59/+509
feat: Warn the user when a rename will change the meaning of the program
2025-03-10Merge pull request #19327 from Veykril/push-qyyvkulltzpzLukas Wirth-2/+6
Fix `path` macro hygiene
2025-03-10Merge from rust-lang/rustLaurențiu Nicola-195/+52
2025-03-10Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2025-03-10Fix `path` macro hygieneLukas Wirth-2/+6
2025-03-10Merge pull request #19311 from aibaars/log-build-script-errorLukas Wirth-0/+8
Log build script error output in `load_cargo::load_workspace_at`
2025-03-10Merge pull request #19314 from snprajwal/variantdef-implLukas Wirth-1/+68
fix(hir): `VariantDef` is `impl HasSource`
2025-03-10Merge pull request #19316 from snprajwal/git-commit-ecLukas Wirth-0/+3
fix: do not apply editorconfig to git commit msg
2025-03-10Merge pull request #19252 from flodiebold/fix-fixup-delimitersLukas Wirth-88/+105
Fix syntax fixup producing invalid punctuation
2025-03-10Merge pull request #19232 from ShoyuVanilla/issue-19196Lukas Wirth-12/+59
Bump chalk for built-in supports of async closures
2025-03-09Rank ADT constructors as constructors for completion scoringLukas Wirth-12/+102
2025-03-09fix: Prevent wrong invocations of `needs_parens_in` with non-ancestral "parent"sShoyu Vanilla-17/+120
2025-03-09internal: Migrate `inline_local_variable` to `SyntaxEditor`Shoyu Vanilla-32/+55
2025-03-09Bump chalk for built-in supports of async closuresShoyu Vanilla-14/+61
2025-03-08Generated doc update¨Florian-2/+2
2025-03-08Fix syntax fixup producing invalid punctuation¨Florian-88/+105
Fixes #19206. Fixes #18244.
2025-03-08Use `rustc_abi` code for SIMD layout in rust-analyzerMoulins-39/+7
2025-03-08Remove most manual LayoutData creations and move them to `rustc_abi`Moulins-78/+20
...either as: - methods on LayoutCalculator, for faillible operations; - constructors on LayoutData, for infaillible ones.
2025-03-08fix: do not apply editorconfig to git commit msgPrajwal S N-0/+3
The `max_line_length` property was set to 100 for all filetypes, which led to git commit messages being wrapped at 100 characters instead of the usual 75. This introduces an exception for the special file used by git to write commit messages. Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-03-08fix(hir): `VariantDef` is `impl HasSource`Prajwal S N-3/+70
A new syntax node `ast::VariantDef` has been introduced to map between the HIR node and the AST. The files have been updated with `cargo test -p xtask`. Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-03-07Log build script error output in `load_cargo::load_workspace_at`Arthur Baars-0/+8
2025-03-07Merge pull request #19308 from Veykril/push-rnrxutwlvmlyLukas Wirth-23/+1174
Move loaded project MSRV back to 1.78, show notification for the warning
2025-03-07Pop up a notification for the MSRV project loading warningLukas Wirth-16/+29
2025-03-07Move project MSRV back to 1.78Lukas Wirth-7/+1145
2025-03-07Refactor relevance scoring to use a named constant BASE_SCORETongjun Gao-3/+5
Replace magic number with a named constant for improved readability and maintainability of the scoring logic
2025-03-07Fix logical error in relevance scoring implementationTongjun Gao-3/+3
2025-03-07Mark `rust-analyzer.showSyntaxTree` config option as requiring server restartChayim Refael Friedman-0/+1
We register the provider when we start the server. It confused me why I set the option and it didn't work, so probably better to have it hint people.
2025-03-06Update stdarchEric Huss-9/+15
2025-03-06Warn the user when a rename will change the meaning of the programChayim Refael Friedman-59/+509
Specifically, when a rename of a local will change some code that refers it to refer another local, or some code that refer another local to refer to it. We do it by introducing a dummy edit with an annotation. I'm not a fond of this approach, but I don't think LSP has a better way.
2025-03-06Use correct crate for trait env in `render_const_scalar()`Chayim Refael Friedman-5/+7
2025-03-06Pass the target crate in `HirFormatter`Chayim Refael Friedman-499/+824
This is required to format evaluated consts, because we need trait env, and it needs the crate (currently it uses the last crate in topological order, which is wrong, the next commit will fix that).
2025-03-06Normalize projections in evaluated const display and layout calculationChayim Refael Friedman-0/+39
2025-03-06Merge pull request #19290 from aibaars/patch-1Lukas Wirth-1/+17
Add warning and debug information when `cargo metadata` fails
2025-03-06Change `%e` to `?e` to include detailed error messageArthur Baars-2/+1
2025-03-06Merge pull request #19295 from alibektas/rust_analyzer_run_on_cargo_tomlLukas Wirth-6/+23
fix: Make RustAnalyzer:Run available in manifest file