Commit Graph

251240 Commits

Author SHA1 Message Date
Ramon de C Valle bc8c3eff6b CFI: Change type transformation to use TypeFolder
Change type transformation to use TypeFolder.
2024-04-01 16:56:27 -07:00
bors b38b6caa3e Auto merge of #123318 - TomAFrench:patch-1, r=GuillaumeGomez
chore: fix footnotes/links in `platform-support.md`

A missing newline between two references is resulting in some links/footnotes not rendering properly. This PR fixes this.
2024-04-01 18:42:58 +00:00
bors a7e3b1c8c5 Auto merge of #123315 - devnexen:thread_get_name_solaris, r=ChrisDenton
std:🧵 adding get_name implementation for solaris/illumos.

THREAD_NAME_MAX is 32 (31 max + 1 for the null terminator).
2024-04-01 16:38:55 +00:00
bors c518e5aeec Auto merge of #123265 - joboet:guardians_of_the_unix, r=ChrisDenton
Refactor stack overflow handling

Currently, every platform must implement a `Guard` that protects a thread from stack overflow. However, UNIX is the only platform that actually does so. Windows has a different mechanism for detecting stack overflow, while the other platforms don't detect it at all. Also, the UNIX stack overflow handling is split between `sys::pal::unix::stack_overflow`, which implements the signal handler, and `sys::pal::unix::thread`, which detects/installs guard pages.

This PR cleans this by getting rid of `Guard` and unifying UNIX stack overflow handling inside `stack_overflow` (commit 1). Therefore we can get rid of `sys_common::thread_info`, which stores `Guard` and the current `Thread` handle and move the `thread::current` TLS variable into `thread` (commit 2).

The second commit is not strictly speaking necessary. To keep the implementation clean, I've included it here, but if it causes too much noise, I can split it out without any trouble.
2024-04-01 14:35:38 +00:00
joboet d7b55e4c90
update comment 2024-04-01 15:28:27 +02:00
bors 6bb6b816bf Auto merge of #122046 - Nadrieril:integrate-or-pats2, r=matthewjasper
match lowering: handle or-patterns one layer at a time

`create_or_subcandidates` and `merge_trivial_subcandidates` both call themselves recursively to handle nested or-patterns, which is hard to follow. In this PR I avoid the need for that; we now process a single "layer" of or-patterns at a time.

By calling back into `match_candidates`, we only need to expand one layer at a time. Conversely, since we always try to simplify a layer that we just expanded (thanks to https://github.com/rust-lang/rust/pull/123067), we only have to merge one layer at a time.

r? `@matthewjasper`
2024-04-01 12:31:27 +00:00
Tom French edb7aeafba
chore: fix footnotes/links in `platform-support.md` 2024-04-01 11:43:52 +01:00
bors 3d5528c287 Auto merge of #123310 - compiler-errors:nested-static-codegen-attrs, r=oli-obk
Don't inherit codegen attrs from parent static

Putting this up partly for discussion and partly for review. Specifically, in #121644, `@oli-obk` designed a system that creates new static items for representing nested allocations in statics. However, in that PR, oli made it so that these statics inherited the codegen attrs from the parent.

This causes problems such as colliding symbols with `#[export_name]` and ICEs with `#[no_mangle]` since these synthetic statics have no `tcx.item_name(..)`.

So the question is, is there any case where we *do* want to inherit codegen attrs from the parent? The only one that seems a bit suspicious is the thread-local attribute. And there may be some interesting interactions with the coverage attributes as well...

Fixes (after backport) #123274. Fixes #123243. cc #121644.

r? `@oli-obk` cc `@nnethercote` `@RalfJung` (reviewers on that pr)
2024-04-01 09:22:01 +00:00
David Carlier 747d19326b
std:🧵 adding get_name implementation for solaris/illumos.
THREAD_NAME_MAX is 32 (31 max + 1 for the null terminator).
2024-04-01 10:01:21 +01:00
bors 871df0d13a Auto merge of #123192 - RalfJung:bootstrap-test-miri, r=onur-ozkan
Refactor the way bootstrap invokes `cargo miri`

Instead of basically doing `cargo run --manifest-path=<cargo-miri's manifest> -- miri`, let's invoke the `cargo-miri` binary directly. That means less indirections, and also makes it easier to e.g. run the libcore test suite in Miri. (But there are still other issues with that.)

Also also adjusted Miri's stage numbering so that it is consistent with rustc/rustdoc.

This also makes `./x.py test miri` honor `--no-doc`.

And this fixes https://github.com/rust-lang/rust/issues/123177 by moving where we handle parallel_compiler.
2024-04-01 07:19:57 +00:00
bors 7f84ede33d Auto merge of #122663 - beetrees:non-unicode-env-error, r=TaKO8Ki
Fix error message for `env!` when env var is not valid Unicode

Currently (without this PR) the `env!` macro emits an ```environment variable `name` not defined at compile time``` error when the environment variable is defined, but not a valid Unicode string. This PR introduces a separate more accurate error message, and a test to verify this behaviour.

For reference, before this PR, the new test would have outputted:
```
error: environment variable `NON_UNICODE_VAR` not defined at compile time
 --> non_unicode_env.rs:2:13
  |
2 |     let _ = env!("NON_UNICODE_VAR");
  |             ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: use `std::env::var("NON_UNICODE_VAR")` to read the variable at run time
  = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error
```

whereas with this PR, the test ouputs:
```
error: environment variable `NON_UNICODE_VAR` is not a valid Unicode string
 --> non_unicode_env.rs:2:13
  |
2 |     let _ = env!("NON_UNICODE_VAR");
  |             ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 1 previous error
```
2024-04-01 05:18:51 +00:00
beetrees 0bbaa2505b
Fix error message for `env!` when env var is not valid Unicode 2024-04-01 05:44:45 +01:00
bors defef8658e Auto merge of #122972 - beetrees:use-align-type, r=fee1-dead
Use the `Align` type when parsing alignment attributes

Use the `Align` type in `rustc_attr::parse_alignment`, removing the need to call `Align::from_bytes(...).unwrap()` later in the compilation process.
2024-04-01 03:16:45 +00:00
Michael Goulet 4ff8a9bd6b Don't inherit codegen attrs from parent static 2024-03-31 22:34:00 -04:00
beetrees 6e5f1dacf3
Use the `Align` type when parsing alignment attributes 2024-04-01 03:05:55 +01:00
bors 66de611196 Auto merge of #123270 - JaniM:janim/string-alloc-doc, r=workingjubilee
doc: mention heap allocation earlier in String docs

Just a tiny addition.

Helps with #123263.
2024-03-31 22:39:04 +00:00
Ralf Jung 85d460e829 checktools: make it easier to trace what is happening 2024-03-31 23:47:26 +02:00
Ralf Jung b08b06e3a8 fix not finding the right libraries on Windows 2024-03-31 23:09:33 +02:00
Jani Mustonen 418535b798 doc: mention heap allocation earlier in String docs
Just a tiny addition.

Helps with #123263.
2024-04-01 00:04:57 +03:00
bors 8058136502 Auto merge of #123299 - workingjubilee:rollup-2z8amaj, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #123180 (Rewrite `core-no-fp-fmt-parse` test in Rust)
 - #123267 (std:🧵 adding get_name haiku implementation.)
 - #123268 (warn against implementing Freeze)
 - #123271 (doc: describe panic conditions for SliceIndex implementations)
 - #123295 (add myself to compiler review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-31 20:35:15 +00:00
Jubilee f7d0a59a7a
Rollup merge of #123295 - BoxyUwU:boxy_compiler_reviews, r=Mark-Simulacrum
add myself to compiler review rotation

title
2024-03-31 13:18:18 -07:00
Jubilee 42ca32673a
Rollup merge of #123271 - JaniM:janim/sliceindex-doc, r=Nilstrieb
doc: describe panic conditions for SliceIndex implementations

Implementation note: The most probable place for users to find the documentation is at https://doc.rust-lang.org/std/slice/trait.SliceIndex.html

On that page, documentation added to specific methods will not be visible. As such, I opted to add the comments to the impl blocks directly.

Helps with #121568.
2024-03-31 13:18:17 -07:00
Jubilee 9ff4c70476
Rollup merge of #123268 - RalfJung:dont-freeze, r=Nilstrieb
warn against implementing Freeze

As [requested](https://github.com/rust-lang/rust/pull/123184#issuecomment-2028531388) by `@workingjubilee`
2024-03-31 13:18:17 -07:00
Jubilee 2a08f02048
Rollup merge of #123267 - devnexen:thread_get_name_haiku, r=joboet
std:🧵 adding get_name haiku implementation.

follow-up #123233
2024-03-31 13:18:17 -07:00
Jubilee 17737bfece
Rollup merge of #123180 - Oneirical:master, r=Mark-Simulacrum
Rewrite `core-no-fp-fmt-parse` test in Rust

Claiming the simple "core-no-fp-fmt-parse" test from #121876. `run_make_support` was altered with `arg_path` written in #121918 by `@abhay-51,` with additional doc comment.

Preliminary GSoC contribution for the project proposal mentored by `@jieyouxu.`
2024-03-31 13:18:16 -07:00
Ralf Jung 602401c4d4 warn against implementing Freeze 2024-03-31 22:15:48 +02:00
Boxy 8d67fb99fc beep boop 2024-03-31 20:18:37 +01:00
bors 204805a092 Auto merge of #123266 - RalfJung:catch-panic, r=workingjubilee
catch_panic: warn about panicking payload drop

Warns about the footgun in https://github.com/rust-lang/rust/issues/86027.

Will be unnecessary if panics escaping from drop leads to abort (https://github.com/rust-lang/rfcs/pull/3288). But until that is enforced everywhere, let's warn users about this.
2024-03-31 18:34:26 +00:00
Ralf Jung 4797fba3b7 add FIXME for making the cargo cmd properly typed 2024-03-31 19:44:54 +02:00
Ralf Jung 288daeb14f move parallel_compiler handling into prepare_tool_cargo so that it is done everywhere 2024-03-31 19:44:54 +02:00
Ralf Jung 7ac5f604c1 remove a pointless env var
CARGO_EXTRA_FLAGS is respected by the ./miri script which we are not invoking here
2024-03-31 19:44:54 +02:00
Ralf Jung fb8abe5fcf shift Miri's stage so that it matches other rustc-based tools 2024-03-31 19:44:54 +02:00
Ralf Jung b5fe655ae8 bootstrap/rustc: remove a miri hack 2024-03-31 19:44:54 +02:00
Ralf Jung 4056df5cf7 cargo-miri: better debug output; reorder a comment to make it less confusing 2024-03-31 19:44:21 +02:00
David Carlier e5c5ed00a5 std:🧵 adding get_name haiku implementation.
follow-up #123233
2024-03-31 17:47:44 +01:00
bors bf71daedc2 Auto merge of #121851 - michaelwoerister:mcp-533-effective-vis, r=cjgillot
Use FxIndexMap instead FxHashMap to stabilize iteration order in EffectiveVisibilities

Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).
2024-03-31 16:22:38 +00:00
joboet 41434ff4a3
refer to a different module in UI test 2024-03-31 15:38:22 +02:00
Jani Mustonen 4ca3151568 doc: describe panic conditions for SliceIndex implementations
Implementation note: The most probable place for users to find
the documentation is at https://doc.rust-lang.org/std/slice/trait.SliceIndex.html

On that page, documentation added to specific methods will not
be visible. As such, I opted to add the comments to the impl blocks
directly.

Helps with #121568.
2024-03-31 16:13:25 +03:00
bors a8cfc83801 Auto merge of #123246 - Kobzol:tarball-reproducible, r=Mark-Simulacrum
Make source tarball generation more reproducible

This PR performs several changes to source tarball generation (`x dist rustc-src`) in order to make it more reproducible (in light of the recent "xz backdoor"...). I want to follow up on it with making a separate CI workflow for generating the tarball.

After this PR, running this locally produces identical checksums:
```bash
$ ./x dist rustc-src
$ sha256sum build/dist/rustc-1.79.0-src.tar.gz

$ ./x dist rustc-src
$ sha256sum build/dist/rustc-1.79.0-src.tar.gz
```

r? `@Mark-Simulacrum`
2024-03-31 12:36:23 +00:00
Jakub Beránek 877e8d456d
Sort directories when generating tarballs 2024-03-31 12:56:05 +02:00
Jakub Beránek 18d9d44bd6
Make tarball generation more deterministic 2024-03-31 12:56:05 +02:00
Jakub Beránek 8caef4e6c3
Remove potential `__pycache__` directories from src tarballs 2024-03-31 12:56:05 +02:00
Jakub Beránek 63d6ce03b3
Checkout all submodules when building source tarballs 2024-03-31 12:56:05 +02:00
Jakub Beránek 6f4f39a8d5
Move submodule lookup to `Builder` 2024-03-31 12:56:05 +02:00
bors 395f780cd8 Auto merge of #123264 - matthiaskrgr:rollup-smyy7j9, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #123189 (Log BOLT args in bootstrap `rustc` shim)
 - #123211 (Stop calling visitors `V`)
 - #123242 (pattern analysis: Require enum indices to be contiguous)
 - #123260 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-31 10:26:55 +00:00
Ralf Jung 42972f52de catch_panic: warn about panicking payload drop 2024-03-31 11:54:16 +02:00
Matthias Krüger 9abf4bcadb
Rollup merge of #123260 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-03-31 11:50:41 +02:00
Matthias Krüger f04d068adc
Rollup merge of #123242 - Nadrieril:require-contiguous-enum-indices, r=compiler-errors
pattern analysis: Require enum indices to be contiguous

We had a cfg-hack to allow rust-analyzer to use non-contiguous indices for its enum variants. Unfortunately this no longer works if r-a uses the in-tree version of the crate.

This PR removes the hack, and on the r-a side we'll have to use contiguous indices but that's not too hard.

r? `@compiler-errors`
2024-03-31 11:50:41 +02:00
Matthias Krüger d77608b4b9
Rollup merge of #123211 - compiler-errors:V, r=estebank
Stop calling visitors `V`

Renames some visitors which currently have the unhelpful name of `V`. It's not self-documenting, and there is no situation where saving a few bytes in source code helps anyone.

Stacked on top of #123202 due to conflict.
2024-03-31 11:50:40 +02:00
Matthias Krüger 0928a54a1b
Rollup merge of #123189 - Kobzol:rustc-shim-log, r=onur-ozkan
Log BOLT args in bootstrap `rustc` shim

Before, the BOLT argument would not be logged, because it was only added after the logging has happened.

Found by `@RalfJung` [here](https://github.com/rust-lang/rust/pull/116352#discussion_r1544235771).
2024-03-31 11:50:40 +02:00