Commit Graph

48471 Commits

Author SHA1 Message Date
Pavel Grigorenko
938916d220 Port #[rustc_deny_explicit_impl] to the new attribute system 2025-07-09 01:04:35 +03:00
Pavel Grigorenko
62f58dbb2d Port #[const_trait] to the new attribute system 2025-07-09 01:03:00 +03:00
mejrs
25eb3829e5 Error on moving unsized values rather than ICE'ing 2025-07-08 22:37:12 +02:00
Matthias Krüger
38bfba6124 Rollup merge of #143620 - Muscraft:remove-newline, r=compiler-errors
fix: Remove newline from multiple crate versions note

While working on getting `annotate-snippets` to match `rustc`, `annotate-snippets` was adding an extra new line after [this line](a2d45f73c7/tests/run-make/crate-loading/multiple-dep-versions.stderr (L9)) for [`run-make/crate-loading/multiple-dep-versions.rs`](a2d45f73c7/tests/run-make/crate-loading/multiple-dep-versions.rs). I found out this was because there was an explicit `\n` in the message that `annotate-snippets` was respecting, while `rustc` was [skipping it](2f8eeb2bba/compiler/rustc_errors/src/emitter.rs (L1542)). After talking with ```@estebank,``` I was told to remove the newline from the error message.

r? ```@estebank```
2025-07-08 19:29:41 +02:00
Matthias Krüger
a15162061b Rollup merge of #143603 - Periodic1911:clarify_keepfistlast, r=compiler-errors
Clarify the meaning of `AttributeOrder::KeepFirst` and `AttributeOrder::KeepLast`

Clarify the meaning of `KeepLast` and `KeepFirst` for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

Just a minor clarification, but me and ``@JonathanBrouwer`` have confused these two a few times so I think it's warranted.

r? ``@oli-obk``

cc ``@JonathanBrouwer``
2025-07-08 19:29:40 +02:00
Matthias Krüger
19a21289ba Rollup merge of #143593 - mejrs:dummy, r=jdonszelmann
Port #[rustc_dummy]

r? ``@jdonszelmann``
2025-07-08 19:29:39 +02:00
Matthias Krüger
bc9b313cb5 Rollup merge of #143402 - GrigorenkoPV:attributes/link_attrs, r=jdonszelmann
Port several linking (linkage?) related attributes the new attribute system

This ports:
- `#[export_stable]`
- `#[ffi_const]`
- `#[ffi_pure]`
- `#[rustc_std_internal_symbol]`

Part of rust-lang/rust#131229

r? ``@oli-obk``
2025-07-08 19:29:37 +02:00
Michael Goulet
bbb409cc68 Instantiate binder for Copy/Clone/Sized eagerly 2025-07-08 16:35:06 +00:00
Michael Goulet
8d2d4eb89a Instantiate auto trait before computing higher-ranked constituent types 2025-07-08 16:33:38 +00:00
Oli Scherer
b1d45f6b3e Remove const_eval_select hack 2025-07-08 15:49:00 +00:00
Oli Scherer
543c860ea6 Constify Fn* traits 2025-07-08 14:36:43 +00:00
Stypox
e8c8330ba1 Make enter_trace_span take a closure for better optimization 2025-07-08 15:24:56 +02:00
Stypox
3cacaa7d0e Add inline(always) to Machine::enter_trace_span 2025-07-08 15:24:56 +02:00
Stypox
07143afee4 Replace TRACING_ENABLED with enter_trace_span()
Hopefully this will make tracing calls be optimized out properly when tracing is disabled
2025-07-08 15:24:55 +02:00
Stypox
c4bf37d358 Always inline InterpCx::layout_of after perf regression 2025-07-08 15:23:48 +02:00
Dillon Amburgey
b2299e20b2 fix: correct assertion to check for 'noinline' attribute presence before removal 2025-07-08 06:24:50 -05:00
Dillon Amburgey
0455577974 fix: correct parameter names in LLVMRustBuildMinNum and LLVMRustBuildMaxNum FFI declarations 2025-07-08 06:24:19 -05:00
Rémy Rakic
5059315e28 remove -znostart-stop-gc workaround
Now that `#[used(linker)]` is the default on ELF, we don't need to use the
`-znostart-stop-gc` link-arg workaround to match bfd's behavior when
using lld.
2025-07-08 10:24:11 +00:00
Marijn Schouten
d44dcd4513 update to literal-escaper-0.0.5 2025-07-08 10:16:44 +00:00
Rémy Rakic
3f194a86ee stabilize -Clink-self-contained=-linker on x64 linux
This stabilizes a subset of the `-Clink-self-contained` components on x64 linux:
the rust-lld opt-out.

The opt-in is not stabilized, as interactions with other stable flags require
more internal work, but are not needed for stabilizing using rust-lld by default.

Similarly, since we only switch to rust-lld on x64 linux, the opt-out is
only stabilized there. Other targets still require `-Zunstable-options`
to use it.
2025-07-08 09:21:35 +00:00
Rémy Rakic
2e6d82c9c9 stabilize -Clinker-features=-lld on x64 linux
This stabilizes a subset of the `-Clinker-features` components on x64 linux:
the lld opt-out.

The opt-in is not stabilized, as interactions with other stable flags require
more internal work, but are not needed for stabilizing using rust-lld by default.

Similarly, since we only switch to rust-lld on x64 linux, the opt-out is
only stabilized there. Other targets still require `-Zunstable-options`
to use it.
2025-07-08 09:04:21 +00:00
Scott McMurray
8cf2c71243 Let rvalue_creates_operand return true for *all* Rvalue::Aggregates
Inspired by <https://github.com/rust-lang/rust/pull/138759#discussion_r2156375342> where I noticed that we were nearly at this point, plus the comments I was writing in 143410 that reminded me a type-dependent `true` is fine.

This PR splits the `OperandRef::builder` logic out to a separate type, with the updates needed to handle SIMD as well.  In doing so, that makes the existing `Aggregate` path in `codegen_rvalue_operand` capable of handing SIMD values just fine.

As a result, we no longer need to do layout calculations for aggregate result types when running the analysis to determine which things can be SSA in codegen.
2025-07-07 23:08:10 -07:00
bors
2783fc43fd Auto merge of #143621 - matthiaskrgr:rollup-p1ce8l7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#142098 (Implement `int_format_into` feature)
 - rust-lang/rust#143567 (Point to correct argument in Func Call when Self type fails trait bound)
 - rust-lang/rust#143570 (consider nested cases for duplicate RPITIT)
 - rust-lang/rust#143571 (remove `has_nested` from builtin candidates)
 - rust-lang/rust#143586 (Fix wrong cache event query key)
 - rust-lang/rust#143589 (const-block-as-pattern: do not refer to no-longer-existing nightly feature)
 - rust-lang/rust#143608 (Fix in std::String docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-08 03:30:58 +00:00
Matthias Krüger
65dded8387 Rollup merge of #143589 - RalfJung:const-pat, r=compiler-errors
const-block-as-pattern: do not refer to no-longer-existing nightly feature

Surely everyone who used this nightly feature has fixed their code by now. So let's not confused people on stable that try to use a const block as a pattern by referring to some dead nightly feature.
2025-07-08 03:09:58 +02:00
Matthias Krüger
1a45ab116d Rollup merge of #143586 - Kobzol:self-profile-fix, r=oli-obk
Fix wrong cache event query key

I messed this up in https://github.com/rust-lang/rust/pull/142978. It is only an issue if someone enables the event manually, which almost no-one does, so it could take a while before we found it :D Luckily I noticed it while re-reading the PR.

r? `@oli-obk`
2025-07-08 03:09:58 +02:00
Matthias Krüger
b29f039ae3 Rollup merge of #143571 - lcnr:has_nested-bb, r=compiler-errors
remove `has_nested` from builtin candidates

it's no longer necessary

r? types
2025-07-08 03:09:57 +02:00
Matthias Krüger
a4e05e1f74 Rollup merge of #143570 - bvanjoi:issue-143560, r=compiler-errors
consider nested cases for duplicate RPITIT

Fixes rust-lang/rust#143560

r? `@compiler-errors`

cc `@Zoxc`
2025-07-08 03:09:57 +02:00
Matthias Krüger
40e1ccf458 Rollup merge of #143567 - xizheyin:143336, r=compiler-errors
Point to correct argument in Func Call when Self type fails trait bound

Fixes rust-lang/rust#143336

When a trait bound fails due to the `Self` type parameter, `adjust_fulfillment_errors` now correctly points to the corresponding function argument instead of incorrectly pointing to other arguments. This is because `Call` may also need to handle the `self` parameter, and not just `MethodCall` needs to be handled, as rust-lang/rust#143336.

r? compiler
2025-07-08 03:09:56 +02:00
Scott Schafer
62951c2e07 fix: Remove newline from multiple crate versions note 2025-07-07 18:54:23 -06:00
bors
688ea65df6 Auto merge of #143433 - oli-obk:ty_span_qry, r=compiler-errors
Add `ty_span` query

r? `@compiler-errors`

fixes diagnostic regressions from https://github.com/rust-lang/rust/pull/142030

Also uses the new query in `check_const_item`
2025-07-08 00:11:13 +00:00
mejrs
49421d1fa3 Remove support for dynamic allocas 2025-07-07 23:04:06 +02:00
bors
a2d45f73c7 Auto merge of #143601 - matthiaskrgr:rollup-9iw2sqk, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#132469 (Do not suggest borrow that is already there in fully-qualified call)
 - rust-lang/rust#143340 (awhile -> a while where appropriate)
 - rust-lang/rust#143438 (Fix the link in `rustdoc.md`)
 - rust-lang/rust#143539 (Regression tests for repr ICEs)
 - rust-lang/rust#143566 (Fix `x86_64-unknown-netbsd` platform support page)
 - rust-lang/rust#143572 (Remove unused allow attrs)
 - rust-lang/rust#143583 (`loop_match`: fix 'no terminator on block')
 - rust-lang/rust#143584 (make `Machine::load_mir` infallible)
 - rust-lang/rust#143591 (Fix missing words in future tracking issue)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-07 20:30:53 +00:00
Anne Stijns
6254afa5f2 Clarify the meaning of AttributeOrder::KeepFirst and AttributeOrder::KeepLast 2025-07-07 20:29:06 +02:00
Matthias Krüger
42b105eb21 Rollup merge of #143584 - fee1-dead-contrib:push-skswvrwsrmll, r=RalfJung
make `Machine::load_mir` infallible

it doesn't need to return an `InterpResult`.
2025-07-07 19:55:36 +02:00
Matthias Krüger
f5df1f562c Rollup merge of #143583 - folkertdev:loop-match-no-terminator-on-block, r=bjorn3
`loop_match`: fix 'no terminator on block'

tracking issue: https://github.com/rust-lang/rust/issues/132306
fixes https://github.com/rust-lang/rust/issues/143435

The argument `block` was not properly closed on an error path.

r? `@bjorn3`
2025-07-07 19:55:35 +02:00
Matthias Krüger
7ed6bd98a2 Rollup merge of #143572 - yotamofek:pr/unused-allow-attrs, r=fee1-dead
Remove unused allow attrs

These `#[allow]`s seem to be unused (at least according to `x check`, didn't run `x test` locally). Let's clean them up! 🧹
2025-07-07 19:55:35 +02:00
Matthias Krüger
2554c424ef Rollup merge of #143340 - nabijaczleweli:awhile, r=mati865
awhile -> a while where appropriate
2025-07-07 19:55:32 +02:00
Matthias Krüger
00a4418158 Rollup merge of #132469 - estebank:issue-132041, r=Nadrieril
Do not suggest borrow that is already there in fully-qualified call

When encountering `&str::from("value")` do not suggest `&&str::from("value")`.

Fix #132041.
2025-07-07 19:55:31 +02:00
bors
2f8eeb2bba Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee
Allow custom default address spaces and parse `p-` specifications in the datalayout string

Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout).

This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications.

The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run.

r? workingjubilee
2025-07-07 17:28:14 +00:00
mejrs
429deed03a Port #[rustc_dummy] 2025-07-07 18:16:09 +02:00
bors
1b0bc594a7 Auto merge of #143582 - jieyouxu:rollup-8t9mhfj, r=jieyouxu
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#143130 (doc(std): clarify `NonZero<T>` usage limitation in doc comment)
 - rust-lang/rust#143415 (Get rid of build-powerpc64le-toolchain.sh)
 - rust-lang/rust#143464 (Make tests/ui/abi/debug.rs cross-compile)
 - rust-lang/rust#143482 (Fix short linker error output)
 - rust-lang/rust#143524 (Move `stable_mir` back to its own crate)
 - rust-lang/rust#143528 (interpret: rename StackPopCleanup)
 - rust-lang/rust#143551 (Dont resolve instance of root in `mir_callgraph_cyclic`)
 - rust-lang/rust#143558 (mbe: Refactors and function extractions in `compile_declarative_macro`)
 - rust-lang/rust#143563 (std: fix typo in `std::path`)
 - rust-lang/rust#143564 (compiler: Deduplicate `must_emit_unwind_tables()` comments)
 - rust-lang/rust#143577 (Disable download-rustc for library profile)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-07 14:20:33 +00:00
Ralf Jung
1a6eff747f const-block-as-pattern: do not refer to no-longer-existing nightly feature 2025-07-07 16:18:41 +02:00
Jakub Beránek
37115f1bd6 Fix wrong cache event query key 2025-07-07 15:16:42 +02:00
Yotam Ofek
3b48407f93 Remove unused allow attrs 2025-07-07 12:58:16 +00:00
Pavel Grigorenko
4f0b0b0f01 Port #[rustc_std_internal_symbol] to the new attribute system 2025-07-07 14:59:52 +03:00
Pavel Grigorenko
5d7771e50d Port #[ffi_pure] to the new attribute system 2025-07-07 14:59:01 +03:00
Deadbeef
be6cd11d1b make Machine::load_mir infallible
it doesn't need to return an `InterpResult`.
2025-07-07 19:57:04 +08:00
Folkert de Vries
6d58a88c3c loop_match: fix 'no terminator on block' 2025-07-07 13:55:40 +02:00
Pavel Grigorenko
99a9fe1b22 Port #[ffi_const] to the new attribute system 2025-07-07 14:52:52 +03:00
许杰友 Jieyou Xu (Joe)
0938cb779f Rollup merge of #143564 - Enselic:must_emit_unwind_tables-comment, r=oli-obk
compiler: Deduplicate `must_emit_unwind_tables()` comments

There is one comment at a call site and one comment in the function definition that are mostly saying the same thing. Fold the call site comment into the function definition comment to reduce duplication.

There are actually some inaccuracies in the comments but let's deduplicate before we address the inaccuracies.
2025-07-07 19:45:43 +08:00