Commit graph

284993 commits

Author SHA1 Message Date
León Orell Valerian Liehr
9f336ce2eb
Remove now unreachable parse recovery code
StructLiteralNeedingParens is no longer reachable always giving
precedence to StructLiteralNotAllowedHere.

As an aside: The former error struct shouldn't've existed in the
first place. We should've just used the latter in this branch.
2025-03-25 15:15:41 +01:00
León Orell Valerian Liehr
82796dd858
Brace-ident-colon can certainly no longer start a block
thanks to the removal of type ascription.
2025-03-25 15:15:21 +01:00
bors
48994b1674 Auto merge of #138923 - TaKO8Ki:rollup-f3hkmqj, r=TaKO8Ki
Rollup of 9 pull requests

Successful merges:

 - #138385 (Keyword tweaks)
 - #138580 (resolve: Avoid some unstable iteration 2)
 - #138652 (Reintroduce remote-test support in run-make tests)
 - #138701 (Make default_codegen_backend serializable)
 - #138755 ([rustdoc] Remove duplicated loop when computing doc cfgs)
 - #138829 (Slightly reword triagebot ping message for `relnotes-interest-group`)
 - #138837 (resolve: Avoid remaining unstable iteration)
 - #138838 (Fix/tweak some tests in new solver)
 - #138895 (Add a helper for building an owner id in ast lowering)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-25 13:29:50 +00:00
Jakub Beránek
6df2d58933
Add function for linearizing BuildStep substeps 2025-03-25 12:37:52 +01:00
Nicholas Nethercote
6bea9c7a54 rustdoc: remove useless Symbol::is_empty checks.
There are a number of `is_empty` checks that can never fail. This commit
removes them.
2025-03-25 22:11:14 +11:00
Oli Scherer
59e3380744 Avoid some more global state 2025-03-25 10:33:25 +00:00
Ralf Jung
e88c49c454 acquire more accurate HirId for ABI check lints 2025-03-25 11:30:57 +01:00
Oli Scherer
7cdc456727 Track whether an assoc item is in a trait impl or an inherent impl 2025-03-25 10:12:07 +00:00
Oli Scherer
502d57cb78 Deduplicate assoc item cfg handling 2025-03-25 10:11:56 +00:00
Vadim Petrochenkov
f756304655 privacy: Visit types and traits in impls in type privacy lints 2025-03-25 12:40:02 +03:00
Ralf Jung
61e24e630d allow wasm_c_abi in proc_macro bridge 2025-03-25 08:22:35 +01:00
Ralf Jung
072ccce553 make -Zwasm-c-abi=legacy suppress the lint 2025-03-25 08:22:35 +01:00
Ralf Jung
c961d123d2 add FCW to warn about wasm ABI transition 2025-03-25 08:22:35 +01:00
Nicholas Nethercote
501945a22e Use sym::dummy for a dummy arg in parse_fn_params. 2025-03-25 18:00:14 +11:00
Takayuki Maeda
90c541d637 ignore doctests only in specified targets
add necessary lines

fix ui test error
2025-03-25 15:39:41 +09:00
bors
7d49ae9731 Auto merge of #136410 - saethlin:clean-up-cgu-internal-copy, r=compiler-errors
Remove InstanceKind::generates_cgu_internal_copy

This PR should not contain any behavior changes. Before this PR, the logic for selecting instantiation mode is spread across all of
* `instantiation_mode`
* `cross_crate_inlinable`
* `generates_cgu_internal_copy`
* `requires_inline`

The last two of those functions are not well-designed. The function that actually decides if we generate a CGU-internal copy is `instantiation_mode`, _not_ `generates_cgu_internal_copy`. The function `requires_inline` documents that it is about the LLVM `inline` attribute and that it is a hint. The LLVM attribute is called `inlinehint`, this function is also used by other codegen backends, and since it is part of instantiation mode selection it is *not* a hint.

The goal of this PR is to start cleaning up the logic into a sequence of checks that have a more logical flow and are easier to customize in the future (to do things like improve incrementality or improve optimizations without causing obscure linker errors because you forgot to update another part of the compiler).
2025-03-25 06:36:41 +00:00
Takayuki Maeda
3757104071
Rollup merge of #138895 - oli-obk:dedup-owner-id-creation, r=compiler-errors
Add a helper for building an owner id in ast lowering

Just some deduplication of owner-id creations. Will also help me later split up ast lowering into per-owner queries, as it won't be possible anymore to go from a NodeId to a DefId of an owner without doing extra work to check whether we have an owner id. So I'd just do that in the new `owner_id` function and keep the `local_def_id` function free of that logic
2025-03-25 15:36:36 +09:00
Takayuki Maeda
b2629be2de
Rollup merge of #138838 - compiler-errors:new-solver-crashes-tweaks, r=lcnr
Fix/tweak some tests in new solver

Bunch of miscellaneous new solver tweaks that I found from the failing tests. Can split these out, but they all seemed small enough to not warrant separate PRs.

r? lcnr
2025-03-25 15:36:35 +09:00
Takayuki Maeda
117b3fdbb8
Rollup merge of #138837 - petrochenkov:resinstab2, r=jieyouxu
resolve: Avoid remaining unstable iteration

Continuation of #138580.
This should be the performance sensitive part.
2025-03-25 15:36:35 +09:00
Takayuki Maeda
5cdafb985c
Rollup merge of #138829 - jieyouxu:adjust-relnotes-interest-group-desc, r=cuviper
Slightly reword triagebot ping message for `relnotes-interest-group`

Now that there's also a meta relnotes tracking issue.

r? ```@cuviper``` (or release)
2025-03-25 15:36:34 +09:00
Takayuki Maeda
07d0963c5f
Rollup merge of #138755 - GuillaumeGomez:rm-duplicated-loop, r=camelid
[rustdoc] Remove duplicated loop when computing doc cfgs

Working on implementing https://github.com/rust-lang/rfcs/blob/master/text/3631-rustdoc-cfgs-handling.md and found this weird case where the first loop was actually not doing anything since we were passing `cfg(...)` to `Cfg::parse` instead of `cfg(...)` items.

Well, that should be a first nice cleanup before the rest comes in.

cc ```@notriddle```
r? ```@camelid```
2025-03-25 15:36:33 +09:00
Takayuki Maeda
e9a528c9b5
Rollup merge of #138701 - tvladyslav:serializable_default_codegen_backend, r=workingjubilee
Make default_codegen_backend serializable

This PR makes default_codegen_backend serializable.
2025-03-25 15:36:33 +09:00
Takayuki Maeda
3101bfbd6e
Rollup merge of #138652 - ferrocene:pa-remote-test-rmake, r=jieyouxu
Reintroduce remote-test support in run-make tests

The old Makefile-based infrastructure included support for executing binaries with remote-test-client if configured, but that didn't get ported to run_make_support as part of the rmake migration.

This PR re-introduces back that support, with the same implementation (and limitations) of the original Makefile-based support.

[Old Makefile-based implementation of this](9b8accbeb6/tests/run-make/tools.mk (L65-L74))

try-job: armhf-gnu
2025-03-25 15:36:32 +09:00
Takayuki Maeda
922cc7555f
Rollup merge of #138580 - petrochenkov:resinstab, r=Nadrieril
resolve: Avoid some unstable iteration 2

Continuation of https://github.com/rust-lang/rust/pull/138502.
2025-03-25 15:36:32 +09:00
Takayuki Maeda
8020558507
Rollup merge of #138385 - nnethercote:keyword-tweaks, r=Noratrieb
Keyword tweaks

r? ```@Noratrieb```
2025-03-25 15:36:31 +09:00
Nicholas Nethercote
867da30cc7 Avoid kw::Empty when dealing with rustc_allowed_through_unstable_modules.
The existing code produces `Some(kw::Empty)` for these invalid forms:

- a non-name-value, e.g. `#[rustc_allowed_through_unstable_modules]`

- a non-string arg, e.g. `#[rustc_allowed_through_unstable_modules = 3]`

The new code avoids the `kw::Empty` and is a little shorter. It will
produce `None` in those cases, which means E0789 won't be produced if
the `stable` attribute is missing for these invalid forms. This doesn't
matter, because these invalid forms will trigger an "malformed
`rustc_allowed_through_unstable_modules` attribute" anyway.
2025-03-25 16:48:03 +11:00
Daniel Paoliello
79b9664091 Reduce visibility of most items in rustc_codegen_llvm 2025-03-25 16:36:47 +11:00
Nicholas Nethercote
e576d8850d Use Option<Symbol> in DuplicateLangItem.
For the the symbols that might not be present, instead of `kw::Empty`.
2025-03-25 16:20:43 +11:00
Nicholas Nethercote
3f32a321bc Use Option<Symbol> in ModuleKind::Def.
This way, `None` represents "crate root without a name" instead of
`kw::Empty`. This changes makes it impossible to forget to handle the
exceptional case.
2025-03-25 16:14:27 +11:00
Nicholas Nethercote
2469ab195a Use Option<Symbol> in panic_call.
Instead of `kw::Empty`. It makes it clearer that this is a name that is
searched for and might not be found.
2025-03-25 16:14:27 +11:00
Nicholas Nethercote
bd61e0129f Use Ident::dummy() in dummy_annotatable.
This is exactly the kind of case `Ident::dummy()` is for.
2025-03-25 16:14:27 +11:00
Nicholas Nethercote
1a6266340e Add a test with an empty crate name.
This error was untested.
2025-03-25 16:14:27 +11:00
bors
e61403aa4c Auto merge of #138634 - saethlin:repeated-uninit, r=scottmcm,oli-obk
Lower to a memset(undef) when Rvalue::Repeat repeats uninit

Fixes https://github.com/rust-lang/rust/issues/138625.

It is technically correct to just do nothing. But if we actually do nothing, we may miss that this is de-initializing something, so instead we just lower to a single memset that writes undef. This is still superior to the memcpy loop, in both quality of code we hand to the backend and LLVM's final output.
2025-03-25 02:09:15 +00:00
Ben Kimock
817e2c598d Remove InstanceKind::generates_cgu_internal_copy 2025-03-24 20:29:24 -04:00
bors
1df5affaca Auto merge of #133984 - DaniPopes:scmp-ucmp, r=scottmcm
Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics

Lowers `mir::BinOp::Cmp` (`three_way_compare` intrinsic) to the corresponding LLVM `llvm.{s,u}cmp.i8.*` intrinsics.

These are the intrinsics mentioned in https://github.com/rust-lang/rust/pull/118310, which are now available in LLVM 19.

I couldn't find any follow-up PRs/discussions about this, please let me know if I missed something.

r? `@scottmcm`
2025-03-24 22:53:12 +00:00
Jens Reidel
1a8ddee65c
Add target maintainer information for powerpc64-unknown-linux-musl
We intend to fix the outstanding issues on the target and eventually
promote it to tier 2. We have the capacity to maintain this target in
the future and already perform regular builds of rustc for this target.

Currently, all host tools except miri build fine, but I have a patch for
libffi-sys to make miri also compile fine for this target that is
pending review [1].

While at it, add an option for the musl root for this target.

[1]: https://github.com/tov/libffi-rs/pull/100

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-03-24 23:17:58 +01:00
Vadim Petrochenkov
7c55782e0c rustc_session: Add a helper function for obtaining staticlib prefix and suffix 2025-03-25 00:03:36 +03:00
Vadim Petrochenkov
27e95f95e6 linker: Avoid calling linker_and_flavor twice 2025-03-25 00:03:36 +03:00
Vadim Petrochenkov
43653c1835 linker: Fix staticlib naming for UEFI
It uses `libname.a` instead of the standard MSVC naming `name.lib`.

Naming for import libraries isn't touched.
2025-03-25 00:03:36 +03:00
Jieyou Xu
7f2cb4c206
Slightly reword triagebot ping message for relnotes-interest-group
Now that there's also a meta relnotes tracking issue.
2025-03-25 04:26:38 +08:00
Vadim Petrochenkov
ba4190cf7e resolve: Avoid some unstable iteration 2 2025-03-24 23:03:11 +03:00
bors
f8c27dfe1a Auto merge of #138901 - matthiaskrgr:rollup-qbbanhr, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #138662 (Implement some basics in UEFI fs)
 - #138800 (remove remnants of const_box feature)
 - #138821 (match lowering cleanup: remove unused unsizing logic from `non_scalar_compare`)
 - #138864 (Rework `--print` options documentation)
 - #138868 (Add do_not_recommend typo help)
 - #138882 (`with_scope` is only ever used for ast modules)
 - #138894 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-24 19:43:42 +00:00
Matthias Krüger
4202bf9669
Rollup merge of #138894 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

23 commits in 81a976a237f84b8392c4ce1bd5fd076eb757a2eb..45f05367360f033f89235eacbbb54e8d73ce6b70
2025-03-21 23:23:52 UTC to 2025-03-13 14:14:37 UTC

- Ch. 21: call out Chrome multiple-connections issue (rust-lang/book#4297)
- Ch. 16: refactor 16-6 to using listing component (rust-lang/book#4295)
- Ch. 01: Show how to work offline (rust-lang/book#4294)
- Ch. 07: Clarify sentences about `pub use` (rust-lang/book#4293)
- Ch. 02: Consistent ordering of `use` statements (rust-lang/book#4292)
- Anchors on listings (rust-lang/book#4271)
- Ch. 17: another tweak to how we phrase things about sections (rust-lang/book#4288)
- Ch. 20: correct listing number (rust-lang/book#4287)
- Ch. 10.3: clarify language detail (rust-lang/book#4284)
- Ch. 17: minor typos and link reference (rust-lang/book#4286)
- Ch. 9: correctly demonstrate privacy with module (rust-lang/book#4282)
- Ch. 18: correct discussion of delegation in `Post` methods (rust-lang/book#4281)
- Ch. 20: tell folks to see the Reference for more ABI info (rust-lang/book#4165)
- Ch 10.1 minor clarifications (rust-lang/book#4256)
- Clarified the misunderstanding b/w crates, module, items (rust-lang/book#4232)
- Ferris: always show, even when it’s small (rust-lang/book#4280)
- Ch. 17: mention `use std::pin::{Pin, pin};` on introduction (rust-lang/book#4279)
- Persist printing error, NOT ErrorKind (rust-lang/book#4259)
- Typo: "2" should be "2 seconds" (rust-lang/book#4263)
- Ch. 17: fix tiny example consistency issue (rust-lang/book#4270)
- Bump ring from 0.17.8 to 0.17.13 in /listings/ch17-async-await/listing-17-02 (rust-lang/book#4261)
- Bump ring from 0.17.8 to 0.17.14 in /packages/trpl (rust-lang/book#4273)
- 2024 Print Edition: updates to Word docs and more fixes to Markdown text (rust-lang/book#4272)

## rust-lang/reference

5 commits in dda31c85f2ef2e5d2f0f2f643c9231690a30a626..e95ebdfee02514d93f79ec92ae310a804e87f01f
2025-03-24 15:56:46 UTC to 2025-03-18 02:25:06 UTC

- Fix diagnostic attribute typo (rust-lang/reference#1767)
- Mention that “every address” ≠ “every pointer” (rust-lang/reference#1761)
- Rework range pattern rules (rust-lang/reference#1756)
- Use warning block in behavior-considered-undefined (rust-lang/reference#1759)
- Add reference for asm-goto (rust-lang/reference#1693)
2025-03-24 20:40:11 +01:00
Matthias Krüger
d1ac5e145b
Rollup merge of #138882 - oli-obk:ast-lowering-mod-rib, r=fee1-dead
`with_scope` is only ever used for ast modules

Thus I renamed it to match other similar functions (`with_mod_rib`) and made it panic if used on non-modules
2025-03-24 20:40:10 +01:00
Matthias Krüger
a678d2068d
Rollup merge of #138868 - mejrs:d_not_recommend_typo, r=davidtwco
Add do_not_recommend typo help
2025-03-24 20:40:09 +01:00
Matthias Krüger
13bcdba2cc
Rollup merge of #138864 - Urgau:rework-print-options-doc, r=jieyouxu
Rework `--print` options documentation

This PR reworks the `--print` options documentation, by making it more like codegen options with a dedicated page.

I also added some examples and split some paragraph into multiple paragraph since we now have more place.

r? ```@jieyouxu```
2025-03-24 20:40:08 +01:00
Matthias Krüger
dfd83be4da
Rollup merge of #138821 - dianne:cleanup-non-scalar-compare, r=oli-obk
match lowering cleanup: remove unused unsizing logic from `non_scalar_compare`

Since array and slice constants are now translated to array and slice patterns, `non_scalar_compare` is only used for string comparisons. This specializes it to strings, renames it, and removes the unused array-unsizing logic.

This also updates the doc comments for  `thir::PatKind::Constant` and `TestKind::Eq`, which referred to them being used for slice references.

r? ````@oli-obk````
2025-03-24 20:40:08 +01:00
Matthias Krüger
0c25157784
Rollup merge of #138800 - RalfJung:const_box, r=oli-obk
remove remnants of const_box feature

This feature requires major design work, and the few methods it gates currently aren't actually useful. Let's reset to a clean slate so when a design materializes, we can start from scratch.

Closes https://github.com/rust-lang/rust/issues/92521 by removing the feature it tracks.

r? ````@oli-obk````
2025-03-24 20:40:07 +01:00
Matthias Krüger
b157594165
Rollup merge of #138662 - Ayush1325:uefi-fs-1, r=nicholasbishop,petrochenkov
Implement some basics in UEFI fs

- Just getting some basics out of the way while waiting for #138236 to be merged.
- Adds `fs::canonicalize`. Should be same as absolute in case of UEFI since there is no symlink support and absolute path is guaranteed to be uniqe according to spec.
- Make `fs::lstat` same as `fs::stat`. Should be same since UEFI does not have symlink support.
- Implement `OptionOptions`.

cc ````@nicholasbishop```` ````@dvdhrm````
2025-03-24 20:40:06 +01:00
León Orell Valerian Liehr
848b0da34f
Remove fields that are dead since the removal of type ascription syntax
Since `{ ident: ident }` is a parse error, these fields are dead.
2025-03-24 20:04:23 +01:00