35009 Commits

Author SHA1 Message Date
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
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
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
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
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
bors
bacb2554d8 Auto merge of #142574 - Kobzol:rollup-ldj386u, r=Kobzol
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#141639 (Expose discriminant values in stable_mir)
 - rust-lang/rust#142082 (Refactor `rustc_attr_data_structures` documentation)
 - rust-lang/rust#142125 (Stabilize "file_lock" feature)
 - rust-lang/rust#142236 (Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls)
 - rust-lang/rust#142373 (Fix Debug for Location)
 - rust-lang/rust#142416 (Assorted bootstrap cleanups (step 2))
 - rust-lang/rust#142431 (Add initial version of snapshot tests to bootstrap)
 - rust-lang/rust#142450 (Add documentation on top of `rustc_middle/src/query/mod.rs`)
 - rust-lang/rust#142528 (clarify `rustc_do_not_const_check` comment)
 - rust-lang/rust#142530 (use `if let` guards where possible)
 - rust-lang/rust#142561 (Remove an `njn:` comment accidentaly left behind.)
 - rust-lang/rust#142566 (Fix `-nopt` CI jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-16 14:25:08 +00:00
Jakub Beránek
975e1172f3
Rollup merge of #142566 - Kobzol:ci-nopt-fix, r=jieyouxu
Fix `-nopt` CI jobs

They were using `--config` instead of `--set`, which overrides too much stuff after recent changes to config merging.

Should hopefully unblock https://github.com/rust-lang/rust/pull/142447.

r? `@jieyouxu`
2025-06-16 14:31:15 +02:00
Jakub Beránek
8991dc44f9
Rollup merge of #142561 - nnethercote:fix-njn-comment, r=chenyukang
Remove an `njn:` comment accidentaly left behind.

r? `@chenyukang`
2025-06-16 14:31:14 +02:00
Jakub Beránek
f4f130937e
Rollup merge of #142530 - fee1-dead-contrib:push-klusvwusyqvq, r=compiler-errors
use `if let` guards where possible

these crates already enable the feature
2025-06-16 14:31:14 +02:00
Jakub Beránek
cc6711b9f1
Rollup merge of #142528 - fee1-dead-contrib:push-rlxklunqkwmv, r=RalfJung
clarify `rustc_do_not_const_check` comment

~~Given that we have used this attribute for other reasons before it seems appropriate to make this a "usually".~~

Add function name as a pointer

cc ```@rust-lang/wg-const-eval```
2025-06-16 14:31:13 +02:00
Laurențiu Nicola
e2c3647c6a
Merge pull request #19994 from sourcefrog/book-links
Fix some links in the book
2025-06-16 07:02:59 +00:00
Chayim Refael Friedman
a207299344
Merge pull request #20000 from tadeokondrak/lifetime-repeat-macro
Allow lifetime repeats in macros: $($x)'a*
2025-06-16
2025-06-15 16:34:42 +00:00
Tadeo Kondrak
2070e9a8f3 Use is_any_identifier in pretty_print_macro_expansion 2025-06-15 18:23:18 +02:00
Tadeo Kondrak
12226b704a Fix spacing for LIFETIME_IDENT near keywords and literals in test output 2025-06-15 17:43:45 +02:00
Deadbeef
4ca88ff6a9 clarify rustc_do_not_const_check comment 2025-06-15 20:40:08 +08:00
Lukas Wirth
3d9daeec36
Merge pull request #20009 from Veykril/push-rvnnorzvpnqv
Optimize `pub(crate)` and `pub(self)` visibility resolution
2025-06-15 08:36:27 +00:00
Lukas Wirth
b3768cdc0e Optimize private visibility resolution 2025-06-15 10:25:45 +02:00
Lukas Wirth
e129cdc202 Optimize pub(crate) visibility resolution 2025-06-15 10:25:45 +02:00
Lukas Wirth
d822f6a0ed
Merge pull request #20008 from Veykril/push-rsnkrwyplmwr
More idiomatic salsa use
2025-06-15 08:12:11 +00:00
Lukas Wirth
4b38ea5abd Unify assoc item visibility queries 2025-06-15 10:01:34 +02:00
Lukas Wirth
bceeb6a3c7 Idiomatic salsa use for extern block abi query 2025-06-15 10:01:04 +02:00
Lukas Wirth
4e392f82cb Idiomatic salsa use for impl items query 2025-06-15 09:40:02 +02:00
Lukas Wirth
155ef3de60 Replace unnecessary use of MacroDefId with MacroId 2025-06-15 09:16:45 +02:00
Lukas Wirth
08f795335b
Merge pull request #20007 from Veykril/push-opqzsnwzwyvn
Idiomatic salsa use for enum variants query
2025-06-15 07:15:22 +00:00
Lukas Wirth
aa2d234426 Idiomatic salsa use for enum variants query 2025-06-15 09:03:44 +02:00
Lukas Wirth
188b0667ce
Merge pull request #20006 from Veykril/push-uvmuznvlwsxx
Cleanup incremental tests and verify query executions
2025-06-15 06:25:54 +00:00
Lukas Wirth
f68512af65 Cleanup incremental tests 2025-06-15 08:07:49 +02:00
bors
6da11e1510 Auto merge of #142388 - cjgillot:span-hash, r=davidtwco
Do not clone Arc when hashing span.

Tiny improvement I was when trying to profile span hashing.
2025-06-15 05:27:08 +00:00
Chayim Refael Friedman
4d30c53ceb
Merge pull request #19996 from LHolten/exclude-imports
Add support for excluding imports from symbol search
2025-06-15 00:52:44 +00:00
Lucas Holten
dc85e3ee35 Add config option to exclude imports from symbol search 2025-06-15 02:41:35 +02:00
bors
4854294847 Auto merge of #142335 - nnethercote:rustdoc-json-allocations, r=aDotInTheVoid
rustdoc_json: reduce allocations

These commits reduce the number of allocations done for rustdoc_json, mostly by avoiding unnecessary clones.

Best reviewed one commit at a time.

r? `@aDotInTheVoid`
2025-06-14 23:21:16 +00:00
bors
20dce9d9b8 Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubilee
Simplify implementation of Rust intrinsics by using type parameters in the cache

The current implementation of intrinsics have a lot of duplication to handle different overloads of overloaded LLVM intrinsic. This PR uses the **base name and the type parameters** in the cache instead of the full, overloaded name. This has the benefit that `call_intrinsic` doesn't need to provide the full name, rather the type parameters (which is most of the time more available). This uses `LLVMIntrinsicCopyOverloadedName2` to get the overloaded name from the base name and the type parameters, and only uses it to declare the function.

(originally was part of rust-lang/rust#140763, split off later)

`@rustbot` label A-codegen A-LLVM
r? codegen
2025-06-14 16:43:34 +00:00
bors
bc762e2666 Auto merge of #142129 - shepmaster:mismatched-syntaxes-in-function-like-places, r=jieyouxu
Apply `mismatched-lifetime-syntaxes` to trait and extern functions

r? `@jieyouxu`
2025-06-14 12:37:35 +00:00
Lukas Wirth
fe5a925a74
Merge pull request #19984 from WaffleLapkin/unprefer_align
remove `pref_align_of` intrinsic handling, rename `{min_=>}align_of{,_val}`
2025-06-14 05:13:06 +00:00
Tadeo Kondrak
a7c09532a0 Allow lifetime repeats in macros: $($x)'a*
This works in rustc. This change isn't motivated by any real code.
I just learned about it and decided to see why it doesn't work with
rust-analyzer.
2025-06-13 18:13:01 -06:00
Waffle Lapkin
cfc416a7ba
remove pref_align_of intrinsic handling, rename {min_=>}align_of{,_val} 2025-06-13 21:31:46 +02:00
Lukas Wirth
a497f4114c
Merge pull request #19997 from Veykril/push-xltylvqtpwzx
Remove `InternedCallableDefId`
2025-06-13 15:41:49 +00:00
Lukas Wirth
de34303074
Merge pull request #19995 from Veykril/push-zpyyzqqpywno
Turn `BlockId` into a `#[salsa::tracked]`
2025-06-13 15:41:44 +00:00
Lukas Wirth
133418e3cc Remove InternedCallableDefId
It's unnecessary
2025-06-13 17:30:50 +02:00
Lukas Wirth
8643a858db Turn BlockId into a #[salsa::tracked] 2025-06-13 17:30:04 +02:00
Martin Pool
e3c75abe67 Make the URL a hyperlink 2025-06-13 07:36:51 -07:00