Commit Graph

46752 Commits

Author SHA1 Message Date
bjorn3
7122648e34 Don't depend on FnAbi for intrinsics
Intrinsics are not real functions and as such don't have any calling
convention. Trying to compute a calling convention for an intrinsic
anyway is a nonsensical operation.
2025-05-26 10:13:03 +00:00
bjorn3
0a14e1b2e7 Remove usage of FnAbi in codegen_intrinsic_call 2025-05-26 10:13:03 +00:00
bjorn3
6016f84e71 Pass PlaceRef rather than Bx::Value to codegen_intrinsic_call 2025-05-26 10:13:03 +00:00
bjorn3
c83358beb5 Move caller_location handling into codegen_intrinsic_call 2025-05-26 10:13:02 +00:00
bjorn3
e4700e76d8 Always use fn_span in codegen_call_terminator 2025-05-26 10:13:01 +00:00
bjorn3
1e9e17704a Move some code around in codegen_call_terminator 2025-05-26 10:11:23 +00:00
bors
95a2212587 Auto merge of #141567 - jhpratt:rollup-uuhcmci, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#134696 (Implement `normalize_lexically`)
 - rust-lang/rust#140539 (Simplify `attribute_groups`)
 - rust-lang/rust#140863 ([rustdoc] Unify type aliases rendering with other ADT)
 - rust-lang/rust#140936 (Clarify WTF-8 safety docs)
 - rust-lang/rust#140952 (Specify that split_ascii_whitespace uses the same definition as is_ascii_whitespace)
 - rust-lang/rust#141472 (Attempt to improve the `std::fs::create_dir_all` docs related to atomicity)
 - rust-lang/rust#141502 (ci: move PR job x86_64-gnu-tools to codebuild)
 - rust-lang/rust#141559 (const-check: stop recommending the use of rustc_allow_const_fn_unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-26 04:30:06 +00:00
Jacob Pratt
5a8cb6f892
Rollup merge of #141559 - RalfJung:less-rustc_allow_const_fn_unstable, r=compiler-errors
const-check: stop recommending the use of rustc_allow_const_fn_unstable

I have seen way too many people see the compiler suggest this attribute and then just apply it without a second thought. This is bad. So let's just stop recommending it; for the rare case where someone needs it, they'll eventually ask us and that way we can be sure that it is truly needed. The dev-guide still also explains `rustc_allow_const_fn_unstable`.

Cc ``@rust-lang/wg-const-eval``
2025-05-26 03:38:19 +02:00
Jacob Pratt
761e5464dd
Rollup merge of #140539 - nnethercote:simplify-attribute_groups, r=jdonszelmann
Simplify `attribute_groups`

It's more complicated than it needs to be.

r? ``@jdonszelmann``
2025-05-26 03:38:16 +02:00
bors
46264e6dfd Auto merge of #138489 - tmiasko:call-tmps-lifetime, r=workingjubilee
Describe lifetime of call argument temporaries passed indirectly

Fixes #132014.
2025-05-26 01:16:52 +00:00
Ralf Jung
cf9ac0eec1 const-check: stop recommending the use of rustc_allow_const_fn_unstable 2025-05-25 22:47:21 +02:00
bjorn3
3816385b09 Merge commit '979dcf8e2f213e4f4b645cb62e7fe9f4f2c0c785' into sync_cg_clif-2025-05-25 2025-05-25 18:51:16 +00:00
Guillaume Gomez
43cb506383
Rollup merge of #141541 - compiler-errors:nits, r=lcnr
Random nits

Two completely random commits that I didn't know where to integrate into another PR.

* Don't use the full type relation machinery to equate two regions (it's overkill).
* Add a comment that `select_in_new_trait_solver` shouldn't be used directly.

r? lcnr or reassign
2025-05-25 15:11:49 +02:00
Guillaume Gomez
9460f64362
Rollup merge of #141512 - Noratrieb:stop-trimming-this-much, r=compiler-errors
Avoid extra path trimming in method not found error

Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`).

A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered.

The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
2025-05-25 15:11:48 +02:00
Guillaume Gomez
d72bc29a33
Rollup merge of #141443 - RalfJung:c-variadic-teach-help, r=workingjubilee
make teach_help message for cast-before-pass-to-variadic more precise

r? `@workingjubilee`
based on your comment [here](https://github.com/rust-lang/rust/issues/44930#issuecomment-2199663198)
2025-05-25 15:11:47 +02:00
Guillaume Gomez
b0ae228007
Rollup merge of #141413 - est31:cfg_version_env_var, r=jieyouxu
Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING

The `#[cfg(version(...))]` feature is currently under-tested. Part of it is the difficulty that it is hard to write a test that never changes, while the version of the Rust compiler indeed *does* change.

PR #81468 added the first and so far only test of `#[cfg(version(...))]`'s functionality (there is one other test for the *syntax*, that also acts as feature gate). But that test uses a proc macro that parses the version: the text of the test doesn't contain the actual `#[cfg(version(...))]`.

This PR makes `#[cfg(version(...))]` respect `RUSTC_OVERRIDE_VERSION_STRING`, added by PR #124339, allowing us to virtually pin the rustc version and write tests from all directions against some specific version.

The PR also adds a functional test of `#[cfg(version(...))]` that leverages `RUSTC_OVERRIDE_VERSION_STRING`.

Pulled out of #141137.

Tracking issue: #64796
2025-05-25 15:11:47 +02:00
Michael Goulet
9a8cf3dd0c Comment for not using select_in_new_trait_solver 2025-05-25 10:37:58 +00:00
Michael Goulet
7820d2caba Don't use relation just to equate regions in response 2025-05-25 10:37:43 +00:00
Ralf Jung
4e8b8dad7f
fix help message
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-05-25 09:35:36 +02:00
est31
f3245e48f9 Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING 2025-05-24 23:54:17 +02:00
Noratrieb
01503d0c1e Avoid extra path trimming in method not found error
Method errors have an extra check that force trim paths whenever the
normal string is longer than 10 characters, which can be quite unhelpful
when multiple items have the same name (for example an `Error`).

A user reported this force trimming as being quite unhelpful when they
had a method error where the precise path of the `Error` mattered.

The code uses `tcx.short_string` already to get the normal path, which
tries to be clever around trimming paths if necessary, so there is no
reason for this extra force trimming.
2025-05-24 23:31:07 +02:00
bors
3d86494a0d Auto merge of #141518 - GuillaumeGomez:rollup-ivjep2j, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#140066 (Stabilize `<[T; N]>::as_mut_slice` as `const`)
 - rust-lang/rust#141105 (additional edge cases tests for `path.rs` 🧪 )
 - rust-lang/rust#141487 (Update askama to `0.14.0`)
 - rust-lang/rust#141498 (Use C-string literals to reduce boilerplate)
 - rust-lang/rust#141505 (rename internal panicking::try to catch_unwind)
 - rust-lang/rust#141511 (Cleanup CodegenFnAttrFlags)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-24 21:00:10 +00:00
Guillaume Gomez
7cd749deff
Rollup merge of #141511 - Noratrieb:codegen-fn-attrs, r=compiler-errors
Cleanup CodegenFnAttrFlags

- Rename `USED` to `USED_COMPILER` to better reflect its behavior.
- Reorder some items to group the used and allocator flags together
- Renumber them without gaps
2025-05-24 21:23:50 +02:00
Noratrieb
fa2bb599bc Cleanup CodegenFnAttrFlags
- Rename `USED` to `USED_COMPILER` to better reflect its behavior.
- Reorder some items to group the used and allocator flags together
- Renumber them without gaps
2025-05-24 20:31:37 +02:00
bors
5e16c66206 Auto merge of #141372 - khuey:ir_call_dbg_loc, r=jieyouxu
Use the fn_span when emitting function calls for better debug info.

This especially improves the developer experience for long chains of function calls that span multiple lines, which is common with builder patterns, chains of iterator/future combinators, etc.

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: arm-android

r? `@jieyouxu`
2025-05-24 17:48:21 +00:00
Matthias Krüger
4b8dcb5cf8
Rollup merge of #141432 - lcnr:canonicalize-regions, r=compiler-errors
refactor `CanonicalVarKind`

it's unnecessary. I don't believe we'll ever need to store additional info shared by all `CanonicalVarKind`s.

r? `@compiler-errors`
2025-05-24 16:08:46 +02:00
Matthias Krüger
8019d08ef9
Rollup merge of #141456 - Urgau:check-cfg-version-pred, r=jieyouxu
Suggest correct `version("..")` predicate syntax in check-cfg

This PR specialize the `unexpected_cfgs` lint diagnostic to suggest correct `version("..")` predicate syntax when providing the key-value one, eg. `version = "1.27"`.

Fixes https://github.com/rust-lang/rust/issues/141440
r? ``@jieyouxu``
2025-05-24 09:23:42 +02:00
Matthias Krüger
3476b4951f
Rollup merge of #141438 - compiler-errors:dyn-compatible-call, r=lcnr
Do not try to confirm non-dyn compatible method

See the comment I left in `compiler/rustc_hir_typeck/src/method/confirm.rs`.

If we have a receiver that does not deref to the `dyn Trait` we're assembling the method from, then we used to ICE, but that's something that is possible to encounter with arbitrary self types.

r? oli-obk
Fixes https://github.com/rust-lang/rust/issues/141419
2025-05-24 09:23:40 +02:00
Matthias Krüger
293977aeb8
Rollup merge of #141429 - compiler-errors:unsafe-binder-non-structural-match, r=spastorino
Dont walk into unsafe binders when emiting error for non-structural type match

Fixes #141422.

The other two binder-having types are also special cased here, unsurprisingly.

r? oli-obk
2025-05-24 09:23:40 +02:00
Matthias Krüger
d6a61daf60
Rollup merge of #140832 - workingjubilee:aarch64-linux-should-use-frame-pointers, r=compiler-errors
aarch64-linux: Default to FramePointer::NonLeaf

For aarch64-apple and aarch64-windows, platform docs state that code must use frame pointers correctly. This is because the AAPCS64 mandates that a platform specify its frame pointer conformance requirements:
- Apple: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Respect-the-purpose-of-specific-CPU-registers
- Windows: https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers
- AAPCS64: 4492d1570e/aapcs64/aapcs64.rst (the-frame-pointer)

Unwinding code either requires unwind tables or frame pointers, and on aarch64 the expectation is that one can use frame pointers for this. Most Linux targets represent a motley variety of possible distributions, so it is unclear who to defer to on conformance, other than perhaps Arm. In the absence of a specific edict for a given aarch64-linux target, Rust will assume aarch64-linux targets also use non-leaf frame pointers. This reflects what compilers like clang do.
2025-05-23 20:30:09 +02:00
Urgau
343fecabc7 Suggest correct version("..") predicate syntax in check-cfg 2025-05-23 18:14:49 +02:00
Ralf Jung
180ab161b0 make teach_help message for cast-before-pass-to-variadic more precise 2025-05-23 15:03:56 +02:00
Michael Goulet
d0413436d5 Do not try to confirm non-dyn compatible method 2025-05-23 12:20:35 +00:00
lcnr
326b7e9a6b yeet CanonicalVarInfo 2025-05-23 12:10:53 +00:00
Matthias Krüger
225ed8b9cf
Rollup merge of #141376 - nnethercote:rename-kw-Empty, r=petrochenkov
Rename `kw::Empty` as `sym::empty`.

Because the empty string is not a keyword.

r? `@petrochenkov`
2025-05-23 13:34:20 +02:00
Matthias Krüger
f7a11798e8
Rollup merge of #140967 - azhogin:azhogin/async-drop-poll-shim-for-error-dropee-fix, r=oli-obk
Async drop poll shim for error dropee generates noop body

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

When dropee type for async drop poll shim is `ty::Error(_)`, the generated poll function will be noop body. To avoid ICE in `elaborate_drop`.
2025-05-23 13:34:17 +02:00
Matthias Krüger
1c2ea28727
Rollup merge of #136400 - lolbinarycat:rustdoc-link-lint-135851, r=GuillaumeGomez
Improve handling of rustdoc lints when used with raw doc fragments.

1. `rustdoc::bare_urls` no longer outputs incoherent suggestions if `source_span_for_markdown_range` returns None, instead outputting no suggestion
2. `source_span_for_markdown_range` has one more heuristic, so it will return `None` less often.
3. add ui test to make sure we don't emit nonsense suggestions.

fixes https://github.com/rust-lang/rust/issues/135851
2025-05-23 13:34:17 +02:00
Michael Goulet
46606a3f81 Dont walk into unsafe binders when emiting error for non-structural type match 2025-05-23 10:10:50 +00:00
bors
52bf0cf795 Auto merge of #140553 - BoxyUwU:defer_type_system_ctfe, r=compiler-errors
Defer evaluating type system constants when they use infers or params

Split out of #137972, the parts necessary for associated const equality and min generic const args to make progress and have correct semantics around when CTFE is invoked. According to a [previous perf run](https://perf.rust-lang.org/compare.html?start=93257e2d20809d82d1bc0fcc1942480d1a66d7cd&end=01b4cbf0f47c3f782330db88fa5ba199bba1f8a2&stat=instructions:u) of adding the new `const_arg_kind` query we should expect minor regressions here.

I think this is acceptable as we should be able to remove this query relatively soon once mgca is more complete as we'll then be able to implement GCE in terms of mgca and rip out `GCEConst` at which point it's trivial to determine what kind of anon const we're dealing with (either it has generics and is a repeat expr hack, or it doesnt and is a normal anon const).

This should only affect unstable code as we handle repeat exprs specially and those are the only kinds of type system consts that are allowed to make use of generic parameters.

Fixes #133066
Fixes #133199
Fixes #136894
Fixes #137813

r? compiler-errors
2025-05-23 05:30:45 +00:00
bors
e7f4317ea0 Auto merge of #135160 - RalfJung:aarch64-softfloat-not-neon, r=Noratrieb
aarch64-softfloat: forbid enabling the neon target feature

This fixes https://github.com/rust-lang/rust/issues/134375 in a rather crude way, by making [the example](https://godbolt.org/z/r56xWo8nT) not build any more on aarch64-unknown-none-softfloat. That is a breaking change since the "neon" aarch64 target feature is stable, but this is justified as a soundness fix. Note that it's not "neon" which is problematic but "fp-armv8"; however, the two are tied together by rustc.

`-Ctarget-feature=+neon` still works, it just causes a warning (but one that we do hope to make a hard error eventually). Only `#[target_feature="neon"]` becomes a hard error with this PR.

More work on the LLVM side will be needed before we can let people use neon without impacting the ABI of float values (and, in particular, the ABI used by automatically inserted calls to libm functions, e.g. for int-to-float casts, which rustc has no control over).

Nominating for `@rust-lang/lang` since it is a breaking change. As-is this PR doesn't have a warning cycle; the hope is that the aarch64-unknown-none-softfloat target is sufficiently niche that there's no huge fallout and we can easily revert if it causes trouble. A warning cycle could be added but would need some dedicated rather hacky check in the target_feature attribute handling logic.

try-job:  dist-various-1
2025-05-23 00:11:55 +00:00
Kyle Huey
caf665e692 Use the fn_span when emitting function calls for better debug info.
This especially improves the developer experience for long chains
of function calls that span multiple lines, which is common with
builder patterns, chains of iterator/future combinators, etc.
2025-05-22 14:06:24 -07:00
bors
912981a9ea Auto merge of #141396 - matthiaskrgr:rollup-feg050g, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #135562 (Add ignore value suggestion in closure body)
 - #139635 (Finalize repeat expr inference behaviour with inferred repeat counts)
 - #139668 (Handle regions equivalent to 'static in non_local_bounds)
 - #140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths)
 - #140435 (use uX::from instead of _ as uX in non - const contexts)
 - #141130 (rustc_on_unimplemented cleanups)
 - #141286 (Querify `coroutine_hidden_types`)

Failed merges:

 - #140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-22 21:02:18 +00:00
Andrew Zhogin
cb8fdb4d80 Async drop poll shim for error dropee generates noop body (fixes #140930) 2025-05-23 03:40:27 +07:00
binarycat
3005a09fed rustdoc: improve diagnostics on raw doc fragments
1. rustdoc::bare_urls doesn't output
   invalid suggestions if source_span_for_markdown_range
   fails to find a span

2. source_span_for_markdown_range tries harder to
   return a span by applying an additional diagnostic

fixes https://github.com/rust-lang/rust/issues/135851
2025-05-22 12:31:28 -05:00
bors
e3892a40a9 Auto merge of #141397 - matthiaskrgr:rollup-l9uu6g6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #141355 (ci: improve citool job db errors)
 - #141359 (Fix `FnOnce` impl for `AsyncFn`/`AsyncFnMut` self-borrowing closures in new solver)
 - #141362 (Normalize aliases to correct kind of error term)
 - #141377 (Remove unnecessary `is_empty` checks)
 - #141381 (try_cast_aligned: avoid bare int-to-ptr casts)
 - #141382 (ci: convert distcheck to free runner)
 - #141389 (ci: prepare aws access keys for migration)
 - #141390 (Don't allow `poly_select` in new solver)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-22 14:55:52 +00:00
Matthias Krüger
580bd6e16f
Rollup merge of #141390 - compiler-errors:poly-select-new-solver, r=lcnr
Don't allow `poly_select` in new solver

I added a `poly_select` call in #140519, but this causes an ICE since the new solver doesn't properly handle the "instantiate binder -> recanonicalize" step in the proof tree visitor.

While we could fix the select visitor to look at the next step in proof tree, it's not really necessary. Instead, let's enforce that all callees call the non-higher-ranked `select` function in the new solver.

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

r? lcnr
2025-05-22 16:04:16 +02:00
Matthias Krüger
74b980d3a4
Rollup merge of #141377 - nnethercote:rm-unnecessary-is_empty-checks, r=GuillaumeGomez
Remove unnecessary `is_empty` checks

Part of #137978.

r? `@GuillaumeGomez`
2025-05-22 16:04:13 +02:00
Matthias Krüger
5cab70ed7f
Rollup merge of #141362 - BoxyUwU:correct_error_term_kind, r=lcnr
Normalize aliases to correct kind of error term

Fixes #140642

When normalizing an alias to an error in the old solver, normalize to the same term kind as the alias being normalized instead of always to a type error.

r? lcnr
2025-05-22 16:04:12 +02:00
Matthias Krüger
654b2f39f1
Rollup merge of #141359 - compiler-errors:async-fn-once, r=lcnr
Fix `FnOnce` impl for `AsyncFn`/`AsyncFnMut` self-borrowing closures in new solver

This only affects closures that are "`AsyncFn`/`AsyncFnMut`" in their calling capability that are being called with the `FnOnce` trait.

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/217

r? lcnr
2025-05-22 16:04:12 +02:00
Matthias Krüger
8c2508292b
Rollup merge of #141286 - compiler-errors:querify-coroutine, r=oli-obk
Querify `coroutine_hidden_types`

This is necessary if we ever want to add implied bounds that would be used for higher-ranked coroutine auto trait goals (e.g. future implements `Send`).

Modest perf regression in `hyper` full build which (afaict?) is the only async stress test, so definitely worth it IMO.

r? oli-obk
2025-05-22 16:02:31 +02:00