Commit graph

32169 commits

Author SHA1 Message Date
Lukas Wirth
fd17fa10a2 Add text edit to binding mode hints 2024-10-23 09:52:03 +02:00
Lukas Wirth
f086fa9c02 Add text edit to adjustment hints 2024-10-23 09:30:36 +02:00
bors
1c7e595bb5 Auto merge of #131929 - LaihoE:replace_default_capacity, r=joboet
better default capacity for str::replace

Adds smarter capacity for str::replace in cases where we know that the output will be at least as long as the original string.
2024-10-23 01:03:48 +00:00
bors
88132c40b3 Auto merge of #131871 - RalfJung:x86-32-float, r=workingjubilee
x86-32 float return for 'Rust' ABI: treat all float types consistently

This helps with https://github.com/rust-lang/rust/issues/131819: for our own ABI on x86-32, we want to *never* use the float registers. The previous logic only considered F32 and F64, but skipped F16 and F128. So I made the logic just apply to all float types.

try-job: i686-gnu
try-job: i686-gnu-nopt
2024-10-22 22:36:59 +00:00
Chayim Refael Friedman
4ac3dc1a2f Correctly resolve variables and labels from before macro definition in macro expansion
E.g.:
```rust
let v;
macro_rules! m { () => { v }; }
```

This was an existing bug, but it was less severe because unless the variable was shadowed it would be correctly resolved. With hygiene however, without this fix the variable is never resolved.
2024-10-22 21:49:17 +03:00
Chayim Refael Friedman
8adcbdcc49 Implement semitransparent hygiene
Or macro_rules hygiene, or mixed site hygiene. In other words, hygiene for variables and labels but not items.

The realization that made me implement this was that while "full" hygiene (aka. def site hygiene) is really hard for us to implement, and will likely involve intrusive changes and performance losses, since every `Name` will have to carry hygiene, mixed site hygiene is very local: it applies only to bodies, and we very well can save it in a side map with minor losses.

This fixes one diagnostic in r-a that was about `izip!()` using hygiene (yay!) but it introduces a huge number of others, because of #18262. Up until now this issue wasn't a major problem because it only affected few cases, but with hygiene identifiers referred by macros like that are not resolved at all. The next commit will fix that.
2024-10-22 21:26:56 +03:00
Lukas Wirth
c286786888
Merge pull request #18254 from ChayimFriedman2/fix-mut
fix: Nail destructuring assignment once and for all
2024-10-22 17:40:52 +00:00
Chayim Refael Friedman
0beec9081d Add test for tuple struct destructuring assignment where the path comes from a macro 2024-10-22 20:27:09 +03:00
David Kurilla
0719432903 docs: remove unnecessary prerequisites setup.md 2024-10-22 08:48:09 -07:00
Lukas Wirth
b35d93c471
Merge pull request #18373 from Veykril/veykril/push-mzumrrvynxqu
internal: Merge separate inlay hints targeting same range
2024-10-22 15:28:28 +00:00
Lukas Wirth
3ae93bcb82 Merge binding_mode inlay hints into one 2024-10-22 17:12:16 +02:00
Lukas Wirth
db60fb42bb Merge adjustment inlay hints into one 2024-10-22 16:56:13 +02:00
Lukas Wirth
13acfbfae4 Merge closure capture inlay hints into one 2024-10-22 16:29:15 +02:00
Marco Ieni
1b00f0857b
Merge pull request #18372 from Kobzol/ci-merge-queue
Switch CI from bors to merge queues
2024-10-22 12:57:57 +00:00
bors
d509449d7e Auto merge of #18370 - duncpro:goto-def-ranges, r=Veykril
feat: resolve range patterns to their structs

Closes #18367
2024-10-22 12:24:25 +00:00
bors
4c4f186e23 Auto merge of #18368 - Veykril:test-lsif_contains_generated_macros, r=lnicola
tests: Add `lsif_contains_generated_constant` test

Closes https://github.com/rust-lang/rust-analyzer/pull/18309
2024-10-22 12:10:07 +00:00
Jakub Beránek
373ff60d38 Switch CI from bors to merge queues 2024-10-22 14:04:24 +02:00
bors
eddab6e98c Auto merge of #18349 - dqkqd:issue-18344, r=Veykril
feat: render docs from aliased type when type has no docs

Trying to close #18344

- [x] ~Find the docs by traversing upwards if the type itself has none but aliasing for another type that might have.~
- [x] Show docs from aliased type.
- [x] Showing description that we are displaying documentation for different definition in hover box.

![image](https://github.com/user-attachments/assets/820d6f97-aa2c-4dc4-8a25-75746e32d950)
2024-10-22 11:56:16 +00:00
bors
c58427ff94 Auto merge of #18371 - Veykril:veykril/push-kwttrusywysp, r=Veykril
fix: Fix incorrect parsing of use bounds

Fixes https://github.com/rust-lang/rust-analyzer/issues/18357
2024-10-22 11:42:11 +00:00
Lukas Wirth
95298a2e61 fix: Fix incorrect parsing of use bounds
Also lower them a bit more
2024-10-22 13:34:26 +02:00
Khanh Duong Quoc
44e48d75dd
feat: render docs from aliased type when docs are missing 2024-10-22 20:27:05 +09:00
bors
6158f03866 Auto merge of #131321 - RalfJung:feature-activation, r=nnethercote
terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it)

Mostly, we currently call a feature that has a corresponding `#[feature(name)]` attribute in the current crate a "declared" feature. I think that is confusing as it does not align with what "declaring" usually means. Furthermore, we *also* refer to `#[stable]`/`#[unstable]` as *declaring* a feature (e.g. in [these diagnostics](f25e5abea2/compiler/rustc_passes/messages.ftl (L297-L301))), which aligns better with what "declaring" usually means. To make things worse, the functions  `tcx.features().active(...)` and  `tcx.features().declared(...)` both exist and they are doing almost the same thing (testing whether a corresponding `#[feature(name)]`  exists) except that `active` would ICE if the feature is not an unstable lang feature. On top of this, the callback when a feature is activated/declared is called `set_enabled`, and many comments also talk about "enabling" a feature.

So really, our terminology is just a mess.

I would suggest we use "declaring a feature" for saying that something is/was guarded by a feature (e.g. `#[stable]`/`#[unstable]`), and "enabling a feature" for  `#[feature(name)]`. This PR implements that.
2024-10-22 11:02:35 +00:00
Duncan Proctor
4fd471c571 tidy 2024-10-22 06:54:44 -04:00
Duncan Proctor
2e0fae3579 tidy 2024-10-22 06:37:12 -04:00
Duncan Proctor
c679551d6b remove duplicate test 2024-10-22 06:25:13 -04:00
Duncan Proctor
271f64f94d resolve range patterns to the their struct types 2024-10-22 06:20:16 -04:00
bors
4fcd31ede4 Auto merge of #18366 - Veykril:veykril/push-uvwvwzxnkmnz, r=Veykril
Fix status bar message not being marked markdown

Closes https://github.com/rust-lang/rust-analyzer/pull/18323
2024-10-22 09:50:00 +00:00
Lukas Wirth
6c23f25e7f Fix new nightly lints 2024-10-22 11:48:41 +02:00
Johann Hemmann
505c9c9fb3 tests: Add lsif_contains_generated_constant test 2024-10-22 11:38:54 +02:00
Lukas Wirth
232432411e Cleanup file structure proto handling 2024-10-22 10:51:08 +02:00
Lukas Wirth
82141705b0 Fix status bar messagen not being marked markdown 2024-10-22 10:51:04 +02:00
bors
9f433d224c Auto merge of #132030 - matthiaskrgr:rollup-1g6quh0, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #131918 (coverage: Make counter creation handle node/edge counters more uniformly)
 - #132021 (nuttx.md: typo)
 - #132029 (Subtree update of `rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-22 08:34:18 +00:00
Matthias Krüger
81d6960f76
Rollup merge of #132029 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-10-22 10:08:47 +02:00
Matthias Krüger
9ee8f5a3a4
Rollup merge of #131918 - Zalathar:counters, r=nnethercote
coverage: Make counter creation handle node/edge counters more uniformly

Similar to #130380, this is another round of small improvements informed by my ongoing attempts to overhaul coverage counter creation.

One of the big benefits is getting rid of the awkward special-case that would sometimes attach an edge counter to a node instead. That was needed by the code that chooses which out-edge should be given a counter expression, but we can avoid that by making the corresponding check a little smarter.

I've also renamed several things to be simpler and more consistent, which should help with future changes.
2024-10-22 10:08:46 +02:00
bors
17055aaca9 Auto merge of #18362 - duncpro:goto-def-ranges, r=Veykril
feat: goto definition on range operators

Closes #18342
2024-10-22 07:49:18 +00:00
bors
733878862a Auto merge of #18364 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2024-10-22 07:21:22 +00:00
Duncan Proctor
2f6923b844 tidy 2024-10-22 03:19:47 -04:00
Laurențiu Nicola
a32039278f Replace some LayoutError variants with the rustc_abi errors 2024-10-22 10:19:25 +03:00
Laurențiu Nicola
8d479d099b Bump rustc crates 2024-10-22 10:12:46 +03:00
Laurențiu Nicola
250bf98d58 Merge from rust-lang/rust 2024-10-22 10:12:22 +03:00
Laurențiu Nicola
e5d5b6cc91 Preparing for merge from rust-lang/rust 2024-10-22 10:12:20 +03:00
Duncan Proctor
f54a863965 goto definition on RangeFrom, RangeFull, RangeTo, and RangeToInclusive links to respective struct 2024-10-22 03:11:23 -04:00
duncanproctor
c7a8be110d Move explicit range handling out of goto_definition, use OperatorClass instead 2024-10-21 20:07:07 -04:00
bors
8c3495ac01 Auto merge of #131840 - compiler-errors:impossible-maybe, r=lcnr
Dont consider predicates that may hold as impossible in `is_impossible_associated_item`

Use infer vars to account for ambiguities when considering if methods are impossible to instantiate for a given self type. Also while we're at it, let's use the new trait solver instead of `evaluate` since this is used in rustdoc.

r? lcnr
Fixes #131839
2024-10-21 22:58:44 +00:00
bors
75f455c84a Auto merge of #131570 - ehuss:update-xcode, r=Mark-Simulacrum
(ci) Update macOS Xcode to 15

This updates the macOS builders to Xcode 15. The aarch64 images will be removing Xcode 14 and 16 very soon (https://github.com/actions/runner-images/issues/10703), so we will need to make the switch to continue operating. The linked issue also documents GitHub's new policy for how they will be updating Xcode in the future. Also worth being aware of is the future plans for x86 runners documented in https://github.com/actions/runner-images/issues/9255 and https://github.com/actions/runner-images/issues/10686, which will impact our future upgrade behaviors.

I decided to also update the Xcode in the x86_64 runners, even though they are not being removed. It felt better to me to have all macOS runners on the same (major) version of Xcode. However, note that the x86_64 runners do not have the latest version of 15 (15.4), so I left them at 15.2 (which is currently the default Xcode of the runner).

Xcode 15 was previously causing problems (see #121058) which seem to be resolved now. `@bjorn3` fixed the `invalid r_symbolnum` issue with cranelift. The issue with clang failing to link seems to be fixed, possibly by the update of the pre-built LLVM from 14 to llvm 15 in https://github.com/rust-lang/rust/pull/124850, or an update in our source version of LLVM. I have run some try builds and at least LLVM seems to build (I did not run any tests).

Closes #121058
2024-10-21 20:19:06 +00:00
bors
de2ff17bc5 Auto merge of #18360 - roife:safe-kw-3, r=Veykril
feat: better completions for extern blcoks

This PR refactors `add_keywords` (making it much clearer!) and enhances completion for `extern` blocks.

It is recommended to reviewing the changes in order of the commits:

- The first commit (f3c4dde0a4) doesn’t change any logic but refactors parts of the `add_keywords` function and adds detailed comments.
- The second commit (5dcc1ab649) improves completion for `extern` kw and extern blocks.
2024-10-21 17:59:05 +00:00
roife
cf3544a0ec minor: refactor completions in item_list 2024-10-22 01:31:57 +08:00
duncanproctor
3bc6e27993 GotoDefinition on a Range or InclusiveRange operator will link to the struct definition 2024-10-21 11:29:05 -04:00
bors
487152b90f Auto merge of #18361 - Veykril:veykril/push-uzsokssoyznx, r=Veykril
fix: Fix token downmapping failing for include! inputs

Supercedes https://github.com/rust-lang/rust-analyzer/pull/18325

Fixes https://github.com/rust-lang/rust-analyzer/pull/18325
Fixes https://github.com/rust-lang/rust-analyzer/issues/18313
Fixes https://github.com/rust-lang/rust-analyzer/issues/18314
2024-10-21 15:27:42 +00:00
Lukas Wirth
d878b8caad fix: Fix token downmapping failing for include! inputs 2024-10-21 17:22:18 +02:00