Commit Graph

261314 Commits

Author SHA1 Message Date
Guillaume Gomez
e8e6111f86 Migrate run-make/link-framework to rmake.rs 2024-07-22 23:21:59 +02:00
bors
ae7b1c1916 Auto merge of - 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 - workingjubilee:rollup-gehtjxd, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

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

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-22 03:31:16 +00:00
Jubilee
fdef1d9592
Rollup merge of - 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 - 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 - 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 - 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 
Fixes 

r? ``@BoxyUwU``
2024-07-21 17:44:29 -07:00
Jubilee
5bd7525856
Rollup merge of - 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 - 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 
2024-07-21 17:44:27 -07:00
bors
0f8534e79e Auto merge of - 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 
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
Ben Kimock
107cf981d5 Explain why the new setup can't deadlock 2024-07-21 12:31:25 -04: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 - 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` ()
- fix(test): Move 'cargo_home' from 'install' to 'paths' ()
- fix(test)!: Clarify extension trait role with rename ()
- feat(test): Re-export ProcessBuilder ()
- fix(test): Move path2url to CargoPathExt::to_url ()
- Fix passing of links-overrides with target-applies-to-host and an implicit target ()
- fix(toml): Improve error on missing package and workspace ()
- Migrate global_cache_tracker snapbox ()
- make summary sync by using Arc not Rc ()
2024-07-21 09:06:47 +00:00
bors
9629b90b3f Auto merge of - 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 
Fixes 
Fixes 

### 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 () 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  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 - 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 - matthiaskrgr:rollup-0vmf75y, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 -  ([`macro_metavar_expr_concat`] Allow `concat` in repetitions)
 -  (Windows: move BSD socket shims to netc)
 -  (Ignore allocation bytes in one more mir-opt test)
 -  (Fix git safe-directory path for docker images)
 -  (Add `wasm32-wasip2` to `build-manifest` tool)
 -  (Cleanup rmake.rs setup in compiletest)
 -  (Fix trait bounds display)
 -  (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 - 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 - Oneirical:fuzzy-testure, r=jieyouxu
Migrate 9 more very similar FFI `run-make` tests to rmake

Part of  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 - 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 - 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 - 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
Matthias Krüger
dd8113ef0d
Rollup merge of - alexcrichton:add-wasm32-wasip2-to-dist-manifest, r=Mark-Simulacrum
Add `wasm32-wasip2` to `build-manifest` tool

This is an accidental omission of mine from  which means that `rustup target add wasm32-wasip2` isn't working on today's nightlies.
2024-07-20 19:28:59 +02:00
Matthias Krüger
60f38916da
Rollup merge of - ehuss:safe-directory-docker, r=Mark-Simulacrum
Fix git safe-directory path for docker images

This fixes the path for configuring the git safe.directory setting inside docker images. AFAIK, `~/gitconfig` without a dot is not something that git uses ([ref](https://git-scm.com/docs/git-config)). This was needed in my environment to avoid the ` fatal: detected dubious ownership in repository at '/checkout'` error. For context, this was added in .
2024-07-20 19:28:58 +02:00
Matthias Krüger
ea9b1afc88
Rollup merge of - uweigand:s390x-miropt-update, r=Mark-Simulacrum
Ignore allocation bytes in one more mir-opt test

Following on PR , add `rustc -Zdump-mir-exclude-alloc-bytes` to tests/mir-opt/dataflow-const-prop/aggregate_copy.rs as well to skip writing allocation bytes in MIR dumps.

Fixes 
2024-07-20 19:28:57 +02:00
Matthias Krüger
b3d682c577
Rollup merge of - ChrisDenton:netc, r=Mark-Simulacrum
Windows: move BSD socket shims to netc

On Windows we need to alter a few types so that they can be used in the cross-platform socket code. Currently these alterations are spread throughout the `c` module with some more in the `netc` module.

Let's gather all our BSD compatibility shims in the `netc` module so it's all in one place and easier to discover.
2024-07-20 19:28:57 +02:00
Matthias Krüger
fba6e1e64a
Rollup merge of - c410-f3r:concat-rep, r=cjgillot
[`macro_metavar_expr_concat`] Allow `concat` in repetitions

cc 
2024-07-20 19:28:56 +02:00
Mark Rousskov
9db265048e Bump to 1.82 2024-07-20 10:30:39 -04:00
bors
2e6fc42541 Auto merge of - matthiaskrgr:rollup-21p0cue, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 -  ( use precompiled rustdoc with CI rustc)
 -  (Add a hook for `should_codegen_locally`)
 -  (unix: document unsafety for std `sig{action,altstack}`)
 -  (kmc-solid: `#![forbid(unsafe_op_in_unsafe_fn)]`)
 -  (match lowering: Split `finalize_or_candidate` into more coherent methods)
 -  (run_make_support: skip rustfmt for lib.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-20 13:26:11 +00:00
Chris Denton
af735f3bd3
Remove _tls_used hack 2024-07-20 12:37:36 +00:00
Matthias Krüger
8963855ea1
Rollup merge of - jieyouxu:rmake-rustfmt-skip, r=nnethercote
run_make_support: skip rustfmt for lib.rs

To avoid them getting reordered once https://github.com/rust-lang/rust/pull/125443 goes through.

r? ``@nnethercote`` (since you were working on this)
2024-07-20 13:24:55 +02:00
Matthias Krüger
d846e9252c
Rollup merge of - Zalathar:after-or, r=Nadrieril
match lowering: Split `finalize_or_candidate` into more coherent methods

I noticed that `finalize_or_candidate` was responsible for several different postprocessing tasks, making it difficult to understand.

This PR aims to clean up some of the confusion by:
- Extracting `remove_never_subcandidates` from `merge_trivial_subcandidates`
- Extracting `test_remaining_match_pairs_after_or` from `finalize_or_candidate`
- Taking what remains of `finalize_or_candidate`, and inlining it into its caller

---
Reviewing individual commits and ignoring whitespace is recommended.

Most of the large-looking changes are just moving existing code around, mostly unaltered.

r? ``@Nadrieril``
2024-07-20 13:24:54 +02:00
Matthias Krüger
6b9982d4fb
Rollup merge of - workingjubilee:forbid-unsafe-ops-for-kmc-solid, r=Amanieu
kmc-solid: `#![forbid(unsafe_op_in_unsafe_fn)]`

The path logic _should_ handle the forbiddance in the itron sources correctly, despite them being an "out-of-line" module.
2024-07-20 13:24:53 +02:00
Matthias Krüger
2ee3668ad5
Rollup merge of - workingjubilee:break-up-big-ass-stack-overflow-fn, r=joboet
unix: document unsafety for std `sig{action,altstack}`

I found many surprising elements here while trying to wrap a measly 5 functions with `unsafe`. I would rather not "just" mindlessly wrap this code with `unsafe { }`, so I decided to document it properly.

On Unix, this code covers the "create and setup signal handler" part of the stack overflow code, and serves as the primary safety boundary for the signal handler. It is rarely audited, very gnarly, and worth extra attention. It calls other unsafe functions defined in this module, but "can we correctly map the right memory, or find the right address ranges?" are separate questions, and get increasingly platform-specific. The question here is the more general "are we doing everything in the correct order, and setting up the handler in the correct way?"

As part of this audit, I noticed that we do some peculiar things that we should probably refrain from. However, I avoided making changes that I deemed might have a different final result in Rust programs. I did, however, reorder some events so that the signal handler is installed _after_ we install the alternate stack. We do not run much code between these events, but it is probably best if the timespan between the handler being available and the new stack being installed is 0 nanoseconds.
2024-07-20 13:24:53 +02:00
Matthias Krüger
9a6f8ccf3a
Rollup merge of - momvart:should_codegen_hook, r=cjgillot
Add a hook for `should_codegen_locally`

This PR lifts the module-local function `should_codegen_locally` to `TyCtxt` as a hook.
In addition to monomorphization, this function is used for checking the dependency of `compiler_builtins` on other libraries. Moving this function to the hooks also makes overriding it possible for the tools that use the rustc interface.
2024-07-20 13:24:52 +02:00
Matthias Krüger
3a9bfa397d
Rollup merge of - onur-ozkan:precompiled-rustdoc, r=Kobzol
use precompiled rustdoc with CI rustc

When CI rustc is enabled and rustdoc sources are unchanged, we can use the precompiled rustdoc from the CI rustc's sysroot. This speeds up bootstrapping quite a lot by avoiding unnecessary rustdoc compilation.
2024-07-20 13:24:51 +02:00
bors
73a228116a Auto merge of - compiler-errors:precise-capturing-rustdoc-cross, r=fmease
Add cross-crate precise capturing support to rustdoc

Follow-up to . Fixes .

r? `@fmease`

Tracking:
* https://github.com/rust-lang/rust/issues/123432
2024-07-20 11:03:35 +00:00
许杰友 Jieyou Xu (Joe)
a8463bea91 compiletest/rmake: simplify path calculations 2024-07-20 09:21:57 +00:00
许杰友 Jieyou Xu (Joe)
2c867d0b5f compiletest/rmake: avoid double test directory for rmake.rs tests
This is important for other tests that have various things like modes,
revisions and the like. These features are not supported in run-make
tests, so we don't need the double layering.
2024-07-20 09:20:47 +00:00
许杰友 Jieyou Xu (Joe)
c863525374 compiletest/rmake: improve comments 2024-07-20 09:20:47 +00:00
许杰友 Jieyou Xu (Joe)
3e77f7c9a5 compiletest/rmake: prune unused RUST_BUILD_STAGE and explain env vars passed to recipes 2024-07-20 09:20:32 +00:00
onur-ozkan
0636293fb7 use precompiled rustdoc with CI rustc
When CI rustc is enabled and rustdoc sources are unchanged, we can use
the precompiled rustdoc from the CI rustc's sysroot. This speeds up
bootstrapping quite a lot by avoiding unnecessary rustdoc compilation.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-20 12:13:29 +03:00