Commit Graph

48471 Commits

Author SHA1 Message Date
Matthias Krüger
58d80b6d05 Rollup merge of #142042 - estebank:explicit-lifetime-verbose-suggestion, r=compiler-errors
Make E0621 missing lifetime suggestion verbose

```
error[E0621]: explicit lifetime required in the type of `x`
  --> $DIR/42701_one_named_and_one_anonymous.rs:10:9
   |
LL |         &*x
   |         ^^^ lifetime `'a` required
   |
help: add explicit lifetime `'a` to the type of `x`
   |
LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 {
   |                             ++
```

Part of rust-lang/rust#141973.
2025-06-11 13:48:09 +02:00
bors
bdb04d6c4f Auto merge of #141763 - lcnr:fixme-gamer, r=BoxyUwU
`FIXME(-Znext-solver)` triage

r? `@BoxyUwU`
2025-06-11 11:47:05 +00:00
Stypox
cd04717899 Fix enter_trace_span!() using wrong $crate paths 2025-06-11 12:22:20 +02:00
lcnr
a48c08546c move fast reject into inner
to also fast reject inside of the folder
2025-06-11 12:13:57 +02:00
Stypox
fc96ca8bba Use closure to allow passing custom tracing layers
The previous method, where a layer would be passed directly,
required to pass a "no-op" layer when no custom layer was needed.
This should have in theory worked, however having a no-op layer
seems to change the way the tracing lib applies filters internally,
leading to some debug!() being printed despite them being out of
the minimum level for the filters. Note however that this behavior
was very inconsistent, and e.g. some debug!() would get printed
and some others wouldn't, for no apparent reason.
2025-06-11 10:42:50 +02:00
Stypox
0d74252537 Allow initializing logger with additional tracing Layer 2025-06-11 10:41:22 +02:00
bors
0a39445252 Auto merge of #141942 - ShoyuVanilla:smir-repr, r=oli-obk
Implement representation options to smir

Resolves rust-lang/project-stable-mir#89
2025-06-11 07:45:07 +00:00
Jubilee Young
87feee9ad5 compiler: Update all targets to the new c_int_width type 2025-06-11 00:42:14 -07:00
Jubilee Young
b88c0061c4 compiler: Change c_int_width to be an integer type 2025-06-11 00:42:14 -07:00
Urgau
208f2e461c Remove useless and wrong std crates special casing when un-remap sysroot 2025-06-11 07:42:58 +02:00
bors
2b0274c71d Auto merge of #142090 - compiler-errors:perf-stable-root-var, r=lcnr
Make root vars more stable

Never resolve a ty/ct vid to a higher vid as its root. This should make the optimization in rust-lang/rust#141500 more "stable" when there are a lot of vars flying around.

r? `@ghost`
2025-06-11 03:34:30 +00:00
bors
1c047506f9 Auto merge of #141883 - oli-obk:remove-check-mod-loops, r=nnethercote
Remove check_mod_loops query and run the checks per-body instead

This analysis is older than my first rustc contribution I believe. It was never querified. Ideally we'd merge it into the analysis happening within typeck anyway (typeck just uses span_delayed_bug instead of erroring), but I didn't want to do that within this PR that also moves things around and subtly changes diagnostic ordering.
2025-06-10 23:54:45 +00:00
Scott McMurray
ed06f361ac Remove unneeded FunctionCx from some codegen methods
No changes; just removing the `self` that wasn't needed.
2025-06-10 16:50:17 -07:00
Guillaume Gomez
6f958ac88f Remove unneeded check_id calls as they are already called in visit_id in EarlyContextAndPass type 2025-06-10 20:09:37 +02:00
bors
8ce2287586 Auto merge of #142299 - fmease:rollup-u86s80a, r=fmease
Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#134442 (Specify the behavior of `file!`)
 - rust-lang/rust#140372 (Exhaustively handle parsed attributes in CheckAttr)
 - rust-lang/rust#140766 (Stabilize keylocker)
 - rust-lang/rust#141642 (Note the version and PR of removed features when using it)
 - rust-lang/rust#141818 (Don't create .msi installer for gnullvm hosts)
 - rust-lang/rust#141909 (Add central execution context to bootstrap)
 - rust-lang/rust#141992 (use `#[naked]` for `__rust_probestack`)
 - rust-lang/rust#142101 (core::ptr: deduplicate more method docs)
 - rust-lang/rust#142102 (docs: Small clarification on the usage of read_to_string and read_to_end trait methods)
 - rust-lang/rust#142124 (Allow transmute casts in pre-runtime-MIR)
 - rust-lang/rust#142240 (deduplicate the rest of AST walker functions)
 - rust-lang/rust#142258 (platform-support.md: Mention specific Linux kernel version or later)
 - rust-lang/rust#142262 (Mark `core::slice::memchr` as `#[doc(hidden)]`)
 - rust-lang/rust#142271 (compiler: fn ptrs should hit different lints based on ABI)
 - rust-lang/rust#142275 (rustdoc: Refractor `clean_ty_generics`)
 - rust-lang/rust#142288 (const_eval: fix some outdated comments)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-10 17:51:43 +00:00
Michael Goulet
6227acc749 Dont unwrap and re-wrap typing envs 2025-06-10 17:01:55 +00:00
León Orell Valerian Liehr
9f5c10ed43 Rollup merge of #142288 - RalfJung:const-eval-comments, r=oli-obk
const_eval: fix some outdated comments

r? ``@oli-obk``
2025-06-10 16:54:54 +02:00
León Orell Valerian Liehr
a2badebce5 Rollup merge of #142271 - workingjubilee:fn-ptrs-have-two-different-lints, r=RalfJung
compiler: fn ptrs should hit different lints based on ABI

I was looking closer at the code for linting on ABIs and realized a mistake was probably made during rebase or review. I think that for function pointers in the HIR, the lint that fires should probably depend on the ABI we encountered, e.g. if it's on the newly-deprecated set of ABIs or not. This will be slightly confusing for a little bit, but I think we can do more to reduce that confusion by switching `unsupported_fn_ptr_calling_conventions` to a hard error.

r? ``@RalfJung``
2025-06-10 16:54:52 +02:00
León Orell Valerian Liehr
407b81caf4 Rollup merge of #142240 - fee1-dead-contrib:push-zkkzoxlymslv, r=oli-obk
deduplicate the rest of AST walker functions

After this, we can tidy things up and deduplicate the visitor traits themselves too.

Fixes rust-lang/rust#139825, apparently

r? ``@oli-obk``
2025-06-10 16:54:51 +02:00
León Orell Valerian Liehr
e8be230f1f Rollup merge of #142124 - oli-obk:transmute-cast, r=scottmcm
Allow transmute casts in pre-runtime-MIR

r? ``@scottmcm``

cc ``@BoxyUwU``

turns out in https://github.com/rust-lang/rust/pull/138393 I erroneously used transmute casts in fd3da4bebd/compiler/rustc_mir_build/src/builder/matches/test.rs (L209)

I don't think they have any issues using them before runtime, we just checked for them because we didn't have code exercising those code paths
2025-06-10 16:54:50 +02:00
León Orell Valerian Liehr
a55b610d7d Rollup merge of #141992 - folkertdev:probestack-naked-function, r=tgross35
use `#[naked]` for `__rust_probestack`

Let's see if this works now.

Previously this change was in https://github.com/rust-lang/compiler-builtins/pull/897, but we decided to wait until `compiler-builtins` was a subtree (and also `cfg(bootstrap)` is gone now).

r? ``@tgross35``  cc ``@bjorn3``

try-job: `dist-various*`
try-job: `test-various*`
2025-06-10 16:54:48 +02:00
León Orell Valerian Liehr
2aea4b2bf1 Rollup merge of #141642 - xizheyin:issue-141619, r=BoxyUwU
Note the version and PR of removed features when using it

Fixes rust-lang/rust#141619

I added the diagnostic information. Since all the current version information is present, it prints the version information anyway, as shown in tests/ui. And PR will not print if it is None, we can gradually add the PR links.

Split into two commits for easier review.

r? compiler

cc ``@jyn514`` Since you're on vocation in the review list, I can't r? you.
2025-06-10 16:54:46 +02:00
León Orell Valerian Liehr
d11756f811 Rollup merge of #140766 - sayantn:stabilize-keylocker, r=traviscross,tgross35
Stabilize keylocker

This PR stabilizes the feature flag `keylocker_x86` (tracking issue rust-lang/rust#134813).

# Public API
The 2 `x86` target features `kl` and `widekl`, and the associated intrinsics in stdarch.

These target features are very specialized, and are only used to signal the presence of the corresponding CPU instruction. They don't have any nontrivial interaction with the ABI (contrary to something like AVX), and serve the only purpose of enabling 11 stdarch intrinsics, all of which have been implemented and propagated to rustc via a stdarch submodule update.

Also, these were added way back in LLVM12, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too!

# Associated PRs
 - rust-lang/rust#134814
 - rust-lang/stdarch#1706
 - rust-lang/rust#136831 (stdarch submodule update)
 - rust-lang/stdarch#1795 (stabilizing the runtime detection and intrinsics)
 - rust-lang/rust#141964 (stdarch submodule update for the stabilization of the runtime detection and intrinsics)

As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now.

cc ````@rust-lang/lang````
cc ````@rust-lang/libs-api```` for the intrinsics and runtime detection

I don't think anyone else worked on this feature, so no one else to ping, maybe cc ````@Amanieu.```` I will send the reference pr soon.
2025-06-10 16:54:46 +02:00
León Orell Valerian Liehr
0f16ccbb64 Rollup merge of #140372 - mejrs:attrs, r=jdonszelmann
Exhaustively handle parsed attributes in CheckAttr

This pr
 - Deletes the unused `DiagnosticAttribute ` struct and variant
 - Comments the `AttributeKind ` enum
 - The match in `CheckAttrVisitor` is now exhaustive for `AttributeKind::Parsed`.
 - Moved some checks around after that change

I did *not* thoroughly check that there's no duplicated logic between this pass and the attribute parsing but I think it's OK.

  r? ````@jdonszelmann````
2025-06-10 16:54:45 +02:00
bors
c6a955468b Auto merge of #141485 - dianqk:early_otherwise_branch_loop, r=oli-obk
mir-opt: Do not create storage marks in EarlyOtherwiseBranch

Fixes #141212.

The first commit add `StorageDead` by creating new indirect BB that makes CFG more complicated, but I think it's better to just not create storage marks.

r? mir-opt
2025-06-10 14:50:54 +00:00
Shoyu Vanilla
dabed3372c Implement representation options to smir 2025-06-10 22:58:27 +09:00
WANG Rui
de8a91b51c Add supported asm types for LoongArch32 2025-06-10 18:50:41 +08:00
bors
100199c9aa Auto merge of #141451 - lcnr:canonicalize-env-cache, r=compiler-errors
cache `param_env` canonicalization

BLocked on rust-lang/rust#141581
2025-06-10 10:42:35 +00:00
Ralf Jung
6d1db1144c const_eval: fix some outdated comments 2025-06-10 11:45:38 +02:00
Oli Scherer
7f4093e78b Loop check anon consts on their own 2025-06-10 08:41:23 +00:00
Oli Scherer
1b9d38dd08 Remove check_mod_loops query and run the checks per-body instead 2025-06-10 08:41:23 +00:00
Folkert de Vries
b6eb4f9c3a use #[naked] for __rust_probestack 2025-06-10 10:08:57 +02:00
Jubilee
8808a9c17f hir_analysis: Elaborate on lint strategy for unsupported ABIs
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-06-09 23:48:33 -07:00
Jubilee Young
580a9555d5 compiler: Fix reusing same lint on fn ptrs with newly-deprecated ABIs 2025-06-09 15:38:38 -07:00
Jubilee Young
dd78c95c54 assert more often in release in ast_lowering 2025-06-09 14:02:58 -07:00
Jubilee Young
ff8b11e02a assert in release in ast_lowering::item 2025-06-09 14:02:45 -07:00
Folkert de Vries
2c8257493d use correct edition when warning for unsafe attributes
If an attribute is re-emitted by a macro, the incorrect edition was used to emit warnings for unsafe attributes
2025-06-09 21:55:22 +02:00
Esteban Küber
3fce086d79 Make E0621 missing lifetime suggestion verbose
```
error[E0621]: explicit lifetime required in the type of `x`
  --> $DIR/42701_one_named_and_one_anonymous.rs:10:9
   |
LL |         &*x
   |         ^^^ lifetime `'a` required
   |
help: add explicit lifetime `'a` to the type of `x`
   |
LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 {
   |                             ++
```
2025-06-09 19:55:00 +00:00
Trevor Gross
facc5da22c Rollup merge of #142208 - Urgau:dead_code-const_, r=petrochenkov
Always consider `const _` items as live for dead code analysis

This PR alters dead code analysis to always consider `const _: () = { ... };` to be live.

This doesn't address the `_name` pattern from https://github.com/rust-lang/rust/issues/142075.

Fixes https://github.com/rust-lang/rust/issues/142104
2025-06-09 12:17:54 -05:00
Trevor Gross
ab87ed150b Rollup merge of #141993 - tgross35:use-in-tree-builtins, r=bjorn3
Use the in-tree `compiler-builtins` for the sysroot

Many of `std`'s dependency have a dependency on the crates.io `compiler-builtins` when used with the feature `rustc-std-workspace-core`. Use a Cargo patch to select the in-tree version instead.

`compiler-builtins` is also added as a dependency of `rustc-std-workspace-core` so these crates can remove their crates.io dependency in the future.

Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336)

Once this merges, the following PRs will need to make it to a release for the relevant crates:

- https://github.com/rust-lang/getopts/pull/119 (can merge at any time)
- https://github.com/rust-lang/hashbrown/pull/625 (can merge at any time)
- https://github.com/rust-lang/stdarch/pull/1825
- https://github.com/rust-lang/rustc-demangle/pull/80
- https://github.com/rust-lang/cfg-if/pull/84
- https://github.com/unicode-rs/unicode-width/pull/77

The above should cover all tier 1 targets with no `std` features enabled. The remaining cover the rest:

- https://github.com/alexcrichton/dlmalloc-rs/pull/50 (wasm, xous, sgx)
- https://github.com/gimli-rs/gimli/pull/769
- https://github.com/r-efi/r-efi/pull/89 (efi)
- https://github.com/r-efi/r-efi-alloc/pull/9 (efi)
- https://github.com/fortanix/rust-sgx/pull/770 (sgx)
- https://github.com/hermit-os/hermit-rs/pull/718 (hermit)
- https://github.com/bytecodealliance/wasi-rs/pull/108 (wasi)
- https://github.com/gimli-rs/addr2line/pull/345
- https://github.com/oyvindln/adler2/pull/2
- https://github.com/BurntSushi/memchr/pull/180
- https://github.com/Frommi/miniz_oxide/pull/173
- https://github.com/gimli-rs/object/pull/777

try-job: x86_64-gnu
try-job: test-various
2025-06-09 12:17:53 -05:00
Trevor Gross
2f26913270 Rollup merge of #140767 - sayantn:stabilize-sha512, r=traviscross,tgross35
Stabilize `sha512`, `sm3` and `sm4` for x86

This PR stabilizes the feature flag `sha512_sm_x86` (tracking issue rust-lang/rust#126624).

# Public API
The 3 `x86` target features `sha512`, `sm3` and `sm4`, and the associated intrinsics in stdarch.

These target features are very specialized, and are only used to signal the presence of the corresponding CPU instruction. They don't have any nontrivial interaction with the ABI (contrary to something like AVX), and serve the only purpose of enabling 10 stdarch intrinsics, all of which have been implemented and propagated to rustc via a stdarch submodule update.

Also, these were added in LLVM17, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too!

# Associated PRs
 - rust-lang/rust#126704
 - rust-lang/stdarch#1592
 - rust-lang/stdarch#1790
 - rust-lang/rust#140389 (stdarch submodule update)
 - rust-lang/stdarch#1796 (stabilizing the runtime detection and intrinsics)
 - rust-lang/rust#141964 (stdarch submodule update for the stabilization of the runtime detection and intrinsics)

As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now.

cc `@rust-lang/lang`
cc `@rust-lang/libs-api` for the intrinsics and runtime detection

I don't think anyone else worked on this feature, so no one else to ping, maybe cc `@Amanieu.` I will send the reference pr soon.
2025-06-09 12:17:52 -05:00
Michael Goulet
cd1d84e304 Apply nested goals certainty to InspectGoals for normalizes-to 2025-06-09 17:02:09 +00:00
Andrew Zhogin
5601490c9d -Zretpoline and -Zretpoline-external-thunk flags (target modifiers) to enable retpoline-related target features 2025-06-09 21:29:59 +07:00
mejrs
ba1c650a2c Add ParseMode::Diagnostic unit tests 2025-06-09 16:28:58 +02:00
mejrs
03c846ee1d Introduce ParseMode::diagnostic and fix multiline spans 2025-06-09 16:28:58 +02:00
mejrs
c7174a761b rename Parser's lifetime to 'input 2025-06-09 16:28:58 +02:00
mejrs
f002abad5e change FormatString::parse to only return the first error 2025-06-09 16:28:58 +02:00
mejrs
b68c06b1e2 implement Default for FormatSpec 2025-06-09 16:28:58 +02:00
mejrs
cf3af234e3 refactor matching and if let chains 2025-06-09 16:28:58 +02:00
mejrs
d3137d91b8 Move the "missing closing brace" error creation to one place 2025-06-09 16:28:57 +02:00