Commit graph

149296 commits

Author SHA1 Message Date
bors
7cf4cc7d90 Auto merge of #17487 - Veykril:ty-perf-stuff, r=Veykril
internal: Some more small memory optimizations

Not a big impact on metrics, though there are some more savings in queries mainly used by the IDE layer from this
2024-06-24 09:50:35 +00:00
Lukas Wirth
0b69c601fb Fix term_search filtering enum variant generics incorrectly 2024-06-24 10:31:21 +02:00
bors
1cd8bc0cf2 Auto merge of #17471 - davidsemakula:fix-remove-parenthesis, r=Veykril
fix: don't remove parentheses for calls of function-like pointers that are members of a struct or union

Fixes #17111
2024-06-24 08:25:49 +00:00
bors
f9a337cc88 Auto merge of #17411 - Wilfred:clearer_unlinked_file, r=Veykril
fix: Improve hover text in unlinked file diagnostics

Use full sentences, and mention how to disable the diagnostic if users are intentionally working on unowned files.

![Screenshot 2024-06-12 at 5 55 48 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/c91ee1ed-1c72-495a-9ee3-9e360a5c6977)

(Full disclosure: I've tested a rust-analyzer build in VS Code, but the pop-up logic is currently disabled due to #17062, so I haven't tested that.)
2024-06-24 08:11:43 +00:00
Lukas Wirth
04b6b04092 Shrink mbe's Op 2024-06-24 10:07:32 +02:00
Lukas Wirth
7a7446bb94 Intern ModPath within RawVisibility 2024-06-24 10:07:32 +02:00
Lukas Wirth
71c6e23ffc Save a bit on empty item trees by deduplicating them 2024-06-24 10:07:32 +02:00
Lukas Wirth
eace303b9d Enum variants are not generic def ids 2024-06-24 10:07:31 +02:00
bors
a32ce24b0c Auto merge of #17466 - chenyukang:patch-1, r=Veykril
chore: Fix diagnostic name in macro_error.rs
2024-06-24 07:57:45 +00:00
bors
91f0eecc44 Auto merge of #17481 - roife:fix-issue-17480, r=Veykril
fix: pattern completions in let-stmt

fix #17480.

We can write `let S { a, b } = s;` or `let Some(x) = a else {}`, so it is reasonable to allow pattern completions in `LetStmt`.
2024-06-24 07:34:08 +00:00
bors
4dd0ad7afd Auto merge of #17478 - kilpkonn:master, r=Veykril
Simplify some term search tactics

Working on the paper `@phijor` found that "Data constructor" tactic could be simplified quite a bit by running it only in the backwards direction. With n+1 rounds it has same coverage as previous implementation in n rounds, however the tactic it self is more simple and also potentially faster as there is less to do.

In a nutshell the idea is to only work with types in the wish-list rather than with any types.

Turns out it is quite a bit faster:

Before:
```
ripgrep:
Tail Expr syntactic hits: 238/1692 (14%)
Tail Exprs found: 1223/1692 (72%)
Term search avg time: 15ms

nalgebra:
Tail Expr syntactic hits: 125/3001 (4%)
Tail Exprs found: 2143/3001 (71%)
Term search avg time: 849ms
```

After
````
ripgrep:
Tail Expr syntactic hits: 246/1692 (14%)
Tail Exprs found: 1209/1692 (71%)
Term search avg time: 8ms

nalgebra:
Tail Expr syntactic hits: 125/3001 (4%)
Tail Exprs found: 2028/3001 (67%)
Term search avg time: 305ms
````

_Also removed niche optimization of removing scope defs from the search space as this wasn't helping much anyway and made code a bit more complex._
2024-06-24 07:20:50 +00:00
roife
9dd4e3ecec fix: pattern completions in let-stmt 2024-06-23 22:27:54 +08:00
Tavo Annus
efecb90b7f Fix suggestions of unstable constants 2024-06-22 21:33:58 +03:00
Tavo Annus
8b6dda78b3 Increase search depth to account for more granual steps 2024-06-22 15:06:07 +03:00
Laurențiu Nicola
0744b36d53 Remove Changelog: XXX title from Github release notes 2024-06-22 14:55:23 +03:00
Tavo Annus
83026d47ab Simplify impl_method tactic 2024-06-22 14:22:56 +03:00
Tavo Annus
117068d71f Simplify impl_static_method tactic 2024-06-22 14:14:42 +03:00
Tavo Annus
29425bd377 Remove remove not-very-helpful optimizations 2024-06-22 10:17:33 +03:00
Tavo Annus
b3c924ddb0 Run data_constructor tactic only backwards 2024-06-21 22:01:06 +03:00
bors
9b33872c89 Auto merge of #17469 - roife:fix-issue-17425, r=Veykril
fix: use ItemInNs::Macros to convert ModuleItem to ItemInNs

fix #17425.

When converting `PathResolution` to `ItemInNs`, we should convert `ModuleDef::Macro` to `ItemInNs::Macros` to ensure that it can be found in `DefMap`.
2024-06-21 17:52:42 +00:00
Lukas Wirth
619574928c Prevent re-allocation in CallableSig::from_params_and_return 2024-06-21 19:26:08 +02:00
Lukas Wirth
54f3f56ee8 Save allocations for empty generic_defaults query results 2024-06-21 19:21:27 +02:00
Lukas Wirth
2893153c34 Don't attempt to compute implict sized clauses for empty generics 2024-06-21 19:10:57 +02:00
Lukas Wirth
5cbaa3f554 Save allocations for empty generic_predicates query results 2024-06-21 19:10:45 +02:00
Lukas Wirth
873dcf4b9c Lazy generics 2024-06-21 18:38:37 +02:00
Lukas Wirth
3b97b75599 Simplify 2024-06-21 18:27:05 +02:00
Lukas Wirth
3a66230a44 There can only be one self param 2024-06-21 17:55:16 +02:00
Lukas Wirth
c133c649a0 Light docs and privacy 2024-06-21 17:54:40 +02:00
davidsemakula
f1debd96e4 fix: don't remove parentheses for calls of function-like pointers that are members of a struct or union 2024-06-21 17:57:53 +03:00
roife
51b138cc79 fix: use ItemInNs::Macros to convert ModuleItem to ItemInNs 2024-06-21 21:05:14 +08:00
Lukas Wirth
7b50a5ff43 Extract generics module 2024-06-21 10:55:05 +02:00
Wilfred Hughes
39179c49c6 fix: Improve hover text in unlinked file diagnostics
Use full sentences, and mention how to disable the diagnostic
if users are intentionally working on unowned files.
2024-06-20 09:32:48 -07:00
Yukang
a904bc3761
Fix diagnostic name in macro_error.rs 2024-06-21 00:13:34 +08:00
Wyatt Herkamp
edd66a754e
Check that Expr is none before adding fixup 2024-06-20 08:55:05 -04:00
bors
48b6f28b0e Auto merge of #17462 - Veykril:sema-attr-macro-res, r=Veykril
fix: Fix IDE features breaking in some attr macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/17453, Fixes https://github.com/rust-lang/rust-analyzer/issues/17458
2024-06-20 09:11:44 +00:00
Lukas Wirth
16a28cacc2 fix: Fix IDE features breaking in some attr macros 2024-06-20 11:00:19 +02:00
bors
1d0d439168 Auto merge of #17461 - Veykril:drop-flycheck-recv, r=Veykril
fix: Fix flycheck panicking when cancelled

Fixes https://github.com/rust-lang/rust-analyzer/issues/17445
2024-06-20 08:58:44 +00:00
bors
e8717758b8 Auto merge of #17419 - ishanjain28:filter_builtin_macro_expansion, r=Veykril
Filter builtin macro expansion

This PR adds a filter on the types of built in macros that are allowed to be expanded.

Currently, This list of allowed macros contains, `stringify, cfg, core_panic, std_panic, concat, concat_bytes, include, include_str, include_bytes, env` and `option_env`.

Fixes #14177
2024-06-20 08:39:17 +00:00
Lukas Wirth
e5d5c7b20a Invert matching on builtin macros in expand_allowed_builtins 2024-06-20 10:31:20 +02:00
bors
a17efb9ec9 Auto merge of #17456 - panicbit:remove-cargo-extension-warning, r=Veykril
Remove panicbit.cargo extension warning

A warning was introduced regarding the incompatabilities between `rust-analyzer` and `panicbit.cargo`'s diagnostics / `cargo check` functionality.

This functionality has been removed in the latest version of the cargo extension (`0.3.0`), which is why the warning can be removed now.
2024-06-20 08:25:30 +00:00
Lukas Wirth
2f4e555407 fix: Fix flycheck panicking when cancelled 2024-06-20 10:21:58 +02:00
bors
153a2bab58 Auto merge of #17457 - roife:remove-circle, r=Veykril
fix: ensure there are no cycles in the source_root_parent_map

See #17409

We can view the connections between roots as a graph. The problem is that this graph may contain cycles, so when adding edges, it is necessary to check whether it will lead to a cycle.

Since we ensure that each node has at most one outgoing edge (because each SourceRoot can have only one parent), we can use a disjoint-set to maintain the connectivity between nodes. If an edge’s two nodes belong to the same set, they are already connected.

Additionally, this PR includes the following three changes:

1. Removed the workaround from #17409.
2. Added an optimization: If `map.contains_key(&SourceRootId(*root_id as u32))`, we can skip the current loop iteration since we have already found its parent.
3. Modified the inner loop to iterate in reverse order with `roots[..idx].iter().rev()` at line 319. This ensures that if we are looking for the parent of `a/b/c`, and both `a` and `a/b` meet the criteria, we will choose the longer match (`a/b`).
2024-06-20 07:53:57 +00:00
roife
185971c47d fix: ensure there are no cycles in the source_root_parent_map 2024-06-20 13:46:14 +08:00
Laurențiu Nicola
9d2bb7f40f Merge from rust-lang/rust 2024-06-20 08:03:36 +03:00
Laurențiu Nicola
35d0bcd89f Preparing for merge from rust-lang/rust 2024-06-20 08:03:11 +03:00
Maria José Solano
b4952b20f4 fix(completion): complete async keyword 2024-06-19 11:12:24 -07:00
fee1-dead
9e8a7a87e4
Rollup merge of #126684 - GuillaumeGomez:migrate-run-make-glibc-staticlib-args, r=Kobzol
Migrate `run-make/glibc-staticlib-args` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-06-19 22:51:06 +08:00
fee1-dead
69e26df5c4
Rollup merge of #126681 - Urgau:rustdoc-deny-doc, r=GuillaumeGomez
Rework doc-test attribute documentation example

This PR change the doc-test attribute documentation example to prefer a more neutral example `deny(dead_code)`, instead of `deny(warnings)`, which is less susceptible to breakage across Rust version.

r? ```@GuillaumeGomez```
2024-06-19 22:51:05 +08:00
panicbit
79b4dec6c4 remove panicbit.cargo extension warning 2024-06-19 15:37:09 +02:00
Guillaume Gomez
0c2bfd913e Migrate run-make/glibc-staticlib-args to rmake.rs 2024-06-19 13:57:55 +02:00