Commit Graph

263296 Commits

Author SHA1 Message Date
Jaic1
8557b56ec7 Add | to make the html doc of Level rendered correctly 2024-08-14 13:38:03 +08:00
bors
91376f4162 Auto merge of #129008 - GuillaumeGomez:rollup-6citttb, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #128149 (nontemporal_store: make sure that the intrinsic is truly just a hint)
 - #128394 (Unify run button display with "copy code" button and with mdbook buttons)
 - #128537 (const vector passed through to codegen)
 - #128632 (std: do not overwrite style in `get_backtrace_style`)
 - #128878 (Slightly refactor `Flags` in bootstrap)
 - #128886 (Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`)
 - #128929 (Fix codegen-units tests that were disabled 8 years ago)
 - #128937 (Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`)
 - #128978 (Use `assert_matches` around the compiler more)
 - #128994 (Fix bug in `Parser::look_ahead`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-12 16:31:22 +00:00
Guillaume Gomez
99a785d62d
Rollup merge of #128994 - nnethercote:fix-Parser-look_ahead-more, r=compiler-errors
Fix bug in `Parser::look_ahead`.

The special case was failing to handle invisible delimiters on one path.

Fixes (but doesn't close until beta backported) #128895.

r? `@davidtwco`
2024-08-12 17:09:20 +02:00
Guillaume Gomez
7c6dca9050
Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu
Use `assert_matches` around the compiler more

It's a useful assertion, especially since it actually prints out the LHS.
2024-08-12 17:09:19 +02:00
Guillaume Gomez
bb35b888b5
Rollup merge of #128937 - lqd:clean-rmake-tests, r=jieyouxu
Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`

r? `@jieyouxu`

This PR fixes some warnings I saw in rmake tests. I didn't deny more warnings in this PR until `@jieyouxu` gives their opinion, but maybe we should actually deny all warnings in `rmake.rs` files?

I've also only looked at non-ignored tests on `x86_64-unknown-linux-gnu`, and denying warnings would require a try build for all targets 😓.
2024-08-12 17:09:19 +02:00
Guillaume Gomez
5b6379a86d
Rollup merge of #128929 - saethlin:enable-codegen-units-tests, r=compiler-errors
Fix codegen-units tests that were disabled 8 years ago

I don't know if any of these tests still have value. They were disabled by https://github.com/rust-lang/rust/pull/33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them.

I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
2024-08-12 17:09:18 +02:00
Guillaume Gomez
ea74eff55c
Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote
Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`

`@rustbot` label +A-translation
cc https://github.com/rust-lang/rust/issues/100717
2024-08-12 17:09:17 +02:00
Guillaume Gomez
355a23292a
Rollup merge of #128878 - Kobzol:refactor-flags, r=onur-ozkan
Slightly refactor `Flags` in bootstrap

The next step for https://github.com/rust-lang/rust/issues/126819 is to track commands executed inside `Config::parse`. This is quite challenging, because (tracked) command execution needs to access some state that is stored inside `Config`, which creates a sort of a chicken-and-egg problem.

I would like to first untangle `Config::parse` a little bit, which is what this PR starts with.

Tracking issue: https://github.com/rust-lang/rust/issues/126819

r? `@onur-ozkan`
2024-08-12 17:09:17 +02:00
Guillaume Gomez
aa6f240972
Rollup merge of #128632 - joboet:dont_overwrite_style, r=Amanieu
std: do not overwrite style in `get_backtrace_style`

If another thread calls `set_backtrace_style` while a `get_backtrace_style` is reading the environment variables, `get_backtrace_style` will overwrite the value. Use an atomic CAS to avoid this.
2024-08-12 17:09:16 +02:00
Guillaume Gomez
aea5087964
Rollup merge of #128537 - Jamesbarford:118980-const-vector, r=RalfJung,nikic
const vector passed through to codegen

This allows constant vectors using a repr(simd) type to be propagated
through to the backend by reusing the functionality used to do a similar
thing for the simd_shuffle intrinsic

#118209

r​? RalfJung
2024-08-12 17:09:15 +02:00
Guillaume Gomez
c6e3385d95
Rollup merge of #128394 - GuillaumeGomez:run-button, r=t-rustdoc
Unify run button display with "copy code" button and with mdbook buttons

Follow-up of https://github.com/rust-lang/rust/pull/128339.

It looks like this (coherency++, yeay!):

![Screenshot from 2024-07-30 15-16-31](https://github.com/user-attachments/assets/5e262e5b-f338-4085-94ca-e223033a43db)

Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html).

r? `@notriddle`
2024-08-12 17:09:15 +02:00
Guillaume Gomez
095ca33bb6
Rollup merge of #128149 - RalfJung:nontemporal_store, r=jieyouxu,Amanieu,Jubilee
nontemporal_store: make sure that the intrinsic is truly just a hint

The `!nontemporal` flag for stores in LLVM *sounds* like it is just a hint, but actually, it is not -- at least on x86, non-temporal stores need very special treatment by the programmer or else the Rust memory model breaks down. LLVM still treats these stores as-if they were normal stores for optimizations, which is [highly dubious](https://github.com/llvm/llvm-project/issues/64521). Let's avoid all that dubiousness by making our own non-temporal stores be truly just a hint, which is possible on some targets (e.g. ARM). On all other targets, non-temporal stores become regular stores.

~~Blocked on https://github.com/rust-lang/stdarch/pull/1541 propagating to the rustc repo, to make sure the `_mm_stream` intrinsics are unaffected by this change.~~

Fixes https://github.com/rust-lang/rust/issues/114582
Cc `@Amanieu` `@workingjubilee`
2024-08-12 17:09:14 +02:00
bors
e08b80c0fb Auto merge of #128371 - andjo403:rangeAttribute, r=nikic
Add range attribute to scalar function results and arguments

as LLVM 19 adds the range attribute this starts to use it for better optimization.
hade been interesting to see a perf run with the https://github.com/rust-lang/rust/pull/127513

closes https://github.com/rust-lang/rust/issues/50156
cc https://github.com/rust-lang/rust/issues/49572 shall be fixed but not possible to see as there is asserts that already trigger the optimization.
2024-08-12 10:20:00 +00:00
Ralf Jung
75743dc5a0 make the codegen test also cover an ill-behaved arch, and add links 2024-08-12 11:42:38 +02:00
joboet
8542cd67f0
std: do not overwrite style in get_backtrace_style
If another thread calls `set_backtrace_style` while a `get_backtrace_style` is reading the environment variables, `get_backtrace_style` will overwrite the value. Use an atomic CAS to avoid this.
2024-08-12 10:08:56 +02:00
bors
1d8f135b20 Auto merge of #128862 - cblh:fix/128855, r=scottmcm
fix:  #128855 Ensure `Guard`'s `drop` method is removed at `opt-level=s` for `…

fix: #128855

…Copy` types

Added `#[inline]` to the `drop` method in the `Guard` implementation to ensure that the method is removed by the compiler at optimization level `opt-level=s` for `Copy` types. This change aims to align the method's behavior with optimization expectations and ensure it does not affect performance.

r​? `@scottmcm`
2024-08-12 05:22:03 +00:00
Nicholas Nethercote
46b4c5adc5 Fix bug in Parser::look_ahead.
The special case was failing to handle invisible delimiters on one path.

Fixes #128895.
2024-08-12 13:00:12 +10:00
bors
13f8a57cfb Auto merge of #126793 - saethlin:mono-rawvec, r=scottmcm
Apply "polymorphization at home" to RawVec

The idea here is to move all the logic in RawVec into functions with explicit size and alignment parameters. This should eliminate all the fussing about how tweaking RawVec code produces large swings in compile times.

This uncovered https://github.com/rust-lang/rust-clippy/issues/12979, so I've modified the relevant test in a way that tries to preserve the spirit of the test without tripping the ICE.
2024-08-12 01:47:06 +00:00
Ben Kimock
28a8301de9 Fix debuginfo providers/tests 2024-08-11 16:51:22 -04:00
bors
41dd149fd6 Auto merge of #128677 - nikic:llvm19rc2, r=cuviper
Update to LLVM 19 rc2

Update from ~rc1 to rc2.

Fixes https://github.com/rust-lang/rust/issues/128555.
2024-08-11 19:37:52 +00:00
Andreas Jonson
cfadfabfcd Add range attribute to scalar function results and arguments 2024-08-11 19:40:44 +02:00
Michael Goulet
c361c924a0 Use assert_matches around the compiler 2024-08-11 12:25:39 -04:00
bors
9cb1998ea1 Auto merge of #122362 - Zoxc:rustc_driver_static_std, r=oli-obk,lqd,bjorn3,Kobzol
Link `std` statically in `rustc_driver`

This makes `rustc_driver` statically link to `std`. This is done by not passing `-C prefer-dynamic` when building `rustc_driver`. However building `rustc-main` won't work currently as it tries to dynamically link to both `rustc_driver` and `std` resulting in a crate graph with `std` duplicated. To fix that new command line option `-Z prefer_deps_of_dynamic` is added which prevents linking to a dylib if there's a static variant of it already statically linked into another dylib dependency.

The main motivation for this change is to enable `#[global_allocator]` to be used in `rustc_driver` allowing overriding the allocator used in rustc on all platforms.

---

Instead of adding `-Z prefer_deps_of_dynamic`, this PR is changed to crate opt-in to the linking change via the `rustc_private` feature instead, as that would be typically needed to link to `rustc_driver` anyway.

---

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: i686-mingw
try-job: dist-x86_64-msvc
try-job: aarch64-gnu
2024-08-11 15:08:03 +00:00
bors
5e5ec8af1b Auto merge of #128916 - jieyouxu:dump-ice-dump-ice, r=compiler-errors
Tidy up `dump-ice-to-disk` and make assertion failures dump ICE messages

For the future traveler: **if you did a `git blame` and found this PR that last modified `dump-ice-to-disk` because the test failed in a completely unrelated PR, then I'm afraid our ICE dump may have regressed or somehow behaves differently on `i686-mingw`.**

A bit of clean up to the `dump-ice-to-disk` test.

- Fixes/updates the top-level comment.
- Add a FIXME pointing to #128911 for flakiness.
- Instead of trying to manually cleanup `rustc-ice*.txt` dumps, run each test instance in a separate temp directory.
- Explicitly make `RUSTC_ICE` unavailable in one of the `-Zmetrics-dir` test case to not have interference from environment.
- Make assertion failures (on ICE dump line count mismatch) extremely verbose to help debug why this test is flakey in CI (#128911).

Contains a fix by `@saethlin` in #128909, should wait until that is merged then rebase on top.

try-job: aarch64-gnu
try-job: aarch64-apple
try-job: x86_64-msvc
try-job: i686-mingw
try-job: test-various
2024-08-11 12:43:14 +00:00
许杰友 Jieyou Xu (Joe)
6dc300ba45 tests: ignore dump-ice-to-disk on windows 2024-08-11 11:11:22 +00:00
Rémy Rakic
dcd6170c89 use rfs in rustdoc io rmake test 2024-08-11 09:45:47 +00:00
bors
c9bd03cb72 Auto merge of #128959 - matthiaskrgr:rollup-6jdqi3l, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #120314 (core: optimise Debug impl for ascii::Char)
 - #128536 (Preliminary cleanup of `WitnessPat` hoisting/printing)
 - #128592 (Promote aarch64-apple-darwin to Tier 1)
 - #128762 (Use more slice patterns inside the compiler)
 - #128875 (rm `import.used`)
 - #128882 (make LocalWaker::will_wake consistent with Waker::will_wake)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-11 05:54:39 +00:00
Matthias Krüger
2c88eb9805
Rollup merge of #128882 - RalfJung:local-waker-will-wake, r=cuviper
make LocalWaker::will_wake consistent with Waker::will_wake

This mirrors https://github.com/rust-lang/rust/pull/119863 for `LocalWaker`. Looks like that got missed in the initial `LocalWaker` PR (https://github.com/rust-lang/rust/pull/118960).
2024-08-11 07:51:52 +02:00
Matthias Krüger
eff9120b7c
Rollup merge of #128875 - bvanjoi:cleanup-import-used, r=petrochenkov
rm `import.used`

By the way, `import_used_map` will only be used during `build_reduced_graph` and `finalize`, so it can be split from `Resolver` in the future.

r? ``@petrochenkov``
2024-08-11 07:51:52 +02:00
Matthias Krüger
32e0fe129d
Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errors
Use more slice patterns inside the compiler

Nothing super noteworthy. Just replacing the common 'fragile' pattern of "length check followed by indexing or unwrap" with slice patterns for legibility and 'robustness'.

r? ghost
2024-08-11 07:51:51 +02:00
Matthias Krüger
bd7075c69e
Rollup merge of #128592 - evelynharthbrooke:master, r=Mark-Simulacrum
Promote aarch64-apple-darwin to Tier 1

This promotes aarch64-apple-darwin to Tier 1 status as per rust-lang/rfcs#3671 and tracking issue #73908. Not sure what else is necessary for this to impement the aforementioned RFC, however I figured I'd try. I did read in previous issues and PRs that the necessary infrastructure was already in place for the aarch64-apple-darwin target, and the RFC mentions the same. So this should be all thats necessary in order for the target to be promoted.

This is a recreation of my previous PR because I accidentally did an incorrect git rebase which caused unnecessary changes to various commit SHAs. So this PR is a recreation of my previous PR without said stumble. My bad.
2024-08-11 07:51:51 +02:00
Matthias Krüger
853255e28d
Rollup merge of #128536 - Zalathar:print-cleanup, r=Nadrieril
Preliminary cleanup of `WitnessPat` hoisting/printing

Follow-up to #128430.

The eventual goal is to remove `print::Pat` entirely, but in the course of working towards that I made so many small improvements that it seems wise to let those be reviewed/merged on their own first.

Best reviewed commit-by-commit, most of which should be pretty simple and straightforward.

r? ``@Nadrieril``
2024-08-11 07:51:50 +02:00
Matthias Krüger
e8f6819db7
Rollup merge of #120314 - mina86:i, r=Mark-Simulacrum
core: optimise Debug impl for ascii::Char

Rather than writing character at a time, optimise Debug implementation
for core::ascii::Char such that it writes the entire representation
with a single write_str call.

With that, add tests for Display and Debug.

Issue: https://github.com/rust-lang/rust/issues/110998
2024-08-11 07:51:49 +02:00
John Kåre Alsaker
b22253c454 Keep rustc's std copy 2024-08-11 05:43:32 +02:00
许杰友 Jieyou Xu (Joe)
960e7b55e1 tests: tidy up dump-ice-to-disk and make assertion failures extremely verbose 2024-08-11 03:42:38 +00:00
John Kåre Alsaker
dd3f7578ee Exclude just std from rustc deps 2024-08-11 04:16:53 +02:00
John Kåre Alsaker
56beb1d744 Update the unstable book 2024-08-11 04:16:53 +02:00
John Kåre Alsaker
486864f235 Don't statically link std into rustc_driver for windows-gnu 2024-08-11 04:16:53 +02:00
John Kåre Alsaker
736a249954 Ask the user to use feature(rustc_private) when linking to rustc_driver 2024-08-11 04:16:53 +02:00
John Kåre Alsaker
3ee43259ac Link std statically in rustc_driver 2024-08-11 04:16:53 +02:00
bors
730d5d4095 Auto merge of #128572 - compiler-errors:fix-elaborate-box-derefs-on-debug, r=saethlin
Fix `ElaborateBoxDerefs` on debug varinfo

Slightly simplifies the `ElaborateBoxDerefs` pass to fix cases where it was applying the wrong projections to debug var infos containing places that deref boxes.

From what I can tell[^1], we don't actually have any tests (or code anywhere, really) that exercise `debug x => *(...: Box<T>)`, and it's very difficult to trigger this in surface Rust, so I wrote a custom MIR test.

What happens is that the pass was turning `*(SOME_PLACE: Box<T>)` into `*(*((((SOME_PLACE).0: Unique<T>).0: NonNull<T>).0: *const T))` in debug var infos. In particular, notice the *double deref*, which was wrong.

This is the root cause of #128554, so this PR fixes #128554 as well. The reason that async closures was affected is because of the way that we compute the [`ByMove` body](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs), which resulted in `*(...: Box<T>)` in debug var info. But this really has nothing to do with async closures.

[^1]: Validated by literally replacing the `if elem == PlaceElem::Deref && base_ty.is_box() { ... }` innards with a `panic!()`, which compiled all of stage2 without panicking.
2024-08-10 21:24:25 +00:00
bors
04dff01740 Auto merge of #128400 - petrochenkov:nowhole3, r=bjorn3
linker: Remove the "`--whole-archive` in test mode" backcompat hack

Fixes https://github.com/rust-lang/rust/issues/116910.
2024-08-10 18:57:58 +00:00
Rémy Rakic
f4cb0de44e remove other warnings from rmake tests 2024-08-10 18:16:15 +00:00
Rémy Rakic
141d9dc3a5 remove unused imports from rmake tests 2024-08-10 18:06:10 +00:00
Ben Kimock
03b6c2f2d4 Fix and enable disabled codegen-units tests 2024-08-10 14:03:27 -04:00
bors
04ba50e823 Auto merge of #128927 - GuillaumeGomez:rollup-ei2lr0f, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #128273 (Improve `Ord` violation help)
 - #128807 (run-make: explaing why fmt-write-bloat is ignore-windows)
 - #128903 (rustdoc-json-types `Discriminant`: fix typo)
 - #128905 (gitignore: Add Zed and Helix editors)
 - #128908 (diagnostics: do not warn when a lifetime bound infers itself)
 - #128909 (Fix dump-ice-to-disk for RUSTC_ICE=0 users)
 - #128910 (Differentiate between methods and associated functions in diagnostics)
 - #128923 ([rustdoc] Stop showing impl items for negative impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-10 15:13:38 +00:00
Guillaume Gomez
893b9f3a5a
Rollup merge of #128923 - GuillaumeGomez:negative-impls-items, r=fmease
[rustdoc] Stop showing impl items for negative impls

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

As discussed with `@fmease,` they have a broader patch in progress, so this (small) PR will at least allow for them to have a regression test. :)

r? `@fmease`
2024-08-10 16:23:55 +02:00
Guillaume Gomez
50e9fd1a1d
Rollup merge of #128910 - estebank:assoc-fn, r=compiler-errors
Differentiate between methods and associated functions in diagnostics

Accurately refer to assoc fn without receiver as assoc fn instead of methods. Add `AssocItem::descr` method to centralize where we call methods and associated functions.
2024-08-10 16:23:55 +02:00
Guillaume Gomez
48fd9fdd42
Rollup merge of #128909 - saethlin:run-make-ice-yes, r=jieyouxu
Fix dump-ice-to-disk for RUSTC_ICE=0 users

Before this change, the test fails if you run it with `RUSTC_ICE=0`.
2024-08-10 16:23:54 +02:00
Guillaume Gomez
0d0265c1f0
Rollup merge of #128908 - notriddle:notriddle/self-inferred-lifetime-bounds, r=compiler-errors
diagnostics: do not warn when a lifetime bound infers itself

Fixes #119228
2024-08-10 16:23:53 +02:00