Commit Graph

261347 Commits

Author SHA1 Message Date
Michael Goulet
7bca516b35 Get rid of can_eq_shallow 2024-07-22 13:54:48 -04:00
bors
20f23abbec Auto merge of #128041 - compiler-errors:uplift-errors-into-trait-sel, r=lcnr
Uplift most type-system related error reporting from `rustc_infer` to `rustc_trait_selection`

Completes the major part of #127492. The only cleanup that's needed afterwards is to actually use normalization in favor of the callback where needed, and deleting `can_eq_shallow`.

r? lcnr

Sorry for the large diff! Would prefer if comments can be handled in a follow-up (unless they're absolutely dealbreakers) because it seems bitrotty to let this sit.
2024-07-22 15:06:18 +00:00
bors
aee3dc4c6c Auto merge of #128056 - jieyouxu:rollup-zb1y27e, r=jieyouxu
Rollup of 8 pull requests

Successful merges:

 - #127177 (Distribute rustc_codegen_cranelift for arm64 macOS)
 - #127415 (Add missing try_new_uninit_slice_in and try_new_zeroed_slice_in)
 - #127510 (Rewrite `test-float-parse` in Rust)
 - #127977 (Update wasi-sdk in CI to latest release)
 - #127985 (Migrate `test-benches`, `c-unwind-abi-catch-panic` and `compiler-lookup-paths-2` `run-make` tests to rmake)
 - #127996 (Clean up warnings + `unsafe_op_in_unsafe_fn` when building std for armv6k-nintendo-3ds)
 - #128035 (Add test for #125837)
 - #128054 (mw triagebot vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-22 08:49:00 +00:00
许杰友 Jieyou Xu (Joe)
c4c0ca41f0
Rollup merge of #128054 - michaelwoerister:mwoff072024, r=jieyouxu
mw triagebot vacation

I'll be away from computers for a couple of weeks.
2024-07-22 16:44:07 +08:00
许杰友 Jieyou Xu (Joe)
f4d6d997e3
Rollup merge of #128035 - tiif:issue-125837, r=lcnr
Add test for #125837

Fixes #125837
2024-07-22 16:44:06 +08:00
许杰友 Jieyou Xu (Joe)
7d81e092a1
Rollup merge of #127996 - ian-h-chamberlain:fix/horizon-warnings-unsafe-in-unsafe, r=tgross35
Clean up warnings + `unsafe_op_in_unsafe_fn` when building std for armv6k-nintendo-3ds

See #127747

ping `@AzureMarker` `@Meziu`

I could only find one instance needing an extra `unsafe` that was not also shared with many other `unix` targets (presumably these will get covered in larger sweeping changes, I didn't want to introduce churn that would potentially conflict with those). The one codepath I found is shared with `vita` however, so also pinging `@nikarh` `@pheki` `@zetanumbers` just to make sure they're aware of this change.

Also removed one unused import from `process_unsupported` which should simply fix the warning for any target that uses it.
2024-07-22 16:44:06 +08:00
许杰友 Jieyou Xu (Joe)
5b915ab022
Rollup merge of #127985 - Oneirical:testibule-of-hell, r=Kobzol
Migrate `test-benches`, `c-unwind-abi-catch-panic` and `compiler-lookup-paths-2` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-07-22 16:44:05 +08:00
许杰友 Jieyou Xu (Joe)
c89613938d
Rollup merge of #127977 - alexcrichton:update-wasi-sdk, r=Mark-Simulacrum
Update wasi-sdk in CI to latest release

This commit updates the `wasi-sdk` download used by the `wasm32-wasi*` targets. The motivation for this commit is generally just "keep things up to date" and is not intended to cause any issues or differences from before, just a routine update.
2024-07-22 16:44:05 +08:00
许杰友 Jieyou Xu (Joe)
27550f4fa4
Rollup merge of #127510 - tgross35:test-float-parse-update, r=Mark-Simulacrum
Rewrite `test-float-parse` in Rust

Migrate from the currently broken Rust + Python `test-float-parse` to a Rust implementation. This newer version should be significantly faster (tests execute in parallel with threads, rather than series across multiple processes, which also eliminates the "...the worker processes are leaked and stick around forever" message), and should be significantly easier to extend to the new float types.

Since this is faster and hopefully more stable, we should be able to launch it with `x` and run the faster tests in CI.
2024-07-22 16:44:04 +08:00
许杰友 Jieyou Xu (Joe)
9f4039fcd5
Rollup merge of #127415 - AljoschaMeyer:master, r=dtolnay
Add missing try_new_uninit_slice_in and try_new_zeroed_slice_in

The methods for fallible slice allocation in a given allocator were missing from `Box`, which was an oversight according to https://github.com/rust-lang/wg-allocators/issues/130

This PR adds them as `try_new_uninit_slice_in` and `try_new_zeroed_slice_in`. I simply copy-pasted the implementations of `try_new_uninit_slice` and `try_new_zeroed_slice` and adusted doc comment, typings, and the allocator it uses internally.

Also adds missing punctuation to the doc comments of `try_new_uninit_slice` and `try_new_zeroed_slice`.

Related issue is https://github.com/rust-lang/rust/issues/32838 (Allocator traits and std::heap) *I think*. Also relevant is https://github.com/rust-lang/rust/issues/63291, but I did not add the corresponding `#[unstable]` proc macro, since `try_new_uninit_slice` and `try_new_zeroed_slice` are also not annotated with it.
2024-07-22 16:44:03 +08:00
许杰友 Jieyou Xu (Joe)
b66b4020d8
Rollup merge of #127177 - bjorn3:arm64_macos_cg_clif, r=Mark-Simulacrum
Distribute rustc_codegen_cranelift for arm64 macOS

Support for arm64 macOS has been added to rustc_codegen_cranelift recently.

Fixes https://github.com/rust-lang/rustc_codegen_cranelift/issues/1502
2024-07-22 16:44:02 +08:00
Michael Woerister
ab71870f8d mw out of office 2024-07-22 10:05:56 +02:00
Aljoscha Meyer
351fe27354
Use given allocator instad of Global 2024-07-22 08:17:46 +02:00
bors
ae7b1c1916 Auto merge of #127442 - saethlin:alloc-decoding-lock, r=oli-obk
Try to fix ICE from re-interning an AllocId with different allocation contents

As far as I can tell, based on my investigation in https://github.com/rust-lang/rust/issues/126741, the racy decoding scheme implemented here was never fully correct, but the arrangement of Allocations that's required to ICE the compiler requires some very specific MIR optimizations to create. As far as I can tell, GVN likes to create the problematic pattern, which is why we're noticing this problem now.

So the solution here is to not do racy decoding. If two threads race to decoding an AllocId, one of them is going to sit on a lock until the other is done.
2024-07-22 05:56:05 +00:00
bors
ee0fd6caf7 Auto merge of #128048 - workingjubilee:rollup-gehtjxd, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

 - #127583 (Deal with invalid UTF-8 from `gai_strerror`)
 - #128014 (Fix stab display in doc blocks)
 - #128020 (Just totally fully deny late-bound consts)
 - #128023 (rustdoc: short descriptions cause word-breaks in tables)
 - #128033 (Explain why we require `_` for empty patterns)
 - #128038 (Don't output incremental test artifacts into working directory)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-22 03:31:16 +00:00
Michael Goulet
e9e9495f21 Fix tools 2024-07-21 22:34:37 -04:00
Michael Goulet
ce8a625092 Move all error reporting into rustc_trait_selection 2024-07-21 22:34:35 -04:00
Michael Goulet
f49738ba6c Move need_type_info too 2024-07-21 22:33:15 -04:00
Michael Goulet
5accaf3af4 Make type_var_origin take a vid 2024-07-21 22:33:15 -04:00
Michael Goulet
fc1e7ceb4b Move some stuff to TypeErrCtxt 2024-07-21 22:33:15 -04:00
Jubilee
fdef1d9592
Rollup merge of #128038 - compiler-errors:inc-fat, r=oli-obk
Don't output incremental test artifacts into working directory

Currently tests can ICE when the test spits out `inc-fat` incremental artifacts directly into the top of the git checkout, and then the compiler version changes, and it reads nonsense incremental artifacts on a subsequent test run.

r? `@oli-obk`

cc `@Oneirical,` I think you added this -- I think the right flag to add when porting `-Cincremental` run-make tests is to use `//@ incremental` rather than manually specifying the `-Cincremental` rustflag.
2024-07-21 17:44:30 -07:00
Jubilee
d484654a5e
Rollup merge of #128033 - Nadrieril:explain-empty-wildcards, r=compiler-errors
Explain why we require `_` for empty patterns

This adds a note to the "non-exhaustive patterns" diagnostic to explain why we sometimes require extra `_` patterns on empty types. This is one of the two diagnostic improvements I wanted to do before [stabilizing `min_exhaustive_patterns`](https://github.com/rust-lang/rust/pull/122792).

r? ``@compiler-errors``
2024-07-21 17:44:30 -07:00
Jubilee
b9c9f07db0
Rollup merge of #128023 - Kijewski:pr-table-width, r=notriddle
rustdoc: short descriptions cause word-breaks in tables

The `.item-table` class is used to display name+description lists, e.g. the exported functions, as a table. If the names are long and the descriptions are short, then the width of the table does not expand to the whole size, but only uses a fraction. This causes a some names to break inside a word.

This change makes the table always use 100% of its parent width. The `.width-limiter` wrapper already ensures that the used width still does not become excessive.

See e.g. <https://docs.rs/mathlab/0.3.0/mathlab/fun/vec_num/index.html> or <https://docs.rs/cw-events/0.0.9/cw_events/> (random choices out of the list of the recent releases).

[![](https://i.imgur.com/XnH4eeT.png)](https://imgur.com/XnH4eeT) [![](https://i.imgur.com/7iQ9xE2.png)](https://imgur.com/7iQ9xE2)

The problem occurs (at least) in Firefox 130, Falkon 24, and Konqueror 22. It does not occur in Chrome 126.
2024-07-21 17:44:29 -07:00
Jubilee
2ef7699a1a
Rollup merge of #128020 - compiler-errors:nlb-no-const, r=BoxyUwU
Just totally fully deny late-bound consts

Kinda don't care about supporting this until we have where clauses on binders. They're super busted and should be reworked in due time, and they are approximately 100% useless until then 😸

Fixes #127970
Fixes #127009

r? ``@BoxyUwU``
2024-07-21 17:44:29 -07:00
Jubilee
5bd7525856
Rollup merge of #128014 - GuillaumeGomez:stab-in-doc-blocks, r=notriddle
Fix stab display in doc blocks

Went across this bug randomly:

![Screenshot from 2024-07-20 22-09-49](https://github.com/user-attachments/assets/89fdf427-b00e-4fcb-9d57-078bcb1bacd9)

With the fixed CSS:

![Screenshot from 2024-07-20 22-10-14](https://github.com/user-attachments/assets/eda9a1a6-6a12-408f-bd3a-25bb3397d163)

r? ```@notriddle```
2024-07-21 17:44:28 -07:00
Jubilee
6af66e836f
Rollup merge of #127583 - Nilstrieb:invalid-utf8, r=joboet
Deal with invalid UTF-8 from `gai_strerror`

When the system is using a non-UTF-8 locale, the value will indeed not be UTF-8. That sucks for everyone involved, but is no reason for panic. We can "handle" this gracefully by just using from lossy, replacing the invalid UTF-8 with � and keeping the accidentally valid UTF-8. Good luck when debugging, but at least it's not a crash.

We already do this for `strerror_r`.

fixes #127563
2024-07-21 17:44:27 -07:00
Ian Chamberlain
dba6b74dd8
Fix warnings when checking armv6k-nintendo-3ds
Also fix one instance of unsafe_op_in_unsafe_fn that's specific to
horizon + vita - most others should be common with other code.
2024-07-21 20:12:54 -04:00
bors
0f8534e79e Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnr
Remove unnecessary impl sorting in queries and metadata

Removes unnecessary impl sorting because queries already return their keys in HIR definition order: https://github.com/rust-lang/rust/issues/120371#issuecomment-1926422838

r? `@cjgillot` or `@lcnr` -- unless I totally misunderstood what was being asked for here? 😆

fixes #120371
2024-07-21 22:43:47 +00:00
Michael Goulet
6a9110aa5a Don't output test artifacts into working directory 2024-07-21 13:45:55 -04:00
Trevor Gross
d12387835f Run test-float-parse as part of CI
With the previous improvements, it is now possible to run float parsing
tests as part of CI. Enable it here.

This only runs a subset of tests, which takes about one minute.
2024-07-21 11:57:10 -05:00
Ben Kimock
107cf981d5 Explain why the new setup can't deadlock 2024-07-21 12:31:25 -04:00
tiif
95f091693f Add test 2024-07-21 21:42:10 +08:00
Nadrieril
8a49d83db7 Explain why we require _ for empty patterns 2024-07-21 15:24:27 +02:00
Nadrieril
710add58e2 Tweak collect_non_exhaustive_tys 2024-07-21 15:24:27 +02:00
Nilstrieb
ae42efc522 Deal with invalid UTF-8 from gai_strerror
When the system is using a non-UTF-8 locale, the value will indeed not
be UTF-8. That sucks for everyone involved, but is no reason for panic.
We can "handle" this gracefully by just using from lossy, replacing the
invalid UTF-8 with the ? and keeping the accidentally valid UTF-8.
Good luck when debugging, but at least it's not a crash.

We already do this for `strerror_r`.
2024-07-21 13:22:03 +02:00
Guillaume Gomez
84db684f49 Update source-code-page-code-scroll.goml GUI test 2024-07-21 12:47:34 +02:00
Guillaume Gomez
e4d701b1d3 Add regression test for stab display in doc blocks 2024-07-21 11:52:24 +02:00
bors
92c6c03805 Auto merge of #127993 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in a2b58c3dad4d554ba01ed6c45c41ff85390560f2..5f6b9a92201d78af75dc24f14662c3e2dacbbbe1
2024-07-16 00:52:02 +0000 to 2024-07-19 18:09:17 +0000
- Add `TomlPackage::new`, `Default` for `TomlWorkspace` (rust-lang/cargo#14271)
- fix(test): Move 'cargo_home' from 'install' to 'paths' (rust-lang/cargo#14270)
- fix(test)!: Clarify extension trait role with rename (rust-lang/cargo#14269)
- feat(test): Re-export ProcessBuilder (rust-lang/cargo#14268)
- fix(test): Move path2url to CargoPathExt::to_url (rust-lang/cargo#14266)
- Fix passing of links-overrides with target-applies-to-host and an implicit target (rust-lang/cargo#14205)
- fix(toml): Improve error on missing package and workspace (rust-lang/cargo#14261)
- Migrate global_cache_tracker snapbox (rust-lang/cargo#14244)
- make summary sync by using Arc not Rc (rust-lang/cargo#14260)
2024-07-21 09:06:47 +00:00
bors
9629b90b3f Auto merge of #127722 - BoxyUwU:new_adt_const_params_limitations, r=compiler-errors
Forbid borrows and unsized types from being used as the type of a const generic under `adt_const_params`

Fixes #112219
Fixes #112124
Fixes #112125

### Motivation

Currently the `adt_const_params` feature allows writing `Foo<const N: [u8]>` this is entirely useless as it is not possible to write an expression which evaluates to a type that is not `Sized`. In order to actually use unsized types in const generics they are typically written as `const N: &[u8]` which *is* possible to provide a value of.

Unfortunately allowing the types of const parameters to contain references is non trivial (#120961) as it introduces a number of difficult questions about how equality of references in the type system should behave. References in the types of const generics is largely only useful for using unsized types in const generics.

This PR introduces a new feature gate `unsized_const_parameters` and moves support for `const N: [u8]` and `const N: &...` from `adt_const_params` into it. The goal here hopefully is to experiment with allowing `const N: [u8]` to work without references and then eventually completely forbid references in const generics.

Splitting this out into a new feature gate means that stabilization of `adt_const_params` does not have to resolve #120961 which is the only remaining "big" blocker for the feature. Remaining issues after this are a few ICEs and naming bikeshed for `ConstParamTy`.

### Implementation

The implementation is slightly subtle here as we would like to ensure that a stabilization of `adt_const_params` is forwards compatible with any outcome of `unsized_const_parameters`. This is inherently tricky as we do not support unstable trait implementations and we determine whether a type is valid as the type of a const parameter via a trait bound.

There are a few constraints here:
- We would like to *allow for the possibility* of adding a `Sized` supertrait to `ConstParamTy` in the event that we wind up opting to not support unsized types and instead requiring people to write the 'sized version', e.g. `const N: [u8; M]` instead of `const N: [u8]`.
- Crates should be able to enable `unsized_const_parameters` and write trait implementations of `ConstParamTy` for `!Sized` types without downstream crates that only enable `adt_const_params` being able to observe this (required for std to be able to `impl<T> ConstParamTy for [T]`

Ultimately the way this is accomplished is via having two traits (sad), `ConstParamTy` and `UnsizedConstParamTy`. Depending on whether `unsized_const_parameters` is enabled or not we change which trait is used to check whether a type is allowed to be a const parameter.

Long term (when stabilizing `UnsizedConstParamTy`) it should be possible to completely merge these traits (and derive macros), only having a single `trait ConstParamTy` and `macro ConstParamTy`.

Under `adt_const_params` it is now illegal to directly refer to `ConstParamTy` it is only used as an internal impl detail by `derive(ConstParamTy)` and checking const parameters are well formed. This is necessary in order to ensure forwards compatibility with all possible future directions for `feature(unsized_const_parameters)`.

Generally the intuition here should be that `ConstParamTy` is the stable trait that everything uses, and `UnsizedConstParamTy` is that plus unstable implementations (well, I suppose `ConstParamTy` isn't stable yet :P).
2024-07-21 05:36:21 +00:00
bors
a62ac152ad Auto merge of #127715 - klensy:tests-w, r=Mark-Simulacrum
reenable some windows tests

Locally passing on `x86_64-pc-windows-msvc`, fingers crossed for `*-pc-windows-gnu`.

try-job: x86_64-msvc
try-job: x86_64-mingw
2024-07-21 03:06:32 +00:00
bors
2430c48b57 Auto merge of #128011 - matthiaskrgr:rollup-0vmf75y, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #127720 ([`macro_metavar_expr_concat`] Allow `concat` in repetitions)
 - #127734 (Windows: move BSD socket shims to netc)
 - #127752 (Ignore allocation bytes in one more mir-opt test)
 - #127839 (Fix git safe-directory path for docker images)
 - #127867 (Add `wasm32-wasip2` to `build-manifest` tool)
 - #127958 (Cleanup rmake.rs setup in compiletest)
 - #127975 (Fix trait bounds display)
 - #128005 (Remove _tls_used hack)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-21 00:39:36 +00:00
René Kijewski
95335444f7 rustdoc: short descr. cause word-breaks in tables
The `.item-table` class is used to display name+description lists, e.g.
the exported functions, as a table. If the names are long and the
descriptions are short, then the width of the table does not expand to
the whole size, but only uses a fraction. This causes a some names to
break inside a word.

This change makes the table always use 100% of its parent width. The
`.width-limiter` wrapper already ensures that the used width still does
not become excessive.

Signed-off-by: René Kijewski <rene.kijewski@fu-berlin.de>
2024-07-21 02:28:04 +02:00
Michael Goulet
3862095bd2 Just totally fully deny late-bound consts 2024-07-20 19:45:24 -04:00
bors
c1a631d733 Auto merge of #128007 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
Bump to 1.82

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-t-6-days-friday-the-week-before

r? `@Mark-Simulacrum`
2024-07-20 22:14:40 +00:00
Guillaume Gomez
ee034f4912 Fix stab display in doc blocks 2024-07-20 22:31:53 +02:00
Mark Rousskov
94a4279fba Allow deprecated temporarily to unblock version bump 2024-07-20 15:51:58 -04:00
bors
5069856495 Auto merge of #127663 - Oneirical:fuzzy-testure, r=jieyouxu
Migrate 9 more very similar FFI `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

For the tracking issue:

- return-non-c-like-enum-from-c
- pass-non-c-like-enum-to-c
- c-static-dylib
- c-static-rlib
- extern-fn-generic
- extern-fn-with-union
- lto-no-link-whole-rlib
- linkage-attr-on-static
- issue-28595
2024-07-20 19:49:49 +00:00
Matthias Krüger
8fe93c9bec
Rollup merge of #128005 - ChrisDenton:msvc-include, r=joboet
Remove _tls_used hack

All the MSVC targets use `target_thread_locals` (see the [base spec](1afc5fd042/compiler/rustc_target/src/spec/base/windows_msvc.rs (L34))) so this hack is no longer needed. The compiler will ensure that thread locals work properly.
2024-07-20 19:29:00 +02:00
Matthias Krüger
17aaba70d9
Rollup merge of #127975 - GuillaumeGomez:fix-trait-bounds-display, r=notriddle
Fix trait bounds display

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

I took a simple rule: if there are more than two bounds, we display them like rustfmt.

Before this PR:

![Screenshot from 2024-07-19 17-38-59](https://github.com/user-attachments/assets/4162b57e-7ebb-48f9-a3a1-25e443c140cb)

After this PR:

![Screenshot from 2024-07-19 17-39-09](https://github.com/user-attachments/assets/a3ba22dd-5f34-45d0-ad9d-0cdf89dc509c)

r? `@notriddle`
2024-07-20 19:29:00 +02:00
Matthias Krüger
ae28d5c9e7
Rollup merge of #127958 - jieyouxu:compiletest-rmake-cleanup, r=Kobzol
Cleanup rmake.rs setup in compiletest

While debugging rmake.rs tests I realized that the rmake.rs setup itself in compiletest is very messy and confused. Now that I know some of the bootstrap steps and the rmake.rs tests themselves better, I realized there are cleanups that are possible:

- Rework how `source_root` and `build_root` are calculated. They should now be less fragile then before.
- Shuffle around path calculations to make them more logically grouped and closer to eventual use site(s).
- Cleanup executable extension calculation with `std::env::consts::EXE_EXTENSION`.
- Cleanup various dylib search path handling: renamed variables to better reflect their purpose, minimized mutability scope of said variables.
- Prune useless env vars passed to both `rustc` and recipe binary commands.
- Vastly improve the documentation for the setup of rmake.rs tests, including assumed bootstrap-provided build layouts, rmake.rs test layout, dylib search paths, intended purpose of passed env vars and the `COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0` stage0 sysroot special handling.

This PR is best reviewed commit-by-commit.

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

r? bootstrap (or Kobzol, or Mark, or T-compiler)

try-job: aarch64-apple
try-job: armhf-gnu
try-job: dist-x86_64-linux
try-job: test-various
try-job: x86_64-mingw
try-job: x86_64-msvc
try-job: x86_64-gnu-llvm-18
2024-07-20 19:28:59 +02:00