Commit Graph

171219 Commits

Author SHA1 Message Date
Wilfred Hughes
1c1ae78db7
Fix spelling in SAFETY comment
"can not" should be "cannot", and add punctuation.
2022-06-26 19:17:34 -07:00
DrMeepster
d317988505 validate box's allocator 2022-06-26 18:54:03 -07:00
Takayuki Maeda
89a23bf54f add regression test for #85907 2022-06-27 10:07:19 +09:00
bors
221bdb62a2 Auto merge of #98212 - petrochenkov:addlinkargs, r=lqd
rustc_target: Add convenience functions for adding linker arguments

They ensure that lld and non-lld linker flavors get the same set of arguments.

The second commit also adds some tests checking for linker argument inconsistencies, and tweaks some arguments to fix those inconsistencies.
2022-06-27 00:27:40 +00:00
Nicholas Nethercote
7c40661ddb Update smallvec to 1.8.1.
This pulls in https://github.com/servo/rust-smallvec/pull/282, which
gives some small wins for rustc.
2022-06-27 08:48:55 +10:00
BlaCoiso
15abd82d70
Fix builds on Windows (closes #98546) 2022-06-26 23:27:44 +01:00
Nicholas Nethercote
02d2cdfc28 Convert process_variant functions into closures.
It makes things a bit nicer.
2022-06-27 08:14:09 +10:00
Nicholas Nethercote
b7855fa9de Factor out the repeated assert_ty_bounds function. 2022-06-27 08:14:09 +10:00
Nicholas Nethercote
e7396685a1 Merge build_enum_match_tuple into expand_enum_method_body.
Because the latter just calls the former.

The commit also updates some details in a comment.
2022-06-27 08:14:09 +10:00
Nicholas Nethercote
00207ead61 Improve derived discriminant testing.
Currently the generated code for methods like `eq`, `ne`, and `partial_cmp`
includes stuff like this:
```
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if true && __self_vi == __arg_1_vi {
    ...
}
```
This commit removes the unnecessary `true &&`, and makes the generating
code a little easier to read in the process. It also fixes some errors
in comments.
2022-06-27 08:14:09 +10:00
Nicholas Nethercote
ea74997c41 Add a test checking the output of builtin derives. 2022-06-27 07:58:28 +10:00
bors
3b0d4813ab Auto merge of #98187 - mystor:fast_span_call_site, r=eddyb
proc_macro/bridge: cache static spans in proc_macro's client thread-local state

This is the second part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch removes the RPC calls required for the very common operations of `Span::call_site()`, `Span::def_site()` and `Span::mixed_site()`.

Some notes:

This part is one of the ones I don't love as a final solution from a design standpoint, because I don't like how the spans are serialized immediately at macro invocation. I think a more elegant solution might've been to reserve special IDs for `call_site`, `def_site`, and `mixed_site` at compile time (either starting at 1 or from `u32::MAX`) and making reading a Span handle automatically map these IDs to the relevant values, rather than doing extra serialization.

This would also have an advantage for potential future work to allow `proc_macro` to operate more independently from the compiler (e.g. to reduce the necessity of `proc-macro2`), as methods like `Span::call_site()` could be made to function without access to the compiler backend.

That was unfortunately tricky to do at the time, as this was the first part I wrote of the patches. After the later part (#98188, #98189), the other uses of `InternedStore` are removed meaning that a custom serialization strategy for `Span` is easier to implement.

If we want to go that path, we'll still need the majority of the work to split the bridge object and introduce the `Context` trait for free methods, and it will be easier to do after `Span` is the only user of `InternedStore` (after #98189).
2022-06-26 21:28:24 +00:00
Martin Kröning
0c8860273c Hermit: Make Mutex::init a no-op 2022-06-26 23:20:41 +02:00
Martin Kröning
f954f7b23b Hermit: Fix initializing lazy locks 2022-06-26 23:19:38 +02:00
David Knaack
93d3359d37 compiletest: add issue number param to known-bug 2022-06-26 23:15:47 +02:00
DrMeepster
6e32a16520 fix box with custom allocator in miri 2022-06-26 13:58:37 -07:00
bors
c80c4b8fdc Auto merge of #98545 - matthiaskrgr:rollup-njely29, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #97140 (std: use an event-flag-based thread parker on SOLID)
 - #97295 ([rustc_parse] Forbid `let`s in certain places)
 - #97743 (make const_err show up in future breakage reports)
 - #97908 (Stabilize NonZero* checked operations constness.)
 - #98297 (Transform help popup into a pocket menu)
 - #98428 (macros: use typed identifiers in diag and subdiag derive)
 - #98528 (Respect --color when building rustbuild itself)
 - #98535 (Add regression test for generic const in rustdoc)
 - #98538 (Add a ui test for issue #91883)
 - #98540 (Add regression test for #87558)
 - #98541 (Update `std::alloc::System` doc example code style)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-26 19:02:00 +00:00
Ralf Jung
852a111133 interpret: do not prune requires_caller_location stack frames quite so early 2022-06-26 14:42:26 -04:00
Matthias Krüger
935958e6e4
Rollup merge of #98541 - Veykril:patch-2, r=Dylan-DPC
Update `std::alloc::System` doc example code style

`return` on the last line of a block is unidiomatic so I don't think the example should be using that here
2022-06-26 19:47:09 +02:00
Matthias Krüger
93ea1ec153
Rollup merge of #98540 - TaKO8Ki:add-regression-test-for-87558, r=Mark-Simulacrum
Add regression test for #87558

Fixes #87558
2022-06-26 19:47:08 +02:00
Matthias Krüger
5efe7c7fc6
Rollup merge of #98538 - TaKO8Ki:add-test-for-issue-91883, r=Mark-Simulacrum
Add a ui test for issue #91883

closes #91883
2022-06-26 19:47:07 +02:00
Matthias Krüger
50b6e7db6a
Rollup merge of #98535 - GuillaumeGomez:regression-test-92859, r=lcnr
Add regression test for generic const in rustdoc

Fixes #92859.

r? ```@lcnr```
2022-06-26 19:47:06 +02:00
Matthias Krüger
0c09846e89
Rollup merge of #98528 - jyn514:bootstrap-color, r=Mark-Simulacrum
Respect --color when building rustbuild itself

Separated out from https://github.com/rust-lang/rust/pull/95503.
2022-06-26 19:47:05 +02:00
Matthias Krüger
0b3b4ef2b5
Rollup merge of #98428 - davidtwco:translation-derive-typed-identifiers, r=oli-obk
macros: use typed identifiers in diag and subdiag derive

Using typed identifiers instead of strings with the Fluent identifiers in the diagnostic and subdiagnostic derives - this enables the diagnostic derive to benefit from the compile-time validation that comes with typed identifiers, namely that use of a non-existent Fluent identifier will not compile.

r? `````@oli-obk`````
2022-06-26 19:47:04 +02:00
Matthias Krüger
df26fdf3e1
Rollup merge of #98297 - GuillaumeGomez:help-pocket-menu, r=notriddle
Transform help popup into a pocket menu

Just like we moved the settings menu into a "pocket menu", it's doing the same to the help popup.

You can test it [here](https://rustdoc.crud.net/imperio/help-pocket-menu/doc/foo/index.html) and here is a screenshot:

![Screenshot from 2022-06-20 20-58-29](https://user-images.githubusercontent.com/3050060/174663718-538e9d11-3bf9-48b2-8909-f9bfe75af135.png)

r? ``````````@jsha``````````
2022-06-26 19:47:03 +02:00
Matthias Krüger
e8a2e265b5
Rollup merge of #97908 - iago-lito:stabilize_nonzero_checked_ops_constness, r=scottmcm
Stabilize NonZero* checked operations constness.

Partial stabilization for #97547 (continued).
2022-06-26 19:47:02 +02:00
Matthias Krüger
7312a66a5c
Rollup merge of #97743 - RalfJung:const-err-future-breakage, r=estebank
make const_err show up in future breakage reports

As tracked in https://github.com/rust-lang/rust/issues/71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since https://github.com/rust-lang/rust/pull/80394 (landed more than a year ago). Some CTFE errors are already hard errors since https://github.com/rust-lang/rust/pull/86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports.

Cc `````@rust-lang/wg-const-eval`````
2022-06-26 19:47:01 +02:00
Matthias Krüger
5b312710d5
Rollup merge of #97295 - c410-f3r:yet-another-let-chain, r=compiler-errors
[rustc_parse] Forbid `let`s in certain places

Currently only forbids in locals to resolve https://github.com/rust-lang/rust/pull/94927#issuecomment-1099605024 but feel free to point any other places.
2022-06-26 19:47:00 +02:00
Matthias Krüger
c348beacea
Rollup merge of #97140 - joboet:solid_parker, r=m-ou-se
std: use an event-flag-based thread parker on SOLID

`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used, which, after #96393, are SOLID, SGX and Hermit (more PRs coming soon).

SOLID, conforming to the [μITRON specification](http://www.ertl.jp/ITRON/SPEC/FILE/mitron-400e.pdf), has event flags, which are a thread parking primitive very similar to `Parker`. However, they do not make any atomic ordering guarantees (even though those can probably be assumed) and necessitate a system call even when the thread token is already available. Hence, this `Parker`, like the Windows parker, uses an extra atomic state variable.

I future-proofed the code by wrapping the event flag in a `WaitFlag` structure, as both SGX and Hermit can share the Parker implementation, they just have slightly different primitives (SGX uses signals and Hermit has a thread blocking API).

`````@kawadakk````` I assume you are the target maintainer? Could you test this for me?
2022-06-26 19:46:59 +02:00
Nika Layzell
e32ee19b3a proc_macro: Rename ExpnContext to ExpnGlobals, and unify method on Server trait 2022-06-26 12:48:33 -04:00
Conrad Ludgate
803083a9d9 attempt to optimise vectored write 2022-06-26 17:15:31 +01:00
bors
788ddedb0d Auto merge of #98190 - nnethercote:optimize-derive-Debug-code, r=scottmcm
Improve `derive(Debug)`

r? `@ghost`
2022-06-26 15:00:04 +00:00
Lukas Wirth
756118e2b9
Update std::alloc::System docs 2022-06-26 16:31:29 +02:00
Takayuki Maeda
30724ebc17 add a ui test for issue #91883 2022-06-26 22:28:17 +09:00
Takayuki Maeda
0d71862170 add regression test for #87558 2022-06-26 22:10:10 +09:00
bors
7125846d17 Auto merge of #98518 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/98493 (this is a flaky test, that's why the toolstate already says Miri is fixed)
r? `@ghost` Cc `@rust-lang/miri`
2022-06-26 12:16:10 +00:00
Guillaume Gomez
0398aa8ccb Add regression test for #92859 2022-06-26 14:01:00 +02:00
Joshua Nelson
028fd634bb Respect --color when building rustbuild itself 2022-06-26 04:44:47 -05:00
scottmcm
2339bb20a6
Update since to 1.64 (since we're after 1.63) 2022-06-26 08:45:53 +00:00
Yuki Okushi
7e5aa3e5aa
Add regression test for #79224
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-26 17:19:32 +09:00
bors
0e1a6fb463 Auto merge of #98521 - JohnTitor:rollup-tl9sblx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #98371 (Fix printing `impl trait` under binders)
 - #98385 (Work around llvm 12's memory ordering restrictions.)
 - #98474 (x.py: Support systems with only `python3` not `python`)
 - #98488 (Bump RLS to latest master on rust-lang/rls)
 - #98491 (Fix backtrace UI test when panic=abort is used)
 - #98502 (Fix source sidebar hover in ayu theme)
 - #98509 (diagnostics: consider parameter count when suggesting smart pointers)
 - #98513 (Fix LLVM rebuild with download-ci-llvm.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-26 07:12:16 +00:00
Yuki Okushi
fba8dfd75f
Rollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum
Fix LLVM rebuild with download-ci-llvm.

This fixes an issue where updating a local checkout that includes a change in `src/version` causes a linking failure.

The cause is that the `rustc_llvm` build script uses `rerun-if-changed` of `llvm-config` to know if it needs to rerun. Cargo only compares the timestamp of the last time the build script to the file. However, extracting the tar files retains the timestamps in the tarball which may be some time in the past. Since `src/version` is included in the LLVM `.so` filename, `rustc` attempts to load the wrong shared library since the `rustc_llvm` build script doesn't rerun.

https://github.com/rust-lang/cargo/issues/10791 contains a more detailed explanation.

The solution here is a hack which updates the timestamp of `llvm-config` to the current time when it is extracted.

This is a bit of a hack, but seems to be the best solution I can think of until https://github.com/rust-lang/cargo/issues/10791 is fixed. There are likely several other situations where this is a problem (such as using system LLVM), and this isn't really a complete fix.

Note that apple platforms are not directly affected by this problem because they don't have a version in the dylib filename.

How to test this:

1. On a linux host, enable download-ci-llvm
2. Check out 7036449c77 (the commit just before the last version bump)
3. `./x.py build library/std`
4. Check out 5f015a24f9 (the commit that bumped the version)
5. `./x.py build library/std`

Fixes #98495
2022-06-26 13:15:03 +09:00
Yuki Okushi
c3b2291dc3
Rollup merge of #98509 - rust-lang:notriddle/precise-pin-diag, r=compiler-errors
diagnostics: consider parameter count when suggesting smart pointers

Fixes #96834
2022-06-26 13:15:02 +09:00
Yuki Okushi
d774bc39e0
Rollup merge of #98502 - GuillaumeGomez:source-sidebar-hover, r=notriddle
Fix source sidebar hover in ayu theme

In the screenshot below, `rc.rs` should be orange:

![Screenshot from 2022-06-25 22-24-06](https://user-images.githubusercontent.com/3050060/175789532-99e8781d-2e62-43f7-bbd9-1b1151e1f8c1.png)

It's because the CSS selector was not precise enough and was "overloaded" with another one. This PR fixes it and adds a test for the colors in the source sidebar.

cc `@jsha`
r? `@notriddle`
2022-06-26 13:15:01 +09:00
Yuki Okushi
b1d66d810d
Rollup merge of #98491 - antoyo:fix/ui-test-backtrace-panic-abort, r=Dylan-DPC
Fix backtrace UI test when panic=abort is used

The function `contains_verbose_expected` is only used when the panic strategy is not abort, so it caused a warning when it was abort, which made the UI test failed on stderr comparison.
2022-06-26 13:15:00 +09:00
Yuki Okushi
d0828a3915
Rollup merge of #98488 - Mark-Simulacrum:bump-rls, r=pietroalbini
Bump RLS to latest master on rust-lang/rls

Of primary interest, this merges
rust-lang/rls@ece09b88c0 into rust-lang/rust,
which brings in the changes that fix RLS tests broken by #97853. #97853 already
introduced that commit's changes (under
rust-lang/rls@27f4044df0) but without putting those changes on
rust-lang/rls as a branch, so we ended up with an orphan commit that caused
trouble when updating submodules in rust-lang/rust.

This commit, once merged into rust-lang/rust, should continue to let RLS tests
to pass on rust-lang/rust's side and move us back into a healthy state where tip
of the submodule points to a valid master commit in the rust-lang/rls
repository.

cc https://github.com/rust-lang/rust/issues/98451, but not marking as fixed as I believe we need to add verification to prevent future oversights.
2022-06-26 13:14:59 +09:00
Yuki Okushi
e1862ca51c
Rollup merge of #98474 - dtolnay:python3, r=Mark-Simulacrum
x.py: Support systems with only `python3` not `python`

Fixes #71818 without the pitfalls so far described in previous attempts.
2022-06-26 13:14:58 +09:00
Yuki Okushi
7c3977669b
Rollup merge of #98385 - m-ou-se:llvm-12-memory-order, r=petrochenkov
Work around llvm 12's memory ordering restrictions.

Older llvm has the pre-C++17 restriction on success and failure memory ordering, requiring the former to be at least as strong as the latter. So, for llvm 12, this upgrades the success ordering to a stronger one if necessary.

See https://github.com/rust-lang/rust/issues/68464
2022-06-26 13:14:57 +09:00
Yuki Okushi
645e5c475a
Rollup merge of #98371 - compiler-errors:better-opaque-printing, r=oli-obk
Fix printing `impl trait` under binders

Before, we would render `impl for<'a> Trait<'a>` like `impl Trait<for<'a> 'a>`, lol.
2022-06-26 13:14:56 +09:00
leocth
9c5ae20c59 forgot about the feature flag in the doctest 2022-06-26 10:49:05 +08:00