Commit Graph

222811 Commits

Author SHA1 Message Date
Deadbeef
5c99175a9e uplift clippy::clone_double_ref as suspicious_double_ref_op 2023-04-28 17:24:48 +00: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
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
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
db0bb92ff1 Remove invalid value from scraped-examples.md 2023-04-27 17:21:45 +01: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
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
Matthias Krüger
5215782421
Rollup merge of #110804 - cuishuang:master, r=jyn514
Remove repeated definite articles
2023-04-27 15:10:53 +02:00
Matthias Krüger
c2a79fb490
Rollup merge of #110426 - calebcartwright:style-let-else-examples, r=compiler-errors
docs(style): add more let-else examples

Adding a few more examples for increased clarity based on subsequent discussion that arose after implementation work began.

Will need approval from t-style, but also cc ```@ytmimi``` to make sure these examples don't contradict any examples we've been incorporating as part of the rustfmt implementation
2023-04-27 15:10:52 +02:00
bors
6ce22733b9 Auto merge of #110882 - BoxyUwU:rename-some-ty-flags, r=compiler-errors
rename `NEEDS_SUBST` and `NEEDS_INFER`

implements rust-lang/compiler-team#617
2023-04-27 09:55:37 +00:00
Nicholas Nethercote
793b2ffb67 Factor out common code in intern_node.
There are three very similar blocks in this function.
2023-04-27 17:50:02 +10:00
Nicholas Nethercote
207cec017f Clean up with_task.
Currently it creates an `Option` and then does `map`/`unwrap_or` and
`map_or_else` on it, which is hard to read.

This commit simplifies things by moving more code into the two arms of
the if/else.
2023-04-27 17:48:15 +10:00
Boxy
842419712a rename needs_subst to has_param 2023-04-27 08:35:19 +01:00
Boxy
f04b8fe0af rename needs_infer to has_infer 2023-04-27 08:35:19 +01:00
Nicholas Nethercote
4b85aa99ad Add a comment about TypeFoldable and slices. 2023-04-27 16:21:20 +10:00
bors
8b8110e146 Auto merge of #110728 - cjgillot:no-false-optes, r=oli-obk
Do not bother optimizing impossible functions.

This is currently checked by `ConstProp`, but I see no reason to restrict it to ConstProp only.
2023-04-27 04:29:49 +00:00
whtahy
fcf8468efc add known-bug test for unsound issue 105782 2023-04-26 22:34:39 -04:00
whtahy
21b9f5c3bb add known-bug test for unsound issue 74629 2023-04-26 22:34:39 -04:00
whtahy
a87359d7c9 add known-bug test for unsound issue 49682 2023-04-26 22:34:30 -04:00
whtahy
bfdd1c4e35 add known-bug test for unsound issue 40582 2023-04-26 22:34:29 -04:00
bors
e3ccd4b9a5 Auto merge of #110562 - ComputerDruid:riscv, r=tmandry
Add definitions for riscv64gc-unknown-fuchsia

To compile, also requires a libc update with https://github.com/rust-lang/libc/pull/3204
2023-04-27 01:29:50 +00:00
Philpax
d5d2785c86 docs(std): clarify remove_dir_all errors 2023-04-27 03:19:14 +02:00
Jules Bertholet
5b6e747f37
Nicer ICE for #67981 2023-04-26 19:46:10 -04:00
Michael Goulet
c18e7b765f IntoFuture::into_future is no longer unstable 2023-04-26 22:44:18 +00:00
bors
cb9aa8c9c1 Auto merge of #110861 - m-ou-se:thread-local-restructure, r=workingjubilee
Restructure and rename std thread_local internals to make it less of a maze

Every time I try to work on std's thread local internals, it feels like I'm trying to navigate a confusing maze made of macros, deeply nested modules, and types with multiple names/aliases. Time to clean it up a bit.

This PR:

- Exports `Key` with its own name (`Key`), instead of `__LocalKeyInner`
- Uses `pub macro` to put `__thread_local_inner` into a (unstable, hidden) module, removing `#[macro_export]`, removing it from the crate root.
- Removes the `__` from `__thread_local_inner`.
- Removes a few unnecessary `allow_internal_unstable` features from the macros
- Removes the `libstd_thread_internals` feature. (Merged with `thread_local_internals`.)
    - And removes it from the unstable book
- Gets rid of the deeply nested modules for the `Key` definitions (`mod fast` / `mod os` / `mod statik`).
- Turns a `#[cfg]` mess into a single `cfg_if`, now that there's no `#[macro_export]` anymore that breaks with `cfg_if`.
- Simplifies the `cfg_if` conditions to not repeat the conditions.
- Removes useless `normalize-stderr-test`, which were left over from when the `Key` types had different names on different platforms.
- Removes a seemingly unnecessary `realstd` re-export on `cfg(test)`.

This PR changes nothing about the thread local implementation. That's for a later PR. (Which should hopefully be easier once all this stuff is a bit cleaned up.)
2023-04-26 22:07:17 +00:00
Michael Goulet
0fabceb2df Make method-not-found-generic-arg-elision.rs error message not path dependent 2023-04-26 21:48:21 +00:00
Caleb Cartwright
0776a4bf27 docs(style): add more let-else examples
Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-26 14:58:49 -05:00
Mara Bos
12fee7b004 Update tests. 2023-04-26 21:02:56 +02:00
Mara Bos
5a62ebb0b1 Remove libstd_thread_internals from unstable book. 2023-04-26 21:02:45 +02:00
Mara Bos
fba5cfe482 Restructure and rename thread local things in std. 2023-04-26 21:02:29 +02:00
bors
1c42cb4ef0 Auto merge of #110852 - matthiaskrgr:rollup-jz3eosr, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #108760 (Add lint to deny diagnostics composed of static strings)
 - #109444 (Change tidy error message for TODOs)
 - #110419 (Spelling library)
 - #110550 (Suggest deref on comparison binop RHS even if type is not Copy)
 - #110641 (Add new rustdoc book chapter to describe in-doc settings)
 - #110798 (pass `unused_extern_crates` in `librustdoc::doctest::make_test`)
 - #110819 (simplify TrustedLen impls)
 - #110825 (diagnostics: add test case for already-solved issue)
 - #110835 (Make some region folders a little stricter.)
 - #110847 (rustdoc-json: Time serialization.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-26 18:32:57 +00:00
Tamir Duberstein
c7e16af796
compiletest: add bpf-linker assembly support 2023-04-26 13:46:32 -04:00
Matthias Krüger
63bccced0c
Rollup merge of #110847 - aDotInTheVoid:rdj-time-serialization, r=GuillaumeGomez
rustdoc-json: Time serialization.

This lets us know how much time is spent in json specific code, and how much performance we could gain by using a different serialization format.

For aws-sdk-ec2, it takes 0.7s, out of a 43s build (of which 6s is spent in json specific code), and makes a 173M json file

```
$ cargo +rust_stage2 rustdoc -p aws-sdk-ec2 -- -Zunstable-options -w json -Ztime-passes
 Documenting aws-sdk-ec2 v0.26.0 (/home/gh-aDotInTheVoid/aws-sdk-rust/sdk/ec2)
time:   5.229; rss:   64MB ->  891MB ( +827MB)  expand_crate
time:   5.230; rss:   61MB ->  891MB ( +830MB)  macro_expand_crate
time:   0.256; rss:  891MB ->  891MB (   +0MB)  AST_validation
time:   0.025; rss:  891MB ->  891MB (   +1MB)  finalize_imports
time:   0.093; rss:  891MB ->  891MB (   +0MB)  compute_effective_visibilities
time:   0.122; rss:  891MB ->  891MB (   +0MB)  finalize_macro_resolutions
time:   2.442; rss:  891MB -> 1188MB ( +297MB)  late_resolve_crate
time:   0.120; rss: 1188MB -> 1190MB (   +2MB)  resolve_check_unused
time:   0.211; rss: 1190MB -> 1190MB (   +0MB)  resolve_postprocess
time:   3.017; rss:  891MB -> 1190MB ( +299MB)  resolve_crate
time:   8.520; rss:   61MB -> 1181MB (+1120MB)  prepare_outputs
time:   0.152; rss: 1181MB -> 1181MB (   +0MB)  complete_gated_feature_checking
time:   0.539; rss: 1633MB -> 1632MB (   -1MB)  drop_ast
time:  15.492; rss:   58MB -> 1621MB (+1563MB)  type_collecting
time:   1.503; rss: 1621MB -> 1705MB (  +84MB)  item_types_checking
time:   1.274; rss: 1705MB -> 1726MB (  +21MB)  crate_lints
time:   1.275; rss: 1705MB -> 1726MB (  +21MB)  missing_docs
time:   0.281; rss: 1726MB -> 1726MB (   +0MB)  check_mod_attrs
time:   0.433; rss: 1744MB -> 1750MB (   +6MB)  clean_crate
time:  11.581; rss: 1750MB -> 2107MB ( +357MB)  collect_synthetic_impls
time:   0.019; rss: 2107MB -> 2107MB (   +0MB)  collect_items_for_trait_impls
time:  12.588; rss: 1750MB -> 2139MB ( +389MB)  collect-trait-impls
time:   0.197; rss: 2139MB -> 2139MB (   +0MB)  check_doc_test_visibility
time:   0.281; rss: 2139MB -> 2150MB (  +11MB)  strip-hidden
time:   0.260; rss: 2150MB -> 2150MB (   +0MB)  strip-private
warning: unresolved link to `date`
 --> sdk/ec2/src/client/describe_instances.rs:7:11184
  |
7 | ...te of the instance (for example, shows "User Initiated [date]" when you stop or terminate the instance). Similar to the state-reason-code filter.<...
  |                                                            ^^^^ no item named `date` in scope
  |
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

time:   0.363; rss: 2150MB -> 2150MB (   +0MB)  collect-intra-doc-links
time:   0.946; rss: 2150MB -> 2150MB (   +0MB)  propagate-doc-cfg
time:   0.494; rss: 2150MB -> 2152MB (   +2MB)  run-lints
time:   0.658; rss: 2152MB -> 2163MB (  +11MB)  create_format_cache
time:  34.818; rss:   58MB -> 2163MB (+2105MB)  run_global_ctxt
time:   0.016; rss: 2163MB -> 2163MB (   +0MB)  create_renderer(json)
time:   0.723; rss: 2780MB -> 2780MB (   +0MB)  rustdoc_json_serialization
time:   2.216; rss: 2399MB -> 2599MB ( +199MB)  renderer_after_krate(json)
time:   6.639; rss: 2163MB -> 2417MB ( +254MB)  render_json
time:   0.312; rss: 2417MB -> 2071MB ( -346MB)  free_global_ctxt
warning: `aws-sdk-ec2` (lib doc) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 43.06s
```

[(Zulip Discussion)](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/JSON.20metadata.20speed/near/352783145)

r? `@GuillaumeGomez`
2023-04-26 18:51:45 +02:00
Matthias Krüger
e47562c674
Rollup merge of #110835 - nnethercote:strict-region-folders-2, r=compiler-errors
Make some region folders a little stricter.

Because certain regions cannot occur in them.

r? ``@compiler-errors``
2023-04-26 18:51:44 +02:00
Matthias Krüger
bcd55cebfa
Rollup merge of #110825 - notriddle:notriddle/issue-70082, r=compiler-errors
diagnostics: add test case for already-solved issue

Fixes #70082
2023-04-26 18:51:44 +02:00
Matthias Krüger
8fe7a4937c
Rollup merge of #110819 - tamird:flattencompat-trustedlen, r=the8472
simplify TrustedLen impls

Implement on FlattenCompat and delegate from Flatten and FlatMap.

/cc ``@the8472``
2023-04-26 18:51:43 +02:00
Matthias Krüger
1d73549982
Rollup merge of #110798 - ozkanonur:rustdoc-unused-extern-crates, r=jyn514
pass `unused_extern_crates` in `librustdoc::doctest::make_test`

blocker for https://github.com/rust-lang/rust/pull/106621
2023-04-26 18:51:42 +02:00