Commit Graph

277127 Commits

Author SHA1 Message Date
bors
2a8af4f7c8 Auto merge of #133955 - bjorn3:cc_pass_arch_only, r=ChrisDenton
Pass the arch rather than full target name to windows_registry::find_tool

The full target name can be anything with custom target specs. Passing just the arch wasn't possible before cc 1.2, but is now thanks to https://github.com/rust-lang/cc-rs/pull/1285.

try-job: i686-msvc
2025-01-04 15:42:31 +00:00
bors
fd127a3a84 Auto merge of #135031 - RalfJung:intrinsics-without-body, r=oli-obk
rustc_intrinsic: support functions without body

We synthesize a HIR body `loop {}` but such bodyless intrinsics.

Most of the diff is due to turning `ItemKind::Fn` into a brace (named-field) enum variant, because it carries a `bool`-typed field now. This is to remember whether the function has a body. MIR building panics to avoid ever translating the fake `loop {}` body, and the intrinsic logic uses the lack of a body to implicitly mark that intrinsic as must-be-overridden.

I first tried actually having no body rather than generating the fake body, but there's a *lot* of code that assumes that all function items have HIR and MIR, so this didn't work very well. Then I noticed that even `rustc_intrinsic_must_be_overridden` intrinsics have MIR generated (they are filled with an `Unreachable` terminator) so I guess I am not the first to discover this. ;)

r? `@oli-obk`
2025-01-04 12:50:38 +00:00
Ralf Jung
3cd3649c6c rustc_intrinsic: support functions without body; they are implicitly marked as must-be-overridden 2025-01-04 11:41:51 +01:00
Ralf Jung
be65012aa3 turn hir::ItemKind::Fn into a named-field variant 2025-01-04 11:35:31 +01:00
bors
f17cf744f5 Auto merge of #135095 - matthiaskrgr:rollup-tmgxckq, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #133964 (core: implement `bool::select_unpredictable`)
 - #135001 (Allow using self-contained LLD in bootstrap)
 - #135055 (Report impl method has stricter requirements even when RPITIT inference gets in the way)
 - #135064 (const-in-pattern: test that the PartialEq impl does not need to be const)
 - #135066 (bootstrap: support `./x check run-make-support`)
 - #135069 (remove unused function params)
 - #135084 (Update carrying_mul_add test to tolerate `nuw`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-04 10:02:59 +00:00
Matthias Krüger
75e412b8d1
Rollup merge of #135084 - maurer:nuw, r=nikic
Update carrying_mul_add test to tolerate `nuw`

LLVM 20 adds nuw to GEP operations in this code, tolerate them.

`@rustbot` label: +llvm-main

r? `@durin42`
2025-01-04 09:54:40 +01:00
Matthias Krüger
725b799478
Rollup merge of #135069 - matthiaskrgr:param_rec_usage, r=jieyouxu
remove unused function params
2025-01-04 09:54:39 +01:00
Matthias Krüger
e4cc2db519
Rollup merge of #135066 - jieyouxu:check-run-make-support, r=clubby789
bootstrap: support `./x check run-make-support`

Mostly for working on `src/tools/run-make-support` locally.
2025-01-04 09:54:39 +01:00
Matthias Krüger
966a5be559
Rollup merge of #135064 - RalfJung:const-in-pat-partial-eq-not-const, r=compiler-errors
const-in-pattern: test that the PartialEq impl does not need to be const

Fixes https://github.com/rust-lang/rust/issues/119398 by adding a test.

`@compiler-errors`  is there some place in the code where we could add a comment saying "as a backcompat hack, here we only require `PartialEq` and not `const PartialEq`"?

r? `@compiler-errors`
2025-01-04 09:54:38 +01:00
Matthias Krüger
b0b54f2f8b
Rollup merge of #135055 - compiler-errors:rpitit-infer-in-stricter-impl, r=estebank
Report impl method has stricter requirements even when RPITIT inference gets in the way

See the comment I added in the code. Fixes #122506.
2025-01-04 09:54:38 +01:00
Matthias Krüger
8744b44e6b
Rollup merge of #135001 - Kobzol:bootstrap-mcp-510, r=onur-ozkan
Allow using self-contained LLD in bootstrap

In https://github.com/rust-lang/rust/pull/116278, I added a `"self-contained"` mode to the `rust.use-lld` bootstrap option, which was designed for using the built-in LLD for linking compiler artifacts. However, this was later reverted in https://github.com/rust-lang/rust/pull/118810.

This PR brings the old logic back, which switches LLD in bootstrap from `-fuse-ld=lld` to [MCP510](https://github.com/rust-lang/compiler-team/issues/510)'s way of passing linker flags to enable LLD (both external and self-contained). So this does two changes:
1) Goes from `-fuse-ld=lld` to MCP510
2) Actually makes it possible to use the self-contained LLD to compile compiler artifacts

Regarding the second commit: Since https://github.com/rust-lang/rust/pull/86113, we have been passing `-fuse-ld=lld` as a target flag to all tests when `use-lld = true` is enabled. This kind of worked for all tests, since it was just a linker argument, which has bypassed any compiler checks, and probably resulted only in some warning if the given target linker didn't actually support LLD. However, after the first commit, some tests actually start failing with this approach:
```
error: linker flavor `gnu-lld-cc` is incompatible with the current target
   |
   = note: compatible flavors are: llbc, ptx
```
So the second commit removes the passing of LLD flags as target flags to tests. I don't think that it's a good idea to pass specific compiler flags to all tests unconditionally, tbh. The doctest command from #86113 doesn't go through compiletest anymore, and doctests should be quite a lot faster since https://github.com/rust-lang/rust/pull/126245 in general.

CC `@the8472`

If someone has a beefy machine, it would be nice to test whether this doesn't regress test execution speed. How to do that:
1) Enable `rust.use-lld = true` and `rust.lld = true` in `config.toml`
2) Benchmark `./x test tests/ui --force-rerun` between `master` and this PR

Once this is tested in the wild, I would like to make the self-contained LLD the default in CI, hopefully to make CI builds faster.

r? `@onur-ozkan`
2025-01-04 09:54:37 +01:00
Matthias Krüger
695da5b782
Rollup merge of #133964 - joboet:select_unpredictable, r=tgross35
core: implement `bool::select_unpredictable`

Tracking issue: #133962
ACP: https://github.com/rust-lang/libs-team/issues/468
2025-01-04 09:54:36 +01:00
bors
49761b073c Auto merge of #135067 - ChrisDenton:cc, r=jieyouxu
Bump cc in the compiler

Changelog:

- Regenerate target info ([#1342](https://github.com/rust-lang/cc-rs/pull/1342))
- Allow using Visual Studio target names in `find_tool` ([#1335](https://github.com/rust-lang/cc-rs/pull/1335))
- Fix `is_flag_supported` on msvc ([#1336](https://github.com/rust-lang/cc-rs/pull/1336))
2025-01-04 07:18:33 +00:00
bors
7349f6b503 Auto merge of #135057 - compiler-errors:project-unconstrained, r=oli-obk
Project to `TyKind::Error` when there are unconstrained non-lifetime (ty/const) impl params

It splits the `enforce_impl_params_are_constrained` function into lifetime/non-lifetime, and queryfies the latter. We can then use the result of the latter query (`Result<(), ErrorGuaranteed>`) to intercept projection and constrain the projected type to `TyKind::Error`, which ensures that we leak no ty or const vars to places that don't expect them, like `normalize_erasing_regions`.

The reason we split `enforce_impl_params_are_constrained` into two parts is because we only error for *lifetimes* if the lifetime ends up showing up in any of the associated types of the impl (e.g. we allow `impl<'a> Foo { type Assoc = (); }`). However, in order to compute the `type_of` query for the anonymous associated type of an RPITIT, we need to do trait solving (in `query collect_return_position_impl_trait_in_trait_tys`). That would induce cycles. Luckily, it turns out for lifetimes we don't even care about if they're unconstrained, since they're erased in all contexts that we are trying to fix ICEs. So it's sufficient to keep this check separated out of the query.

I think this is a bit less invasive of an approach compared to #127973. The major difference between this PR and that PR is that we queryify the check instead of merging it into the `explicit_predicates_of` query, and we use the result to taint just projection goals, rather than trait goals too. This doesn't require a lot of new tracking in `ItemCtxt` and `GenericPredicates`, and it also seems to not require any other changes to typeck like that PR did.

Fixes #123141
Fixes #125874
Fixes #126942
Fixes #127804
Fixes #130967

r? oli-obk
2025-01-04 04:35:55 +00:00
bors
d13c80a6fd Auto merge of #135089 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7..fd784878cfa843e3e29a6654ecf564c62fae6735
2024-12-31 20:51:21 +0000 to 2025-01-03 20:06:26 +0000
- chore: bump gix-lock to remove thiserror@1 from `cargo` (rust-lang/cargo#15012)
- refactor(manifest): Clean up field -&gt; env var handling (rust-lang/cargo#15008)
- chore(deps): update rust crate thiserror to v2 (rust-lang/cargo#14998)
- test(git): Clean up shallow fetch tests (rust-lang/cargo#15002)
- fix(schema): Correct and update the JSON Schema (rust-lang/cargo#15000)
- chore(deps): update rust crate itertools to 0.14.0 (rust-lang/cargo#14996)
- fix: env table config can't trigger rebuild with `rerun-if-env-changed`. (rust-lang/cargo#14756)
- chore(deps): update alpine docker tag to v3.21 (rust-lang/cargo#14995)
- fix(package): check dirtiness of symlinks source files (rust-lang/cargo#14981)
2025-01-04 01:26:57 +00:00
Weihang Lo
20a44e64c3
Update cargo 2025-01-03 17:53:10 -05:00
bors
8d2c06d151 Auto merge of #135086 - matthiaskrgr:rollup-3sfnc1w, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #133420 (Switch rtems target to panic unwind)
 - #134965 (Make Boxy UwU)
 - #135007 (Some type-outlives computation tweaks)
 - #135036 (run-make-support: adjust assertion printing, add some basic sanity checks)
 - #135043 (rustdoc: treat `allowed_through_unstable_modules` as deprecation)
 - #135044 (Improve infer (`_`) suggestions in `const`s and `static`s)
 - #135058 (refactor bootstrap path resolution)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-03 22:42:57 +00:00
Matthias Krüger
c02499feb1
Rollup merge of #135058 - onur-ozkan:path-resolution, r=jieyouxu
refactor bootstrap path resolution

Previously we removed paths as soon as we found the first intersection, which made it impossible to find other intersecting paths (and that is the reason of https://github.com/rust-lang/rust/issues/135022).

This patch changes that by marking the intersecting paths instead, so we can collect them all and remove them together when needed. Which means, `x build compiler` would compile anything that ends or starts with `"compiler"` instead of picking the first matching `Step` from `builder::get_step_descriptions`.

Fixes https://github.com/rust-lang/rust/issues/135022
2025-01-03 22:12:45 +01:00
Matthias Krüger
12cc9b4b6f
Rollup merge of #135044 - compiler-errors:better-infer-suggestions-in-const, r=oli-obk
Improve infer (`_`) suggestions in `const`s and `static`s

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

This PR does a few things to (imo) greatly improve the error message when users write something like `static FOO: [i32; _] = [1, 2, 3]`.

Firstly, it adapts the recovery code for when we encounter `_` in a const/static to work a bit more like `fn foo() -> _`, and removes the somewhat redundant query `diagnostic_only_typeck`.

Secondly, it changes the lowering for `[T; _]` to always lower under the `feature(generic_arg_infer)` logic to `ConstArgKind::Infer`. We still issue the feature error, so it's not doing anything *observable* on the good path, but it does mean that we no longer erroneously interpret `[T; _]`'s array length as a `_` **wildcard expression** (à la destructuring assignment, like `(_, y) = expr`).

Lastly it makes the suggestions verbose and fixes (well, suppresses) a bug with stashing and suggestions.

r? oli-obk
2025-01-03 22:12:45 +01:00
Matthias Krüger
f0c03f640a
Rollup merge of #135043 - notriddle:notriddle/allowed-through-unstable-modules-is-a-deprecation-flag, r=GuillaumeGomez
rustdoc: treat `allowed_through_unstable_modules` as deprecation

This ensures `std::intrinsics::transmute` is deemphasized in the search engine and other UI, by cleaning it into a deprecation without propagating it through reexports when the parent module is stable.

Fixes #131676

Related to #135003

r? ``@GuillaumeGomez``

``@RalfJung`` ``@workingjubilee``
2025-01-03 22:12:44 +01:00
Matthias Krüger
564a29dbfb
Rollup merge of #135036 - jieyouxu:rmake-be-quiet, r=compiler-errors
run-make-support: adjust assertion printing, add some basic sanity checks

cc ``@Noratrieb``

I think we may have unintentionally regressed this recently and double-printed (or printed even when the assertions didn't fail). This PR should condition the detail dumps only when the assertions fail.

Added some basic sanity checks for the assertions helpers except for the directory comparisons. That particular helper is not robust against symlinks, and I intend to address it in a follow-up (issue is #135037).

r? bootstrap (or compiler)
2025-01-03 22:12:43 +01:00
Matthias Krüger
cdfe3d7f4a
Rollup merge of #135007 - compiler-errors:outlives-tweaks, r=oli-obk
Some type-outlives computation tweaks

Some tweaks that I wrote when investigating https://github.com/rust-lang/rust/issues/135006.

The only commit that's probably interesting here is f3646748cd (the first commit). For some reason it was concerned with filtering out param-env outlives clauses when they matched item-bound outlives clauses. However, if you look at the rest of the control flow for that function, not filtering out those bounds doesn't actually affect the behavior materially.
2025-01-03 22:12:43 +01:00
Matthias Krüger
d1c7ad081f
Rollup merge of #134965 - Noratrieb:slightly-late-for-boxing-day-sadly-but-still-almost, r=BoxyUwU
Make Boxy UwU

as requested by

r? ``@BoxyUwU``

, supersedes #129906

We need 2 entries here, the first one tells us that this email and this name is canonical for you, the second entry maps that email to your canonical email (and name).
2025-01-03 22:12:42 +01:00
Matthias Krüger
4cd289550f
Rollup merge of #133420 - thesummer:rtems-unwind, r=workingjubilee
Switch rtems target to panic unwind

Switch the RTEMS target to `panic_unwind`.

Relates to https://github.com/rust-lang/backtrace-rs/pull/682
2025-01-03 22:12:41 +01:00
Matthew Maurer
ed005245c6 Update carrying_mul_add test to tolerate nuw
LLVM 20 adds nuw to GEP operations in this code, tolerate them.
2025-01-03 20:25:14 +00:00
joboet
8f3aa358bf
add codegen test for bool::select_unpredictable 2025-01-03 19:44:08 +01:00
bors
3f43b1a636 Auto merge of #135034 - Noratrieb:strip-correctly, r=jieyouxu
Pass objcopy args for stripping on OSX

When `-Cstrip` was changed in #131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved.

But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default.

Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything.

We now correctly pass `--strip-debug` and `--strip-all`.

fixes #135028

try-job: aarch64-apple
try-job: dist-aarch64-apple
2025-01-03 17:20:39 +00:00
Ralf Jung
b806dccdc4 const-in-pattern: test that the PartialEq impl does not need to be const 2025-01-03 16:08:29 +01:00
bors
6c8347b958 Auto merge of #135063 - pietroalbini:pa-bump-version, r=pietroalbini
Bump version to 1.86.0

Part of the release process.

r? `@ghost`
2025-01-03 14:14:58 +00:00
Matthias Krüger
e839d05e11 remove unused function params 2025-01-03 13:30:26 +01:00
许杰友 Jieyou Xu (Joe)
6175d73862 run-make-support: tidy up assertion failure dumping
Avoid double-dumping or dumping even when assertion is successful.
2025-01-03 20:06:46 +08:00
许杰友 Jieyou Xu (Joe)
7b763031e1 run-make-support: add basic sanity tests for assertion helpers 2025-01-03 19:57:30 +08:00
许杰友 Jieyou Xu (Joe)
f7d0842198 run-make-support: convert assertion_helpers to module 2025-01-03 19:56:30 +08:00
许杰友 Jieyou Xu (Joe)
6628c4b8fb bootstrap: support ./x check run-make-support 2025-01-03 19:53:26 +08:00
Chris Denton
cfe61320b8
Bump cc in the compiler 2025-01-03 11:51:13 +00:00
Pietro Albini
22002dbf04
bump version 2025-01-03 10:36:06 +01:00
bors
319f5292a1 Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #131729 (Make the `test` cfg a userspace check-cfg)
 - #134241 (more concrete source url of std docs [V2])
 - #135042 (taint fcx on selection errors during unsizing)
 - #135049 (Remove unused fields from RepeatElementCopy obligation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-03 09:34:23 +00:00
onur-ozkan
baa7fcec85 add coverage for multiple paths
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-03 10:01:22 +03:00
Matthias Krüger
0053aa4e9d
Rollup merge of #135049 - cramertj:rmunused, r=compiler-errors
Remove unused fields from RepeatElementCopy obligation
2025-01-03 07:57:27 +01:00
Matthias Krüger
e0f4dc955a
Rollup merge of #135042 - lukas-code:taint-dyn-incompat, r=compiler-errors
taint fcx on selection errors during unsizing

With `feature(dyn_compatible_for_dispatch)` we only check for dyn-compatibility by checking the `T: Unsize<dyn Trait>` predicate during the unsizing coercions checks. If the predicate doesn't hold, we emit an error, but pretend the coercion succeeded to prevent further errors. To prevent const eval from attempting to actually perform this coercion, we need to taint the fcx after reporting the trait errors in the coercion check.

fixes https://github.com/rust-lang/rust/issues/135021
fixes https://github.com/rust-lang/rust/issues/130521
2025-01-03 07:57:26 +01:00
Matthias Krüger
e11d5f88a2
Rollup merge of #134241 - liigo:patch-16, r=dtolnay
more concrete source url of std docs [V2]

r? jhpratt
since you have reivewed https://github.com/rust-lang/rust/pull/134193

> If someone is looking to contribute, they will want the repository as a whole, not the lib.rs for std.

Now the repository url is reserved, I just add another concrete url as an example, to help people finding target page more quickly&easily.
2025-01-03 07:57:25 +01:00
Matthias Krüger
8439ae7422
Rollup merge of #131729 - Urgau:check-cfg-test-userspace, r=petrochenkov
Make the `test` cfg a userspace check-cfg

This PR implements MCP https://github.com/rust-lang/compiler-team/issues/785, which makes the `test` cfg a "userspace" check-cfg, i.e. no longer included in the well known cfg list.

Things to do:

- [x] Accept the MCP (https://github.com/rust-lang/compiler-team/issues/785#issuecomment-2424121886)
- [x] Mark `test` in Cargo (https://github.com/rust-lang/cargo/pull/14963)

`@rustbot` labels +S-waiting-on-MCP +F-check_cfg
r? `@petrochenkov`
2025-01-03 07:57:24 +01:00
onur-ozkan
3807440a00 avoid early return to handle all paths
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-03 09:54:36 +03:00
bors
ac00fe89a1 Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35
Move some things to `std::sync::poison` and reexport them in `std::sync`

Tracking issue: #134646

r? `@tgross35`

I've used `sync_poison_mod` feature flag instead, because `sync_poison` had already been used back in 1.2.

try-job: x86_64-msvc
2025-01-03 06:40:28 +00:00
onur-ozkan
be2f75f3b7 Revert "bootstrap: temporarily flip compile::Rustc vs compile::Assemble"
This reverts commit 552c1f5f45.
2025-01-03 08:57:58 +03:00
onur-ozkan
c367c62b27 revert step order from #134919
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-03 08:57:19 +03:00
onur-ozkan
00cd943709 adapt bootstrap tests to the new path resolution logic
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-03 08:57:16 +03:00
onur-ozkan
a8516c052e refactor bootstrap path resolution
Previously we removed paths as soon as we found the first intersection, which made
it impossible to find other intersecting paths. This patch changes that by marking
the intersecting paths instead, so we can collect them all and remove them together
when needed.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-03 08:57:13 +03:00
Michael Goulet
7143ef6550 Also in the new solver 2025-01-03 05:22:14 +00:00
Michael Goulet
2d602ea793 Do not project when there are unconstrained impl params 2025-01-03 05:01:14 +00:00