Commit graph

223068 commits

Author SHA1 Message Date
John Bobbo 618841b815
Use NonNull::new_unchecked and NonNull::len in
`rustc_arena`.
2023-04-27 19:48:37 -07:00
cui fliter 176144e821 Fix unavailable url
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-28 09:54:35 +08:00
Yuki Okushi 00b9ce5a2a
Rollup merge of #110909 - john-h-k:build/no-rustc-version-darwin, r=jyn514
Skip `rustc` version detection on macOS

Fixes #104723
2023-04-28 10:52:02 +09:00
Yuki Okushi 75be558071
Rollup merge of #110898 - m-ou-se:remove-unused-thread-local-key, r=cuviper
Remove unused std::sys_common::thread_local_key::Key

Part of https://github.com/rust-lang/rust/issues/110897

This `Key` type seems unused. Let's remove it and see if anything explodes. :)
2023-04-28 10:52:01 +09:00
Yuki Okushi c464be96f8
Rollup merge of #110893 - BoxyUwU:inline_const_nits, r=compiler-errors
remove inline const deadcode in typeck

inline consts get typeck'd with their parent so this is not reachable
2023-04-28 10:52:00 +09:00
Yuki Okushi 0246af8664
Rollup merge of #110881 - bvanjoi:fix-110879, r=jyn514
refactor(docs): remove macro resolution fallback

close https://github.com/rust-lang/rust/issues/110879

r?`@jyn514`
2023-04-28 10:52:00 +09:00
Yuki Okushi eea5f8a9c4
Rollup merge of #110721 - lukas-code:panic-fmt, r=Amanieu
format panic message only once

Formatting the panic message multiple times can cause problems for some real-world crates, so here's a test to ensure that we don't do that.

This was regressed in https://github.com/rust-lang/rust/pull/109507 and reverted in https://github.com/rust-lang/rust/pull/110782.

fixes https://github.com/rust-lang/rust/issues/110717
fixes https://github.com/rust-itertools/itertools/issues/694
2023-04-28 10:51:59 +09:00
Yuki Okushi 085fbe9098
Rollup merge of #110620 - Nilstrieb:document-the-undocumented, r=thomcc
Document `const {}` syntax for `std::thread_local`.

It exists and is pretty cool. More people should use it.

It was added in #83416 and stabilized in #91355 with the tracking issue #84223.
2023-04-28 10:51:59 +09:00
Yuki Okushi 6b0da57551
Rollup merge of #109702 - chenyukang:yukang/fix-109316-configure, r=albertlarsan68
configure --set support list as arguments

Fixes #109316

r? `@jyn514`
2023-04-28 10:51:59 +09:00
Chris Denton ddff7f0e50
remove_dir_all: delete directory with fewer perms
If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link.
2023-04-28 02:30:45 +01:00
bors 9a3258fa52 Auto merge of #110801 - WaffleLapkin:io-tests, r=jyn514
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test

Fixes #110794

r? `@jyn514`
2023-04-28 00:17:47 +00:00
Nicholas Nethercote 37c9e45186 Add a comment explaining the lack of Decoder::read_enum_variant.
Because I was wondering about it, and this may save a future person from
also wondering.
2023-04-28 09:51:00 +10:00
Nicholas Nethercote b51deba9ac Remove MemDecoder::read_raw_bytes_inherent.
It's unnecessary. Note that `MemDecoder::read_raw_bytes` how has a `&'a
[u8]` return type, the same as what `read_raw_bytes_inherent` had.
2023-04-28 09:50:21 +10:00
bors 1a6ae3d692 Auto merge of #110916 - matthiaskrgr:rollup-g3c33zc, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #105745 (docs(std): clarify remove_dir_all errors)
 - #106456 (Correct `std::prelude` comment)
 - #106599 (Change memory ordering in System wrapper example)
 - #110838 (More `Typefoldable`/`TypeVisitable` cleanups)
 - #110851 (compiletest: emit assembly-output header in error)
 - #110853 (compiletest: add bpf-linker assembly support)
 - #110878 (Add `known-bug` tests for 4 unsound issues)
 - #110886 (`DepGraph` cleanups)
 - #110905 (Remove invalid value from scraped-examples.md)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-27 20:42:46 +00:00
The 8472 1a51ec6864 bless tests 2023-04-27 22:29:04 +02:00
The 8472 351e208f4c add tracing for layout optimizations 2023-04-27 22:29:03 +02:00
The 8472 4907dac54c don't promote large fields to higher alignments if that would affect niche placement 2023-04-27 22:29:03 +02:00
The 8472 faf2da3e2f try two different niche-placement strategies when layouting univariant structs 2023-04-27 22:29:03 +02:00
The 8472 be8e67d93c refactor: extract function 2023-04-27 22:29:03 +02:00
John Kelly cffc10b2c8 Comment round #1 2023-04-27 20:55:36 +01:00
Matthias Krüger 790912ac76
Rollup merge of #110905 - john-h-k:docs/cargo-flags, r=jyn514
Remove invalid value from scraped-examples.md

Fixes #110711
2023-04-27 21:34:17 +02:00
Matthias Krüger 50ccd17db6
Rollup merge of #110886 - nnethercote:dep-graph-cleanups, r=cjgillot
`DepGraph` cleanups

r? `@cjgillot`
2023-04-27 21:34:17 +02:00
Matthias Krüger 1091a7a884
Rollup merge of #110878 - whtahy:105107/known-bug-tests-for-unsound-issues, r=jackh726
Add `known-bug` tests for 4 unsound issues

This PR adds `known-bug` tests for 4 unsound issues as part of #105107
- #40582
- #49682
- #74629
- #105782
2023-04-27 21:34:16 +02:00
Matthias Krüger d3c43d0a22
Rollup merge of #110853 - tamird:compiletest-bpflinker-support, r=wesleywiser
compiletest: add bpf-linker assembly support
2023-04-27 21:34:16 +02:00
Matthias Krüger 743d565235
Rollup merge of #110851 - tamird:better-error-compiletest, r=compiler-errors
compiletest: emit assembly-output header in error

Improve the error message.
2023-04-27 21:34:15 +02:00
Matthias Krüger 57e9a4be48
Rollup merge of #110838 - nnethercote:more-Folder-Visitable-cleanups, r=lcnr
More `Typefoldable`/`TypeVisitable` cleanups

r? ``@lcnr``
2023-04-27 21:34:14 +02:00
Matthias Krüger 2148942757
Rollup merge of #106599 - MikailBag:patch-1, r=jyn514
Change memory ordering in System wrapper example

Currently, the `SeqCst` ordering is used, which seems unnecessary:
+ Even `Relaxed` ordering guarantees that all updates are atomic and are executed in total order
+ User code only reads atomic for monitoring purposes, no "happens-before" relationships with actual allocations and deallocations are needed for this

If argumentation above is correct, I propose changing ordering to `Relaxed` to clarify that no synchronization is required here, and improve performance (if somebody copy-pastes this example into their code).
2023-04-27 21:34:14 +02:00
Matthias Krüger aa22867caf
Rollup merge of #106456 - kadiwa4:std-prelude-comment, r=jyn514
Correct `std::prelude` comment

(Read the changed file first for context.)

First, `alloc` has no prelude.

Second, the docs for `v1` don't matter since the [prelude module] already has all the doc links. The `rust_2021` module for instance also doesnt have a convenient doc page. However as I understand glob imports still cant be used because the items dont have the same stabilisation versions.

[prelude module]: https://doc.rust-lang.org/std/prelude/index.html
2023-04-27 21:34:13 +02:00
Matthias Krüger e13b7f73c3
Rollup merge of #105745 - philpax:patch-1, r=jyn514
docs(std): clarify remove_dir_all errors

When using `remove_dir_all`, I assumed that the function was idempotent and that I could always call it to remove a directory if it existed. That's not the case and it bit me in production, so I figured I'd submit this to clarify the docs.
2023-04-27 21:34:13 +02:00
Be Wilson 6a89e9451f only error with +whole-archive,+bundle for rlibs
Fixes https://github.com/rust-lang/rust/issues/110912

Checking `flavor == RlibFlavor::Normal` was accidentally lost in
601fc8b36b
https://github.com/rust-lang/rust/pull/105601

That caused combining +whole-archive and +bundle link modifiers on
non-rlib crates to fail with a confusing error message saying that
combination is unstable for rlibs. In particular, this caused the
build to fail when +whole-archive was used on staticlib crates, even
though +whole-archive effectively does nothing on non-bin crates because
the final linker invocation is left to an external build system.
2023-04-27 14:33:36 -05:00
Michael Goulet 0279922157 Add a few more missing lints 2023-04-27 18:43:03 +00:00
Michael Goulet 3793263c7d Sort hardwired lints 2023-04-27 18:35:27 +00:00
Michael Goulet 183c7904e9 Add invalid_macro_export_arguments to built-in macro list 2023-04-27 18:33:39 +00:00
Nilstrieb b56d85dc09 Document const {} syntax for std::thread_local.
It exists and is pretty cool. More people should use it.
2023-04-27 20:24:18 +02:00
bors c14882f74e Auto merge of #107782 - Zoxc:worker-local, r=cjgillot
Move the WorkerLocal type from the rustc-rayon fork into rustc_data_structures

This PR moves the definition of the `WorkerLocal` type from `rustc-rayon` into `rustc_data_structures`. This is enabled by the introduction of the `Registry` type which allows you to group up threads to be used by `WorkerLocal` which is basically just an array with an per thread index. The `Registry` type mirrors the one in Rayon and each Rayon worker thread is also registered with the new `Registry`. Safety for `WorkerLocal` is ensured by having it keep a reference to the registry and checking on each access that we're still on the group of threads associated with the registry used to construct it.

Accessing a `WorkerLocal` is micro-optimized due to it being hot since it's used for most arena allocations.

Performance is slightly improved for the parallel compiler:
<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.9992s</td><td align="right">1.9949s</td><td align="right"> -0.21%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2977s</td><td align="right">0.2970s</td><td align="right"> -0.22%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">1.1335s</td><td align="right">1.1315s</td><td align="right"> -0.18%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.8235s</td><td align="right">1.8171s</td><td align="right"> -0.35%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.9047s</td><td align="right">6.8930s</td><td align="right"> -0.17%</td></tr><tr><td>Total</td><td align="right">12.1586s</td><td align="right">12.1336s</td><td align="right"> -0.21%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9977s</td><td align="right"> -0.23%</td></tr></table>

cc `@SparrowLii`
2023-04-27 17:43:09 +00:00
John Kelly 1b390f44cf Skip rustc version detection on macOS 2023-04-27 17:39:58 +01:00
John Kelly db0bb92ff1 Remove invalid value from scraped-examples.md 2023-04-27 17:21:45 +01:00
León Orell Valerian Liehr 34d96886d4
rustdoc: rebind bound vars to type-outlives predicates 2023-04-27 18:12:53 +02:00
Mara Bos 52ff751aa4 pub -> pub(super). 2023-04-27 16:42:17 +02:00
Guillaume Gomez 3f082843aa Add regression test for #110698 2023-04-27 16:41:22 +02:00
Guillaume Gomez adee37a080 repr attribute needs to be stored to be used in doc(inline) by rustdoc 2023-04-27 16:40:59 +02:00
KaDiWa 60ab69d168
correct std::prelude comment 2023-04-27 15:56:57 +02:00
bors 901fdb3b04 Auto merge of #110896 - matthiaskrgr:rollup-h8fetzd, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110426 (docs(style): add more let-else examples)
 - #110804 (Remove repeated definite articles)
 - #110814 (Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`)
 - #110816 (Migrate `rustc_passes` to translatable diagnostics)
 - #110864 (`IntoFuture::into_future` is no longer unstable)
 - #110866 (Make `method-not-found-generic-arg-elision.rs` error message not path dependent)
 - #110872 (Nicer ICE for #67981)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-27 13:38:19 +00:00
Mara Bos 0b3073abb1 Update test. 2023-04-27 15:25:48 +02:00
Mara Bos 94c855153a Remove unused std::sys_common::thread_local_key::Key. 2023-04-27 15:25:48 +02:00
Matthias Krüger 52d550b20e
Rollup merge of #110872 - Jules-Bertholet:err-67981, r=wesleywiser
Nicer ICE for #67981

Provides a slightly nicer ICE for #67981, documenting the problem. A proper fix will be necessary before `#![feature(unsized_fn_params)]` can be stabilized.

The problem is that the design of the `"rust-call"` ABI is fundamentally not compatible with `unsized_fn_params`. `"rust-call"` functions need to collect their arguments into a tuple, but if the arguments are not `Sized`, said tuple is potentially not even a valid type—and if it is, it requires `alloca` to create.

``@rustbot`` label +A-abi +A-codegen +F-unboxed_closures +F-unsized_fn_params
2023-04-27 15:10:56 +02:00
Matthias Krüger 1ca3f33ef7
Rollup merge of #110866 - compiler-errors:test, r=jyn514
Make `method-not-found-generic-arg-elision.rs` error message not path dependent

Every time I bless `tests/ui/methods/method-not-found-generic-arg-elision.rs`, I get some nonsense "type is too long" + "written to disk" that shows up and have to manually revert because the combination of my rustc repo path + the UI test directory hits the length limit for printing types spilling to disk (since this happens before UI test path sanitization).

The fact that we use a closure in this test doesn't have to do with the UI test, so just box the closure to make the type name smaller and not path dependent.
2023-04-27 15:10:55 +02:00
Matthias Krüger 563eb04c5d
Rollup merge of #110864 - compiler-errors:into-future-stable, r=jackh726
`IntoFuture::into_future` is no longer unstable

We don't need to gate the `IntoFuture::into_future` call in `.await` lowering anymore.

``@bors`` rollup
2023-04-27 15:10:55 +02:00
Matthias Krüger 63fbb05839
Rollup merge of #110816 - clubby789:rustc-passes-diagnostics, r=compiler-errors
Migrate `rustc_passes` to translatable diagnostics

cc #100717
2023-04-27 15:10:54 +02:00
Matthias Krüger b1ff6e3e10
Rollup merge of #110814 - WaffleLapkin:sprinkle_#inline, r=Nilstrieb
Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`

This is based on `nm --demangle (rustc +a --print sysroot)/lib/librustc_driver-*.so | rg CopyTaggedPtr` which shows many methods that should probably be inlined. May fix the regression in https://github.com/rust-lang/rust/pull/110795.

r? ```@Nilstrieb```
2023-04-27 15:10:53 +02:00