1314 Commits

Author SHA1 Message Date
Jesung Yang
7f6858fd09 feat: introduce crate_attrs field in rust-project.json
Since the commit 50384460c68f
("Rewrite method resolution to follow rustc more closely"), the method
resolution logic has changed: rust-analyzer only looks up inherent
methods for primitive types in sysroot crates.

Unfortunately, this change broke at least one project that relies on
`rust-project.json`: Rust-for-Linux. Its auto-generated
`rust-project.json` directly embeds `core`, `alloc`, and `std` in the
`crates` list without defining `sysroot_src`. Consequently,
rust-analyzer fails to identify them as sysroot crates, breaking IDE
support for primitive methods (e.g., `0_i32.rotate_left(0)`).

However, specifying `sysroot_src` creates a new issue: it implicitly
adds `std` as a dependency to all kernel module crates, which are
actually compiled with `-Zcrate-attr=no_std`. Since rust-analyzer cannot
see compiler flags passed outside of the project definition, we need a
method to explicitly specify `#![no_std]` or, more generally,
crate-level attributes through the project configuration.

To resolve this, extend the `rust-project.json` format with a new
`crate_attrs` field. This allows users to specify crate-level attributes
such as `#![no_std]` directly into the configuration, enabling
rust-analyzer to respect them when analyzing crates.

References:
- The original Zulip discussion:
  https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Primitive.20type.20inherent.20method.20lookup.20fails/with/562983853
2025-12-18 01:27:43 +00:00
benodiwal
87f13bb21b
feat: show parameter hint for missing arguments 2025-12-10 17:37:26 +05:30
A4-Tacks
e8ee597340
Add config hide placeholders type hints
In the inferred type hints, expand the line too long. add config to disable it.

Example
---
```json
{"rust-analyzer.inlayHints.typeHints.hideInferredTypes": true}
```

```rust
use std::collections::HashMap;
fn foo(iter: Vec<Result<HashMap<String, String>, std::io::Error>>) {
    let output = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
}
```

**Before this PR**

```rust
let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_ = HashMap<String, String>>, _ = Error>>().unwrap();
```

**After this PR**

```rust
let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
```
2025-12-05 02:09:59 +08:00
Wilfred Hughes
5f0be6f1c4 Remove mdbook-toc usage
Now that there's a table of contents rendered in the left sidebar,
there doesn't seem to be much value in rendering a table of contents
on the page too.

The sidebar TOC was added in mdbook 0.5:
https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#05-migration-guide
2025-12-01 14:27:20 +00:00
Wilfred Hughes
1ce8ab347f Fix URLs and highlighting in manual 2025-11-28 11:39:40 +00:00
Aditya-PS-05
ba5ecc09ac feat: make dyn inlay hints configurable 2025-11-20 00:37:01 +05:30
Laurențiu Nicola
bfde998d64 Drop multilingual field from the book config 2025-11-19 10:31:42 +02:00
Chayim Refael Friedman
a78bef74a3 Merge pull request #21005 from fgamador/book-testing
Book>Contributing>Testing: Fix typos and distracting word choices
2025-11-15 09:17:33 +02:00
The rustc-josh-sync Cronjob Bot
ae9f97c299 Merge ref 'c5dabe8cf798' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: c5dabe8cf798123087d094f06417f5a767ca73e8
Filtered ref: 3214048a4d271548c85aae8ffc5f28ec73719235
Upstream diff: fb24b04b09...c5dabe8cf7

This merge was created using https://github.com/rust-lang/josh-sync.
2025-11-03 04:20:09 +00:00
Jakub Beránek
f0ff861dca
Generalize branch references to HEAD 2025-11-02 11:15:55 +01:00
Shoyu Vanilla (Flint)
2e2e3ebec9
Merge pull request #20927 from ChayimFriedman2/dhat
feat: Support memory profiling with dhat
2025-10-31 07:08:23 +00:00
Chayim Refael Friedman
1ba3165b81 Support memory profiling with dhat
Unfortunately, this requires a custom build of r-a, and it's quite slow.
2025-10-28 13:00:53 +02:00
Chayim Refael Friedman
4fddcc6d57 Provide an option to not show derives near the ADT for "Goto Implementations" or "Implementations" codelens
I don't do it by default, for three reasons: (1) it's more expensive, (2) I actually quite like seeing the derives, and they may expand to no impl/more than one impl, (3) if #19130 will ever be merged this will become even more useful.

Even a config might be too much, but it was fun and easy to code so I did that.
2025-10-28 08:34:16 +02:00
Kirill Bulatov
d0e07f080b Replace --show-output with --nocapture
The former does not show any output before the test is finished, which prevents long-running/stuck tests from showing any useful information.
2025-10-05 22:28:00 +03:00
Remo Senekowitsch
ec2940acd8
docs: Mention editor-independent configuration 2025-10-05 13:41:28 +02:00
João M. Martins
67501ee6c2
fixes small typos in docs and indent issue 2025-10-02 13:33:53 +10:00
Chayim Refael Friedman
129d9f7af6 Clarify rust-analyzer.inlayHints.maxLength is not a hard guarantee 2025-09-22 04:16:50 +03:00
Chayim Refael Friedman
5b68439f13
Merge pull request #20583 from btj/comments-enable
Add `rust-analyzer.semanticHighlighting.comments.enable`
2025-09-17 14:06:17 +00:00
Bart Jacobs
d106d41fbc Add the rust-analyzer.semanticHighlighting.comments.enable configuration value 2025-09-17 15:46:23 +02:00
Chayim Refael Friedman
24ece0de41 Add a testing guide 2025-09-15 10:48:26 +03:00
Jakub Beránek
e5a51cc6c5
Add a FAQ entry about RA and Cargo interaction 2025-09-09 09:12:09 +02:00
Jakub Beránek
255f020e76
Update documentation about how to build the RA book 2025-09-09 08:37:02 +02:00
Wilfred Hughes
365be20980 Clarify intro in README and manual
The first sentence a new user should see should ideally answer the
questions:

* What is rust-analyzer?
* Why might I want to use it?

The vast majority of users will be interested in using rust-analyzer
inside their favourite editor. We should clarify that rust-analyzer is
an LSP implementation and that it supports all the classic IDE
features.

Whilst it's also true that rust-analyzer is modular and organised into
libraries, the first impression should (I think) focus on an overview
and the primary use case.
2025-09-08 19:10:14 +01:00
Shoyu Vanilla (Flint)
25adf3464c
Merge pull request #20520 from ChayimFriedman2/reborrow
feat: Add an option to remove reborrows from adjustment inlay hints
2025-08-26 05:48:34 +00:00
Emmanuel Ferdman
16f1fd8676
Fix rust-analyzer-contributors reference
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-08-24 08:04:00 -07:00
Chayim Refael Friedman
eaf71411a9 Add an option to remove reborrows from adjustment inlay hints
Reborrows are consecutive deref then ref. Make it the default because reborrows are mostly useless to the programmer.

Also rename `rust-analyzer.inlayHints.expressionAdjustmentHints.enable: "reborrow"` to `rust-analyzer.inlayHints.expressionAdjustmentHints.enable: "borrows"`, as it's not about reborrows but about any ref/deref and it's confusing with the new setting.
2025-08-24 02:26:37 +03:00
donni-h
53b27f2ab2
Fix dead link to Cargo.toml in documentation
../../Cargo.toml resolves to https://rust-analyzer.github.io/Cargo.toml, which is an invalid link
2025-08-13 13:03:52 +02:00
Ifeanyi Orizu
dc6e6d2b86 Add config option to exclude locals from doc search 2025-08-10 17:48:17 -05:00
Ifeanyi Orizu
dbae9ae357 Fix more docs 2025-08-01 10:48:54 -05:00
Ifeanyi Orizu
76b2333c1b Update documentation for overrideCommand config options 2025-08-01 10:48:54 -05:00
Lukas Wirth
c12ec2e062
Merge pull request #20154 from joshka/jm/improve-setting-titles
Improve settings tree title and descriptions
2025-07-29 10:42:07 +00:00
Jakub Beránek
00a47e3299
Apply suggestions from code review
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2025-07-22 18:14:20 +02:00
Jakub Beránek
9c1750d0b5
Document synces using josh-sync 2025-07-22 15:25:18 +02:00
vinícius x
6e86abc99a remove syntaxTree from docs 2025-07-04 14:27:03 -03:00
Josh McKinney
fb219ae76c
Improve settings tree title and descriptions
- All settings are now phrased in the imperative form stating what the
  setting does rather than talking about what it controls. (E.g.:
  "Show `Debug` action." instead of "Whether to show `Debug` action"
- Categories are now displayed in title case
- Categories are now sorted lexicographically
- General category is removed (and all the settings are moved to the top
  level)
- Language for a few descriptions is made a bit less ambiguous
2025-07-02 22:12:46 -07:00
roifewu
c36758def4 refactor: rename branches to branch_exit_points in highlight_related 2025-06-26 13:41:41 +08:00
roifewu
f87220e22a feat: highlighting of related return values while the cursor is on any match, if, or match arm arrow (=>) 2025-06-26 13:41:39 +08:00
Chayim Refael Friedman
6b558621a9 Fix link in the book 2025-06-25 06:30:16 +03:00
Lukas Wirth
5cda2dd412
Merge pull request #20064 from Wilfred/document_sysroot_project
Document sysroot_project field in rust-project.json
2025-06-24 07:15:19 +00:00
Chayim Refael Friedman
84c4dfdee9 Add troubleshooting FAQ to the book
And one frequently asked question.
2025-06-23 21:16:21 +03:00
Wilfred Hughes
994831f240 Document sysroot_project field in rust-project.json 2025-06-23 10:43:45 +01:00
Lucas Holten
7492b63c18 Add better documentation for excluding imports from symbol search 2025-06-20 13:26:59 +02:00
Lukas Wirth
3ee81c7115 fix: Temporarily disable + typing handler as it moves the cursor position 2025-06-19 08:29:50 +02:00
Lukas Wirth
8661c59a7f
Merge pull request #19939 from ChayimFriedman2/fill-arms-self
feat: In "Fill match arms", allow users to prefer `Self` to the enum name when possible
2025-06-17 08:20:02 +00:00
Lukas Wirth
b1824c3962 feat: Insert required parentheses when typing + in trait type 2025-06-16 19:02:18 +02:00
Laurențiu Nicola
e2c3647c6a
Merge pull request #19994 from sourcefrog/book-links
Fix some links in the book
2025-06-16 07:02:59 +00:00
Lucas Holten
dc85e3ee35 Add config option to exclude imports from symbol search 2025-06-15 02:41:35 +02:00
Martin Pool
e3c75abe67 Make the URL a hyperlink 2025-06-13 07:36:51 -07:00
Martin Pool
5702eadd27 Fix link to the contribution guide 2025-06-13 07:35:34 -07:00
Jakub Beránek
4ed107fbc9
Fix link to good first issues 2025-06-13 07:55:07 +02:00