about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-09-25Add missing rustc_privateLaurențiu Nicola-0/+7
2024-09-25Auto merge of #18183 - lnicola:sync-from-rust, r=lnicolabors-56/+76
internal: Sync from downstream
2024-09-25Run rustfmtLaurențiu Nicola-3/+1
2024-09-25Pass all-targets for build scripts in more cli commandsLukas Wirth-12/+30
Without this, build scripts don't run for tests and as such any proc-macros in dev-deps fail to resolve
2024-09-25Add more LayoutError variantsLaurențiu Nicola-3/+8
2024-09-25Bump rustc cratesLaurențiu Nicola-17/+17
2024-09-25Merge from rust-lang/rustLaurențiu Nicola-38/+55
2024-09-25Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2024-09-24Auto merge of #18164 - ShoyuVanilla:use-as-alias, r=Veykrilbors-13/+97
fix: Temporary fix for `remove_unused_imports` not handling import aliases correctly Fixes #18129
2024-09-24fix: Temporary fix for `remove_unused_imports` not handling import aliases ↵Shoyu Vanilla-13/+97
correctly
2024-09-24Auto merge of #18166 - ChayimFriedman2:dollar-crate-root, r=Veykrilbors-5/+33
fix: Fix a bug in span map merge, and add explanations of how span maps are stored Because it took me hours to figure out that contrary to common sense, the offset stored is the *end* of the node, and we search by the *start*. Which is why we need a convoluted `partition_point()` instead of a simple `binary_search()`. And this was not documented at all. Which made me make mistakes with my implementation of `SpanMap::merge()`. The other bug fixed about span map merging is correctly keeping track of the current offset in presence of multiple sibling macro invocations. Unrelated, but because of the previous issue it took me hours to debug, so I figured out I'll put them together for posterity. Fixes #18163.
2024-09-24Auto merge of #18161 - ChayimFriedman2:postfix-mut, r=Veykrilbors-1/+52
fix: Better support references in consuming postfix completions Fixes #18155.
2024-09-24Auto merge of #18160 - ChayimFriedman2:fix-18138, r=Veykrilbors-13/+82
fix: Fix name resolution when an import is resolved to some namespace and then later in the algorithm another namespace is added The import is flagged as "indeterminate", and previously it was re-resolved, but only at the end of name resolution, when it's already too late for anything that depends on it. This issue was tried to fix in https://github.com/rust-lang/rust-analyzer/pull/2466, but it was not fixed fully. That PR is also why IDE features did work: the import at the end was resolved correctly, so IDE features that re-resolved the macro path resolved it correctly. I was concerned about the performance of this, but this doesn't seem to regress `analysis-stats .`, so I guess it's fine to land this. I have no idea about the incremental perf however and I don't know how to measure that, although when typing in `zbus` (including creating a new function, which should recompute the def map) completion was fast enough. I didn't check what rustc does, so maybe it does something more performant, like keeping track of only possibly problematic imports. Fixes #18138. Probably fixes #17630.
2024-09-24Auto merge of #18157 - ↵bors-1/+5
davidbarsky:davidbarsky/respect-disabling-proc-macros-in-analysis-stats, r=Veykril analysis-stats: respect `--disable-proc-macros` flag I noticed that this flag wasn't being respected by `analysis-stats` when profiling proc macro expansion, so here's a small fix.
2024-09-24Auto merge of #18123 - jhgg:fix-ambigius-package-cargo-check, r=Veykrilbors-1/+1
fix: fix ambigious package name in flycheck fixes #18121
2024-09-24Auto merge of #18175 - Wilfred:completion_marker, r=Veykrilbors-1/+1
internal: Make COMPLETION_MARKER more explicitly r-a If a user ever sees the completion marker, it's confusing to see text about IntelliJ. Use a string that's more explicitly about completion for rust-analyzer.
2024-09-24Auto merge of #18162 - ChayimFriedman2:gat-object-safe, r=Veykrilbors-1/+14
fix: Consider lifetime GATs object unsafe Fixes #18156.
2024-09-23internal: Make COMPLETION_MARKER more explicitly r-aWilfred Hughes-1/+1
If a user ever sees the completion marker, it's confusing to see text about IntelliJ. Use a string that's more explicitly about completion for rust-analyzer.
2024-09-23Support expect in attribute completion and hoverLaurențiu Nicola-5/+52
2024-09-23Revert "internal: Disable GitHub releases for now"Laurențiu Nicola-6/+6
2024-09-23Disable GitHub releases for nowLaurențiu Nicola-6/+6
2024-09-23Fix a bug in span map merge, and add explanations of how span maps are storedChayim Refael Friedman-5/+33
Because it took me hours to figure out that contrary to common sense, the offset stored is the *end* of the node, and we search by the *start*. Which is why we need a convoluted `partition_point()` instead of a simple `binary_search()`. And this was not documented at all. Which made me make mistakes with my implementation of `SpanMap::merge()`. The other bug fixed about span map merging is correctly keeping track of the current offset in presence of multiple sibling macro invocations. Unrelated, but because of the previous issue it took me hours to debug, so I figured out I'll put them together for posterity.
2024-09-22Consider lifetime GATs object unsafeChayim Refael Friedman-1/+14
2024-09-22Include dereferences in consuming postfix completions (e.g. `call`)Chayim Refael Friedman-0/+31
2024-09-22Properly account for mutable references when postfix-completing consuming ↵Chayim Refael Friedman-1/+21
completions (e.g. `call`)
2024-09-22Fix name resolution when an import is resolved to some namespace and then ↵Chayim Refael Friedman-13/+82
later in the algorithm another namespace is added The import is flagged as "indeterminate", and previously it was re-resolved, but only at the end of name resolution, when it's already too late for anything that depends on it. This issue was tried to fix in https://github.com/rust-lang/rust-analyzer/pull/2466, but it was not fixed fully.
2024-09-21add `C-cmse-nonsecure-entry` ABIFolkert de Vries-0/+5
2024-09-20analysis-stats: respect --disable-proc-macros flagDavid Barsky-1/+5
2024-09-20Auto merge of #18132 - ChayimFriedman2:fix-closure-semi, r=Veykrilbors-32/+100
fix: Don't complete `;` when in closure return expression Completing it will break syntax. Fixes #18130.
2024-09-20Auto merge of #18151 - ChayimFriedman2:metavar-concat, r=Veykrilbors-5/+304
feat: Support the `${concat(...)}` metavariable expression I didn't follow rustc precisely, because I think it does some things wrongly (or they are FIXME), but I only allowed more code, not less. So we're all fine. Closes #18145.
2024-09-20Auto merge of #18108 - ChayimFriedman2:lint-level-cfg, r=Veykrilbors-16/+120
fix: Handle lint attributes that are under `#[cfg_attr]` I forgot `cfg_attr` while working on #18099. Although the original code also didn't handle that (although case lints specifically were correct, by virtue of using hir attrs).
2024-09-19When checking for forbidden expr kind matches, account for rawnessChayim Refael Friedman-1/+25
An expression starting with `r#const` etc. should be accepted even in edition <=2021.
2024-09-19Handle lint attributes that are under `#[cfg_attr]`Chayim Refael Friedman-16/+120
2024-09-19Support the `${concat(...)}` metavariable expressionChayim Refael Friedman-5/+304
I didn't follow rustc precisely, because I think it does some things wrongly (or they are FIXME), but I only allowed more code, not less. So we're all fine.
2024-09-19Auto merge of #18146 - ChayimFriedman2:allow-comment, r=Veykrilbors-6/+24
fix: Remove check that text of `parse_expr_from_str()` matches the produced parsed tree This check is incorrect when we have comments and whitespace in the text. We can strip comments, but then we still have whitespace, which we cannot strip without changing meaning for the parser. So instead I opt to remove the check, and wrap the expression in parentheses (asserting what produced is a parenthesized expression) to strengthen verification. Fixes #18144.
2024-09-19Remove check that text of `parse_expr_from_str()` matches the produced ↵Chayim Refael Friedman-6/+24
parsed tree This check is incorrect when we have comments and whitespace in the text. We can strip comments, but then we still have whitespace, which we cannot strip without changing meaning for the parser. So instead I opt to remove the check, and wrap the expression in parentheses (asserting what produced is a parenthesized expression) to strengthen verification.
2024-09-18Auto merge of #18131 - ChayimFriedman2:macro-expand-dollar-crate, r=Veykrilbors-64/+396
fix: Get rid of `$crate` in expansions shown to the user Be it "Expand Macro Recursively", "Inline macro" or few other things. We replace it with the crate name, as should've always been. Probably fixes some issues, but I don't know what they are.
2024-09-18Auto merge of #18139 - ShoyuVanilla:issue-18109, r=Veykrilbors-4/+81
fix: Extend `type_variable_table` when modifying index is larger than the table size Fixes #18109 Whenever we create an inference variable in r-a, we extend `type_variable_table` to matching size here; https://github.com/rust-lang/rust-analyzer/blob/f4aca78c92e03354327c8f6c7fefaef9f45ab166/crates/hir-ty/src/infer/unify.rs#L378-L381 But sometimes, an inference variable is [created from chalk](https://github.com/rust-lang/chalk/blob/ab710e0c9b455403b138ef72a2fb90967a58eff3/chalk-solve/src/infer/unify.rs#L743) and passed to r-a as a type of an expression or a pattern. If r-a set diverging flag to this before the table is extended to a sufficient size, it panics here; https://github.com/rust-lang/rust-analyzer/blob/f4aca78c92e03354327c8f6c7fefaef9f45ab166/crates/hir-ty/src/infer/unify.rs#L275-L277 I think that extending table when setting diverging flag is reasonable becase we are already doing such extending to a size that covers the inference vars created from chalk and this change only covers the order-dependent random cases that this might fail
2024-09-18Get rid of `$crate` in expansions shown to the userChayim Refael Friedman-64/+396
Be it "Expand Macro Recursively", "Inline macro" or few other things. We replace it with the crate name, as should've always been.
2024-09-19fix: Extend `type_variable_table` when modifying index is larger than table sizeShoyu Vanilla-4/+81
2024-09-18Extract logic to decide how to complete semicolon for unit-returning ↵Chayim Refael Friedman-39/+73
function into `CompletionContext` So that we don't recompute it for every item.
2024-09-18Don't complete `;` when in closure return expressionChayim Refael Friedman-24/+58
Completing it will break syntax.
2024-09-18Auto merge of #18117 - ChayimFriedman2:issue-18089, r=Veykrilbors-48/+166
fix: Always cache macro expansions' root node in Semantics Previously some expansions were not cached, but were cached in the expansion cache, which caused panics when later queries tried to lookup the node from the expansion cache. Fixes #18089.
2024-09-18Auto merge of #18128 - ChayimFriedman2:external-macros-lint, r=Veykrilbors-1/+62
fix: Handle errors and lints from external macros Some lints should not be reported if they originate from an external macro, and quickfixes should be disabled (or they'll change library code). Fixes #18122. Closes #18124.
2024-09-18Auto merge of #18136 - valadaptive:no-mangle-lints, r=Veykrilbors-6/+73
Don't lint names of #[no_mangle] extern fns [Rust doesn't run the `non_snake_case_name` lint on `extern fn`s with the `#[no_mangle]` attribute](https://github.com/rust-lang/rust/pull/44966). The conditions are: - The function must be `extern` and have a `#[no_mangle]` attribute. - The function's ABI must not be explicitly set to "Rust". This PR replicates that logic here.
2024-09-18Auto merge of #18135 - ChayimFriedman2:unsafe-op-in-unsafe-fn, r=Veykrilbors-10/+55
feat: Add diagnostics for `unsafe_op_in_unsafe_fn` Turns out it's pretty easy, but I did have to add support for allowed-by-default lints.
2024-09-18Auto merge of #18137 - ShoyuVanilla:expr-2021, r=Veykrilbors-21/+192
feat: Implement `expr_2021` Resolves #18062
2024-09-18feat: Implement `expr_2021`Shoyu Vanilla-21/+192
2024-09-18Don't lint names of #[no_mangle] extern fnsvaladaptive-6/+73
2024-09-18Add diagnostics for `unsafe_op_in_unsafe_fn`Chayim Refael Friedman-10/+55
Turns out it's pretty easy, but I did have to add support for allowed-by-default lints.