35251 Commits

Author SHA1 Message Date
HKalbasi
dc2e14d5f3
Merge pull request #20035 from joshka/jm/test-explorer-color
Add --color=always to test explorer command
2025-06-20 00:11:57 +00:00
Vincent Esche
90f392108c Add fn parent(self, db) -> GenericDef to hir::TypeParam 2025-06-19 18:04:46 +02:00
bors
60f977bd80 Auto merge of #141864 - Berrysoft:cygwin-path, r=ChrisDenton
Handle win32 separator for cygwin paths

This PR handles a issue that cygwin actually supports Win32 path, so we need to handle the Win32 prefix and separaters.

r? `@mati865`

cc `@jeremyd2019`

~~Not sure if I should handle the prefix like the windows target... Cygwin *does* support win32 paths directly going through the APIs, but I think it's not the recommended way.~~

Here I just use `cygwin_conv_path` because it handles both cygwin and win32 paths correctly and convert them into absolute POSIX paths.

UPDATE: Windows path prefix is handled.
2025-06-19 13:38:37 +00:00
bors
9269c82c63 Auto merge of #142245 - marcoieni:split-gnu-tools, r=Kobzol
ci: split x86_64-gnu-tools job

try-job: x86_64-gnu-tools
try-job: x86_64-gnu-miri
try-job: aarch64-gnu
2025-06-19 10:39:00 +00:00
Lukas Wirth
df50136c23
Merge pull request #20042 from Veykril/push-uosxynulorzn
fix: Temporarily disable `+` typing handler as it moves the cursor position
2025-06-19 06:40:37 +00: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
01f4839113
Merge pull request #20041 from Veykril/push-yxlszoznuyno
Revert "Turn `BlockId` into a `#[salsa::tracked]`"
2025-06-19 05:51:31 +00:00
Lukas Wirth
6301c35cf3 Revert "Turn BlockId into a #[salsa::tracked]"
This reverts commit 8643a858dbaf12b37e90b603cdee64434576c229.
2025-06-19 07:40:01 +02:00
Lukas Wirth
bb1efeb835
Merge pull request #20039 from ShoyuVanilla/let-bind-ref-capt
fix: Closure capturing for let exprs
2025-06-19 04:47:50 +00:00
bors
a11b90f86b Auto merge of #140772 - mati865:gnullvm-host, r=Kobzol
{aarch64,x86_64}-pc-windows-gnullvm: build host tools

This is a temporary single-release workflow to create stage0 for these targets.

I opted for bootstrapping from Linux because that's the easiest host system to work with, but once this hits beta, having dedicated Windows runners would be sensible and probably preferable.

`--enable-full-tools` for whatever reason doesn't seem to work when cross-compiling, because LLVM tools for the new hosts are not copied into the expected directory.

https://github.com/rust-lang/compiler-team/issues/877
2025-06-19 00:21:07 +00:00
Shoyu Vanilla
5f401e3ce6 fix: Closure capturing for let exprs 2025-06-19 01:30:10 +09:00
Josh McKinney
54301d1bd5
Add --color=always to test explorer command
Fixes https://github.com/rust-lang/rust-analyzer/issues/20030
2025-06-18 04:46:58 -07:00
bors
4f9f58361f Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3
Change __rust_no_alloc_shim_is_unstable to be a function

This fixes a long sequence of issues:

1. A customer reported that building for Arm64EC was broken: #138541
2. This was caused by a bug in my original implementation of Arm64EC support, namely that only functions on Arm64EC need to be decorated with `#` but Rust was decorating statics as well.
3. Once I corrected Rust to only decorate functions, I started linking failures where the linker couldn't find statics exported by dylib dependencies. This was caused by the compiler not marking exported statics in the generated DEF file with `DATA`, thus they were being exported as functions not data.
4. Once I corrected the way that the DEF files were being emitted, the linker started failing saying that it couldn't find `__rust_no_alloc_shim_is_unstable`. This is because the MSVC linker requires the declarations of statics imported from other dylibs to be marked with `dllimport` (whereas it will happily link to functions imported from other dylibs whether they are marked `dllimport` or not).
5. I then made a change to ensure that `__rust_no_alloc_shim_is_unstable` was marked as `dllimport`, but the MSVC linker started emitting warnings that `__rust_no_alloc_shim_is_unstable` was marked as `dllimport` but was declared in an obj file. This is a harmless warning which is a performance hint: anything that's marked `dllimport` must be indirected via an `__imp` symbol so I added a linker arg in the target to suppress the warning.
6. A customer then reported a similar warning when using `lld-link` (<https://github.com/rust-lang/rust/pull/140176#issuecomment-2872448443>). I don't think it was an implementation difference between the two linkers but rather that, depending on the obj that the declaration versus uses of `__rust_no_alloc_shim_is_unstable` landed in we would get different warnings, so I suppressed that warning as well: #140954.
7. Another customer reported that they weren't using the Rust compiler to invoke the linker, thus these warnings were breaking their build: <https://github.com/rust-lang/rust/pull/140176#issuecomment-2881867433>. At that point, my original change was reverted (#141024) leaving Arm64EC broken yet again.

Taking a step back, a lot of these linker issues arise from the fact that `__rust_no_alloc_shim_is_unstable` is marked as `extern "Rust"` in the standard library and, therefore, assumed to be a foreign item from a different crate BUT the Rust compiler may choose to generate it either in the current crate, some other crate that will be statically linked in OR some other crate that will by dynamically imported.

Worse yet, it is impossible while building a given crate to know if `__rust_no_alloc_shim_is_unstable` will statically linked or dynamically imported: it might be that one of its dependent crates is the one with an allocator kind set and thus that crate (which is compiled later) will decide depending if it has any dylib dependencies or not to import `__rust_no_alloc_shim_is_unstable` or generate it. Thus, there is no way to know if the declaration of `__rust_no_alloc_shim_is_unstable` should be marked with `dllimport` or not.

There is a simple fix for all this: there is no reason `__rust_no_alloc_shim_is_unstable` must be a static. It needs to be some symbol that must be linked in; thus, it could easily be a function instead. As a function, there is no need to mark it as `dllimport` when dynamically imported which avoids the entire mess above.

There may be a perf hit for changing the `volatile load` to be a `tail call`, so I'm happy to change that part back (although I question what the codegen of a `volatile load` would look like, and if the backend is going to try to use load-acquire semantics).

Build with this change applied BEFORE #140176 was reverted to demonstrate that there are no linking issues with either MSVC or MinGW: <https://github.com/rust-lang/rust/actions/runs/15078657205>

Incidentally, I fixed `tests/run-make/no-alloc-shim` to work with MSVC as I needed it to be able to test locally (FYI for #128602)

r? `@bjorn3`
cc `@jieyouxu`
2025-06-18 09:24:40 +00:00
Laurențiu Nicola
6807f60ccd
Merge pull request #20032 from lnicola/sync-from-rust
minor: Sync from downstream
2025-06-18 07:06:44 +00:00
bors
8b0ab19dae Auto merge of #138165 - jdonszelmann:inline, r=oli-obk
Rewrite `inline` attribute parser to use new infrastructure and improve diagnostics for all parsed attributes

r? `@oli-obk`

This PR:
- creates a new parser for inline attributes
- creates consistent error messages and error codes between attribute parsers; inline and others
- as such changes a few error messages for other attributes to be (in my eyes) much more consistent
- tests ast-lowering lints introduced by rust-lang/rust#138164 since this is now useful for the first time
- Coalesce some useless error codes

Builds on top of rust-lang/rust#138164

Closes rust-lang/rust#137950
2025-06-18 06:25:21 +00:00
Laurențiu Nicola
54fcca7cdd Merge from rust-lang/rust 2025-06-18 09:23:24 +03:00
Laurențiu Nicola
05d286019e Preparing for merge from rust-lang/rust 2025-06-18 09:23:00 +03:00
bors
b4d1f20159 Auto merge of #130887 - Soveu:repeatn, r=scottmcm
Safer implementation of RepeatN

I've seen the "Use MaybeUninit for RepeatN" commit while reading This Week In Rust and immediately thought about something I've written some time ago - https://github.com/Soveu/repeat_finite/blob/master/src/lib.rs.

Using the fact, that `Option` will find niche in `(T, NonZeroUsize)`, we can construct something that has the same size as `(T, usize)` while completely getting rid of `MaybeUninit`.
This leaves only `unsafe` on `TrustedLen`, which is pretty neat.
2025-06-18 03:18:10 +00:00
jnyfah
8818e0140d undo 2025-06-18 02:57:53 +01:00
jnyfah
e417ae2b71 fix format 2025-06-18 02:46:46 +01:00
jnyfah
43638fb0c1 format function 2025-06-18 02:25:33 +01:00
bors
f0a4d181c0 Auto merge of #142644 - jhpratt:rollup-f2jed9t, r=jhpratt
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#141574 (impl `Default` for `array::IntoIter`)
 - rust-lang/rust#141608 (Add support for repetition to `proc_macro::quote`)
 - rust-lang/rust#142100 (rustdoc: make srcIndex no longer a global variable)
 - rust-lang/rust#142371 (avoid `&mut P<T>` in `visit_expr` etc methods)
 - rust-lang/rust#142517 (Windows: Use anonymous pipes in Command)
 - rust-lang/rust#142520 (alloc: less static mut + some cleanup)
 - rust-lang/rust#142588 (Generic ctx imprv)
 - rust-lang/rust#142605 (Don't unwrap in enzyme builds in case of missing llvm-config)
 - rust-lang/rust#142608 (Refresh module-level docs for `rustc_target::spec`)
 - rust-lang/rust#142618 (Lint about `console` calls in rustdoc JS)
 - rust-lang/rust#142620 (Remove a panicking branch in `BorrowedCursor::advance`)
 - rust-lang/rust#142631 (Dont suggest remove semi inside macro expansion for redundant semi lint)
 - rust-lang/rust#142632 (Update cargo)
 - rust-lang/rust#142635 (Temporarily add back -Zwasm-c-abi=spec)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-18 00:17:48 +00:00
Jacob Pratt
4cfd658a6c
Rollup merge of #142618 - GuillaumeGomez:eslint-no-console, r=lolbinarycat
Lint about `console` calls in rustdoc JS

As discussed [here](https://github.com/rust-lang/rust/pull/142100#discussion_r2151764395), this PR enforces that `console` is not used in rustdoc JS by default.

cc `@lolbinarycat`
2025-06-17 23:19:38 +02:00
Jacob Pratt
db52a345ff
Rollup merge of #142588 - ZuseZ4:generic-ctx-imprv, r=oli-obk
Generic ctx imprv

Cleanup work for my gpu pr

r? `@oli-obk`
2025-06-17 23:19:36 +02:00
Jacob Pratt
7581d85b6f
Rollup merge of #142520 - hkBst:less-static-mut, r=tgross35
alloc: less static mut + some cleanup

I'm looking into https://github.com/rust-lang/rust/issues/125035 and would like some feedback on my approach.
2025-06-17 23:19:35 +02:00
Jacob Pratt
c09199703b
Rollup merge of #142517 - ChrisDenton:anon-pipe, r=Mark-Simulacrum
Windows: Use anonymous pipes in Command

When setting `Stdio::pipe` on `Command` we want to create an anonymous pipe that can be used asynchronously (at least on our end). Usually we'd use [`CreatePipe`](https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe) to open anonymous pipes but unfortunately it opens pipes for synchronous access. The alternative is to use [`CreateNamedPipeW`](https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createnamedpipew) which does allow asynchronous access but that requires giving a file name to the pipe. So we currently have this awful hack where we attempt to emulate anonymous pipes using `CreateNamedPipeW` by attempting to create a unique name and looping until we find one that doesn't already exist.

The better option is to use the lower level [`NtCreateNamedPipeFile`](https://learn.microsoft.com/en-us/windows/win32/devnotes/nt-create-named-pipe-file) (which is used internally by both `CreatePipe` and `CreateNamedPipeW`). This function wasn't documented until a few years ago but now that it is it's ok for us to use it.

try-job: *msvc*
try-job: *mingw*
2025-06-17 23:19:34 +02:00
Jacob Pratt
e84c22501b
Rollup merge of #142371 - fee1-dead-contrib:push-xqlkumzurkus, r=petrochenkov
avoid `&mut P<T>` in `visit_expr` etc methods

trying a different way than rust-lang/rust#141636
r? ghost
2025-06-17 23:19:34 +02:00
Jacob Pratt
8b318c3fe0
Rollup merge of #141608 - moatom:proc_macro-140238, r=dtolnay
Add support for repetition to `proc_macro::quote`

Progress toward: rust-lang/rust#140238
2025-06-17 23:19:32 +02:00
Jacob Pratt
920d4e83cc
Rollup merge of #141574 - fee1-dead-contrib:push-owzulzmzszzx, r=jhpratt
impl `Default` for `array::IntoIter`

cc rust-lang/rust#91583

my personal use of this feature comes from 092db5df63/src/cont.rs (L154-L170)

insta-stable, but I feel like this is small enough to _not_ require an ACP (but a FCP per https://forge.rust-lang.org/libs/maintaining-std.html#when-theres-new-trait-impls)? feel free to correct me if I am wrong.
2025-06-17 23:19:31 +02:00
bors
01ccbcf4a8 Auto merge of #142567 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-06-17 21:13:37 +00:00
Laurențiu Nicola
10ebd0e3c9 Try to downgrade object 2025-06-17 19:00:01 +03:00
Laurențiu Nicola
5d93e31067
Merge pull request #20025 from SoxPopuli/hide_private_imports_without_pe
Hide imported privates if private editable is disabled
2025-06-17 15:27:27 +00:00
bors
50a90e2920 Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
Sized Hierarchy: Part I

This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library, `MetaSized` and `PointeeSized`. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract.

These traits are unstable (as is their constness), so users cannot refer to them without opting-in to `feature(sized_hierarchy)`. These traits are not behind `cfg`s as this would make implementation unfeasible, there would simply be too many `cfg`s required to add the necessary bounds everywhere. So, like `Sized`, these traits are automatically implemented by the compiler.

RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows:

- `?Sized` is rewritten as `MetaSized`
- `MetaSized` is added as a default supertrait for all traits w/out an explicit sizedness supertrait already.

There are no edition migrations implemented in this,  as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing `?Sized` even if the compiler sees `MetaSized`) unless the `sized_hierarchy` feature is enabled.

Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax `Deref::Target` (this will be investigated separately).

It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output.

**Notes:**

- Any commits starting with "upstream:" can be ignored, as these correspond to other upstream PRs that this is based on which have yet to be merged.
- This best reviewed commit-by-commit. I've attempted to make the implementation easy to follow and keep similar changes and test output updates together.
  - Each commit has a short description describing its purpose.
  - This patch is large but it's primarily in the test suite.
- I've worked on the performance of this patch and a few optimisations are implemented so that the performance impact is neutral-to-minor.
- `PointeeSized` is a different name from the RFC just to make it more obvious that it is different from `std::ptr::Pointee` but all the names are yet to be bikeshed anyway.
- `@nikomatsakis` has confirmed [that this can proceed as an experiment from the t-lang side](https://rust-lang.zulipchat.com/#narrow/channel/435869-project-goals/topic/SVE.20and.20SME.20on.20AArch64.20.28goals.23270.29/near/506196491)
- FCP in https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485

Fixes rust-lang/rust#79409.

r? `@ghost` (I'll discuss this with relevant teams to find a reviewer)
2025-06-17 15:08:50 +00:00
Charlotte Smith
e6a4602209 Hide imported privates if private editable is disabled 2025-06-17 15:38:15 +01:00
Lukas Wirth
3bf8a77d13
Merge pull request #20023 from Veykril/push-vkqlnyttnqzl
Improve completions in if / while expression conditions
2025-06-17 12:01:43 +00:00
Lukas Wirth
7447db83ed Better completion test sorting 2025-06-17 13:50:58 +02:00
Lukas Wirth
4331688e3d Improve completions in if / while expression conditions 2025-06-17 13:50:58 +02:00
Lukas Wirth
630628f3c8
Merge pull request #20022 from ChayimFriedman2/type-mismatch-exp
fix: Never make type mismatch diagnostic stable, even when there is a fix
2025-06-17 09:59:50 +00:00
Chayim Refael Friedman
b46593ece2 Never make type mismatch diagnostic stable, even when there is a fix
We show fixes now even for experimental diagnostics anyway, and it has false positives.
2025-06-17 12:48:19 +03:00
Lukas Wirth
2b0c726e1b
Merge pull request #20020 from Veykril/push-yuqmorzsqumw
fix: Reload workspaces when cargo configs change
2025-06-17 09:24:13 +00:00
Lukas Wirth
24b0666d93 fix: Reload workspaces when cargo configs change 2025-06-17 11:13:56 +02:00
Lukas Wirth
c6b74f7e6f
Merge pull request #19495 from Veykril/push-woywmrxrtqqy
chore: Start infesting ide crates with 'db lifetime
2025-06-17 08:53:11 +00:00
Lukas Wirth
03f1003637 chore: Start infesting ide crates with 'db lifetime 2025-06-17 10:42:38 +02:00
Lukas Wirth
a31e10a2fd
Merge pull request #20018 from Veykril/push-pkowrtoturkr
fix: Copy lockfiles into target directory before invoking `cargo metadata`
2025-06-17 08:20:20 +00: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
eb25f5e85b
Merge pull request #19945 from ChayimFriedman2/private-field-quickfix
feat: Add the quickfix for increasing visibility of a private field to the private-field diagnostic (previously it was only on no-such-field)
2025-06-17 08:19:09 +00:00
Lukas Wirth
c0f428d55b fix: Copy lockfiles into target directory before invoking cargo metadata 2025-06-17 10:09:04 +02:00
bors
dae444f3ce Auto merge of #142447 - dianqk:llvm-20.1.7, r=nikic
Update to LLVM 20.1.7

Closes rust-lang/rust#141306, closes rust-lang/rust#140686, closes rust-lang/rust#141737, closes rust-lang/rust#140933.
2025-06-16 22:33:38 +00:00
Lukas Wirth
2c25e436c7
Merge pull request #20015 from Veykril/push-wsxzsuurqwwr
feat: Insert required parentheses when typing `+` in dyn trait type
2025-06-16 17:13:16 +00:00
Lukas Wirth
b1824c3962 feat: Insert required parentheses when typing + in trait type 2025-06-16 19:02:18 +02:00