Commit Graph

222786 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Matthias Krüger
66a5ac0199
Rollup merge of #110641 - GuillaumeGomez:rustdoc-in-doc-settings, r=notriddle
Add new rustdoc book chapter to describe in-doc settings

Fixes #55165.

I continue going through old rustdoc issues. This one made a lot of sense so decided to add the missing chapter.

r? ``@notriddle``
2023-04-26 18:51:42 +02:00
Matthias Krüger
8e6fffcbaa
Rollup merge of #110550 - compiler-errors:deref-on-binop-rhs, r=wesleywiser
Suggest deref on comparison binop RHS even if type is not Copy

Fixes #110500
2023-04-26 18:51:41 +02:00
Matthias Krüger
9babe98562
Rollup merge of #110419 - jsoref:spelling-library, r=jyn514
Spelling library

Split per https://github.com/rust-lang/rust/pull/110392

I can squash once people are happy w/ the changes. It's really uncommon for large sets of changes to be perfectly acceptable w/o at least some changes.

I probably won't have time to respond until tomorrow or the next day
2023-04-26 18:51:41 +02:00
Matthias Krüger
ea8bd06b56
Rollup merge of #109444 - WaffleLapkin:undeprecate_todos, r=jyn514
Change tidy error message for TODOs

Blocked on #109440 (first few commits are from where)

IMO "deprecated" doesn't really explain anything, I've tried to highlight the actual reason we error on TODOs. The message is not at all perfect, maybe someone has ideas how to phrase it better?
2023-04-26 18:51:40 +02:00
Matthias Krüger
309496cf29
Rollup merge of #108760 - clubby789:autolintstuff, r=wesleywiser
Add lint to deny diagnostics composed of static strings

r? ghost

I'm hoping to have a lint that semi-automatically converts simple diagnostics such as `struct_span_err(span, "msg").help("msg").span_note(span2, "msg").emit()` to typed session diagnostics. It's quite hacky and not entirely working because of problems with `x fix` but should hopefully help reduce some of the work.
I'm going to start trying to apply what I can from this, but opening this as a draft in case anyone wants to develop on it.

cc #100717
2023-04-26 18:51:40 +02:00
cui fliter
ef6d4c504d Remove repeated definite articles
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-27 00:48:00 +08:00
bors
9c044d77a3 Auto merge of #110822 - scottmcm:lower-offset-to-mir, r=compiler-errors
Lower `intrinsics::offset` to `mir::BinOp::Offset`

They're [semantically the same](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.Rvalue.html#variant.BinaryOp), so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-26 15:52:33 +00:00
Alona Enraght-Moony
2b7dd084a3 rustdoc-json: Time serialization. 2023-04-26 14:55:30 +00:00
Maybe Waffle
b311ec02cc Try to improve tidy errors on TODOs 2023-04-26 14:06:36 +00:00
bors
8763965a2c Auto merge of #97368 - tmandry:coverage-underflow, r=jyn514
coverage: Don't underflow column number

I noticed this when running coverage on a debug build of rustc. There
may be other places that do this but I'm just fixing the one I hit.

r? `@wesleywiser` `@richkadel`
2023-04-26 12:03:13 +00:00
clubby789
6a41cfe095 Migrate rustc_passes to translatable diagnostics 2023-04-26 11:40:21 +01:00
bors
ae3ab14faa Auto merge of #110839 - jyn514:rollup-uikilwm, r=jyn514
Rollup of 9 pull requests

Successful merges:

 - #108416 (black_box doc corrections for clarification - Issue #107957)
 - #109379 (Replace `yes` command by `while-echo` in test `tests/ui/process/process-sigpipe.rs`)
 - #110266 (Update documentation wording on path 'try_exists' functions)
 - #110329 (Improve tests for #110138)
 - #110418 (Spelling rustdoc)
 - #110587 (Fix `std` compilation error for wasi+atomics)
 - #110594 (`rustc --help` add `--cfg` SPEC declaration.)
 - #110792 (Use the standard macOS CI runner)
 - #110817 (Add regression tests for const-generic inherent associated types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-26 07:43:17 +00:00
jyn
8c0dfa31f4
Rollup merge of #110817 - fmease:fix-109759, r=compiler-errors
Add regression tests for const-generic inherent associated types

Fixes #109759.
The tests are no longer failing since #96840 which was merged recently (#109410 is no longer necessary for them).

`@rustbot` label F-inherent_associated_types
2023-04-26 01:55:53 -05:00
jyn
a441144d89
Rollup merge of #110792 - rylev:standard-macos-ci, r=pietroalbini
Use the standard macOS CI runner

This moves back to the standard macOS CI runner instead of the large runners. The infra team is discussing whether the large runners are worth the cost at our heavy usage and whether those credits are better spent elsewhere. This will slow down CI build times unfortunately, but while we figure out our CI spending budget, that's a price we'll unfortunately have to pay.

r? `@pietroalbini`
2023-04-26 01:55:53 -05:00
jyn
62b5beaf93
Rollup merge of #110594 - infdahai:cfg_chore, r=jyn514
`rustc --help` add `--cfg` SPEC declaration.

1. fixes #110462
2. add spec arguments based on https://doc.rust-lang.org/reference/conditional-compilation.html
2023-04-26 01:55:52 -05:00
jyn
3fbaf789bd
Rollup merge of #110587 - tomaka:fix-109727, r=jyn514
Fix `std` compilation error for wasi+atomics

Fix https://github.com/rust-lang/rust/issues/109727

It seems that the `unsupported/once.rs` module isn't meant to exist at the same time as the `futex` module, as they have conflicting definitions.

I've solved this by defining the `once` module only if `not(target_feature = "atomics")`.
The `wasm32-unknown-unknown` target [similarly only defines the `once` module if `not(target_feature = "atomics")`](01c4f31927/library/std/src/sys/wasm/mod.rs (L69-L70)).

As show in [this block of code](01c4f31927/library/std/src/sys_common/once/mod.rs (L10-L34)), the `sys::once` module doesn't need to exist if `all(target_arch = "wasm32", target_feature = "atomics")`.
2023-04-26 01:55:52 -05:00
jyn
3163dfd1cd
Rollup merge of #110418 - jsoref:spelling-rustdoc, r=jyn514
Spelling rustdoc

Split per https://github.com/rust-lang/rust/pull/110392#issuecomment-1510148682
2023-04-26 01:55:51 -05:00
jyn
a1d47188a7
Rollup merge of #110329 - aDotInTheVoid:json-inline-again, r=jyn514
Improve tests for #110138

These should live in rustdoc-json, not rustdoc-ui, so we can run assertions, and not just check there's no ICE

CC #100515, as we never document this suite

r? rustdoc
2023-04-26 01:55:51 -05:00
jyn
ce30232f16
Rollup merge of #110266 - tgross35:try-exists-wording, r=jyn514
Update documentation wording on path 'try_exists' functions

Just eliminate the quadruple negation in `doesn't silently ignore errors unrelated to ... not existing.`
2023-04-26 01:55:50 -05:00