about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-12-08Fix nits and add test for `unnecessary_operation`cocodery-26/+66
2023-12-08cleanup type variable storagelcnr-97/+43
2023-12-08update target feature following LLVM API changeKrasimir Georgiev-3/+7
LLVM commit https://github.com/llvm/llvm-project/commit/e81796671890b59c110f8e41adc7ca26f8484d20 renamed the `unaligned-scalar-mem` target feature to `fast-unaligned-access`.
2023-12-08Auto merge of #15627 - jmintb:sort_imports, r=Veykrilbors-477/+845
feat: Prioritize import suggestions based on the expected type Hi, this is a draft PR to solve #15384. `Adt` types work and now I have a few questions :) 1. What other types make sense in this context? Looking at [ModuleDef](https://github.com/rust-lang/rust-analyzer/blob/05666441bafd6010787a4097a6bd44266ad21018/crates/hir/src/lib.rs#L275) I am thinking everything except Modules. 2. Is there an existing way of converting between `ModeuleDef` and `hir::Type` in the rustanalyzer code base? 3. Does this approach seem sound to you? Ups: Upon writing this I just realised that the enum test is invalided as there are no enum variants and this no variant is passed as a function argument.
2023-12-08CleanupLukas Wirth-550/+516
2023-12-08Auto merge of #16048 - Veykril:concat-bytes-fix, r=Veykrilbors-49/+107
fix: Fix concat_bytes! expansion emitting an identifier Fixes https://github.com/rust-lang/rust-analyzer/issues/16046 (note that this has always been broken)
2023-12-08coverage: Regression test for unwrapping `prev` when there are no spansZalathar-0/+67
2023-12-08coverage: Add `#[track_caller]` to the span generator's unwrap methodsZalathar-14/+12
This should make it easier to investigate unwrap failures in bug reports.
2023-12-08coverage: Simplify the heuristic for ignoring `async fn` return spansZalathar-17/+14
2023-12-08coverage: Use `SpanMarker` to mark the full condition of `if !`Zalathar-12/+17
When MIR is built for an if-not expression, the `!` part of the condition doesn't correspond to any MIR statement, so coverage instrumentation normally can't see it. We can fix that by deliberately injecting a dummy statement whose sole purpose is to associate that span with its enclosing block.
2023-12-08coverage: Use `SpanMarker` to mark `continue` expressions.Zalathar-16/+8
This replaces the previous workaround, which was to inject a dummy `Assign` statement.
2023-12-08coverage: Add `CoverageKind::SpanMarker` for including extra spans in MIRZalathar-3/+36
There are cases where coverage instrumentation wants to show a span for some syntax element, but there is no MIR node that naturally carries that span, so the instrumentor can't see it. MIR building can now use this new kind of coverage statement to deliberately include those spans in MIR, attached to a dummy statement that has no other effect.
2023-12-08coverage: Add a dedicated test for coverage of `if !`Zalathar-0/+114
2023-12-08Implement function type matchingJessie Chatham Spencer-101/+95
2023-12-08WIP - Sort suggested imports by type for data typesJessie Chatham Spencer-10/+418
2023-12-08Auto merge of #15705 - rmehri01:14485_fix_delegate_self_references, r=Veykrilbors-5/+263
fix: resolve Self type references in delegate method assist This PR makes the delegate method assist resolve any `Self` type references in the parameters or return type. It also works across macros such as the `uint_impl!` macro used for `saturating_mul` in the issue example. Closes #14485
2023-12-08fix: prefer keeping Self if it is in the same impl defRyan Mehri-11/+28
2023-12-08fix: preserve where clause in delegate methodRyan Mehri-1/+48
2023-12-08fix: resolve Self type references in delegate method assistRyan Mehri-3/+197
2023-12-08Auto merge of #15486 - petr-tik:n15134_hide_private_from_autocomplete_2, ↵bors-2/+38
r=Veykril fix: Fix item tree lowering pub(self) to pub() Prior to this, the item tree lowered `pub(self)` visibility to `pub()` Fix #15134 - tested with a unit test and a manual end-to-end test of building rust-analyzer from my branch and opening the reproduction repository
2023-12-08fix: Fix item tree lowering pub(self) to pub()Lukas Wirth-31/+28
2023-12-08Stop offering private functions in completionspetr-tik-14/+53
Before Private functions have RawVisibility module, but were missed because take_types returned None early. After resolve_visibility returned None, Visibility::Public was set instead and private functions ended up being offered in autocompletion. Choosing such a function results in an immediate error diagnostic about using a private function. After Pattern match of take_types that returns None and query for Module-level visibility from the original_module Fix #15134 - tested with a unit test and a manual end-to-end test of building rust-analyzer from my branch and opening the reproduction repository REVIEW Refactor to move scope_def_applicable and check function visibility from a module Please let me know what's the best way to add a unit tests to nameres, which is where the root cause was
2023-12-08Auto merge of #15515 - cardoso:flip-binexpr/lhs-binexpr, r=Veykrilbors-1/+30
Check if lhs is also a binexpr and use its rhs in flip binexpr assist Closes #15508 From the original PR, flip binexpr assist is not meant to preserve equivalence, so I went with the simplest solution here. I can add some extra checks to keep equivalence, but I think they should go in different specific assists (eg. flip arith op / flip logic op / etc), otherwise this one will get out of hand pretty quickly.
2023-12-08flip binexpr works for lhs cmpMatheus Cardoso-11/+22
2023-12-08Flip binexpr works for lhs binexprMatheus Cardoso-0/+18
2023-12-08fix: Fix `concat_bytes!` expansionLukas Wirth-7/+61
2023-12-08Extend tidy alphabetical checking to `tests/`.Nicholas Nethercote-0/+1
This is desired for #118702.
2023-12-08Auto merge of #15896 - minestarks:run-quickpick, r=Veykrilbors-57/+94
Show placeholder while run command gets runnables from server This PR fixes a UI annoyance in the VS Code extension when working in large codebases where rust-analyzer can take a few moments to interact with the server. Scenario: 1. Invoke "rust-analyzer: Run" from the command palette or hotkey 2. Quickly start typing to filter the list (or press Enter to accept the last runnable) We often do this quickly from muscle memory without waiting to see the picker. The picker often takes several seconds to come up, causing us to type garbage into the currently open editor. Fix: Show a placeholder item before we call out to the server. ![image](https://github.com/rust-lang/rust-analyzer/assets/16928427/09de6a1c-6f3c-4d29-8031-ba4baeb43282) Selecting this item does nothing so if the user accidentally hits Enter nothing happens. The list is populated and the placeholder dismissed when the actual runnables are retrieved. From here the behavior is the same as before. ![image](https://github.com/rust-lang/rust-analyzer/assets/16928427/837c7dfc-c060-4d68-bbf6-df8aa3101b78)
2023-12-08Make TraitEnvironment's constructor privateLukas Wirth-42/+46
2023-12-08Auto merge of #118668 - fmease:resolve-assoc-item-bindings-by-namespace, ↵bors-416/+598
r=compiler-errors Resolve associated item bindings by namespace This is the 3rd commit split off from #118360 with tests reblessed (they no longer contain duplicated diags which were caused by 4c0addc80af4666f26d7ad51fe34a0e2dd0b8b74) & slightly adapted (removed supertraits from a UI test, cc #118040). > * Resolve all assoc item bindings (type, const, fn (feature `return_type_notation`)) by namespace instead of trying to resolve a type first (in the non-RTN case) and falling back to consts afterwards. This is consistent with RTN. E.g., for `Tr<K = {…}>` we now always try to look up assoc consts (this extends to supertrait bounds). This gets rid of assoc tys shadowing assoc consts in assoc item bindings which is undesirable & inconsistent (types and consts live in different namespaces after all) > * Consolidate the resolution of assoc {ty, const} bindings and RTN (dedup, better diags for RTN) > * Fix assoc consts being labeled as assoc *types* in several diagnostics > * Make a bunch of diagnostics translatable Fixes #112560 (error → pass). As discussed r? `@compiler-errors` --- **Addendum**: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.
2023-12-08temporarily revert "ice on ambguity in mir typeck"Ali MJ Al-Nasrawy-12/+28
Reverts #116530
2023-12-08Auto merge of #118732 - matthiaskrgr:rollup-ub9pgjm, r=matthiaskrgrbors-192/+214
Rollup of 8 pull requests Successful merges: - #118505 (Elaborate on ip_addr bit conversion endianness) - #118581 (OnceLock: Add note about drop and statics) - #118677 ([rustdoc] Fix display of features) - #118690 (coverage: Avoid unnecessary macros in unit tests) - #118693 (Tell MirUsedCollector that the pointer alignment checks calls its panic symbol) - #118695 (coverage: Merge refined spans in a separate final pass) - #118709 (fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before use) - #118722 (rustdoc: remove unused parameter `reversed` from onEach(Lazy)) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-08Auto merge of #3215 - rust-lang:rustup-2023-12-08, r=saethlinbors-2536/+6641
Automatic Rustup
2023-12-08Rollup merge of #118722 - notriddle:notriddle/dom-opt-3, r=GuillaumeGomezMatthias Krüger-19/+6
rustdoc: remove unused parameter `reversed` from onEach(Lazy) This feature was added in edec5807ac5ba90cbc0c61a5ec7b80f29e1eea33 to support JavaScript-based toggles that were later replaced with HTML `<details>`.
2023-12-08Rollup merge of #118709 - oksbsb:fix-job-server, r=SparrowLiiMatthias Krüger-16/+19
fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before use override #118589, resolve merge conflict `@petrochenkov` `@SparrowLii` Thanks!
2023-12-08Rollup merge of #118695 - Zalathar:push-refined, r=davidtwcoMatthias Krüger-50/+37
coverage: Merge refined spans in a separate final pass Pulling this merge step out of `push_refined_span` and into a separate pass lets us push directly to `refined_spans` instead of calling a helper method. Because the compiler can now see partial borrows of `refined_spans`, we can remove some extra code that was jumping through hoops to satisfy the borrow checker. --- ``@rustbot`` label +A-code-coverage
2023-12-08Rollup merge of #118693 - saethlin:alignment-check-symbol-reachable, r=bjorn3Matthias Krüger-0/+3
Tell MirUsedCollector that the pointer alignment checks calls its panic symbol Fixes https://github.com/rust-lang/rust/pull/118683 (not an issue, but that PR is a basically a bug report) When we had `panic_immediate_abort` start adding `#[inline]` to this panic function, builds started breaking because we failed to write up the MIR assert terminator to the correct panic shim. Things happened to work before by pure luck because without this feature enabled, the function we're inserting calls to is `#[inline(never)]` so we always generated code for it. r? bjorn3
2023-12-08Rollup merge of #118690 - Zalathar:test-macros, r=cjgillotMatthias Krüger-80/+33
coverage: Avoid unnecessary macros in unit tests These macros don't provide enough value to justify their complexity, when they can just as easily be functions instead. --- `@rustbot` label +A-code-coverage
2023-12-08Rollup merge of #118677 - GuillaumeGomez:doc_cfg-display, r=notriddleMatthias Krüger-9/+43
[rustdoc] Fix display of features Fixes https://github.com/rust-lang/rust/issues/118615. It now looks like this: ![image](https://github.com/rust-lang/rust/assets/3050060/6e77204e-0706-44a3-89ae-2dbd1934ebbc) We can't use flex without breaking the flow, meaning we can't vertically align items as we want. Because of that, the `min-height` was problematic as it rendered weirdly and therefore needed to be removed. r? `@notriddle`
2023-12-08Rollup merge of #118581 - ianrrees:add-drop-note-to-once_lock, r=workingjubileeMatthias Krüger-14/+25
OnceLock: Add note about drop and statics Hi! Just a minor documentation addition, I've attempted to build docs locally but ran in to issues, so am not 100% sure this change will render correctly.
2023-12-08Rollup merge of #118505 - CLEckhardt:update_ip_addr_bits_docs, r=cuviperMatthias Krüger-4/+48
Elaborate on ip_addr bit conversion endianness Adds explanation of how endianness is handled when converting `Ipv4Addr` and `Ipv6Addr` to and from bits. This is intended to unblock stabilization of the affected methods. Addresses #113744
2023-12-08Auto merge of #118301 - weihanglo:rustfix-doc, r=albertlarsan68bors-5/+4
docs: publish nightly doc for `rustfix` `rustfix `has migrated into rust-lang/cargo in <https://github.com/rust-lang/cargo/issues/13005>. We now can publish nightly doc for it.
2023-12-08Merge from rustcThe Miri Conjob Bot-2535/+6640
2023-12-08Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-12-07recurse into refs when comparing tys for diagnosticsjyn-214/+224
2023-12-08Auto merge of #118725 - lcnr:normalizes-to-projection-split-3, r=BoxyUwUbors-189/+310
split `NormalizesTo` out of `Projection` 3 third attempt at #112658. Rebasing #116262 is very annoying, so I am doing it again from scratch. We should now be able to merge it without regressing anything as we handle occurs check failures involving aliases correctly since #117088. see https://hackmd.io/ktEL8knTSYmtdfrMMnA-Hg fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/1 r? `@compiler-errors`
2023-12-081. fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before useoksbsb-16/+19
2. jobserver::initialize_checked should call before build_session, still should use EarlyErrorHandler, so revert stderr change in #118635
2023-12-07Enable stack probes on aarch64 for LLVM 18Josh Stone-35/+80
2023-12-08update fixmelcnr-4/+3
2023-12-07Add a test to evaluate type intrinsic.Celina G. Val-3/+36