Commit Graph

15227 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
61577a8734
Rollup merge of #126531 - slanterns:error_provider, r=workingjubilee
Add codegen test for `Request::provide_*`

Codegen before & after https://github.com/rust-lang/rust/pull/126242: https://gist.github.com/slanterns/3789ee36f59ed834e1a6bd4677b68ed4.

Also adjust an outdated comment since `tag_id` is no longer attached to `TaggedOption` via `Erased`, but stored next to it in `Tagged` under the new implementation.

My first time writing FileCheck xD. Correct me if there is anything that should be amended.

r? libs
2024-06-17 04:53:57 +01:00
许杰友 Jieyou Xu (Joe)
f39327bcf2
Rollup merge of #126468 - RalfJung:euclid, r=Mark-Simulacrum
div_euclid, rem_euclid: clarify/extend documentation
2024-06-17 04:53:56 +01:00
许杰友 Jieyou Xu (Joe)
cd4c0f06da
Rollup merge of #126346 - hermit-os:fd, r=Amanieu
export std::os::fd module on HermitOS

The HermitOS' IO interface is similiar to Unix. Consequently, this PR synchronize the FD implementation between both.

closes #126198
2024-06-17 04:53:56 +01:00
许杰友 Jieyou Xu (Joe)
a8ccf97445
Rollup merge of #126288 - x4exr:patch-1, r=dtolnay
doc: Added commas where needed

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-17 04:53:55 +01:00
bors
e794b0f855 Auto merge of #125720 - folkertdev:optimize_for_size-ptr-rotate, r=Amanieu
make `ptr::rotate` smaller when using `optimize_for_size`

code to reproduce https://github.com/folkertdev/optimize_for_size-slice-rotate

In the example the size of `.text` goes down from 1624 to 276 bytes.

```
> cargo size --release --features "left-std"  -- -A

slice-rotate  :
section              size        addr
.vector_table        1024         0x0
.text                1624       0x400
.rodata                 0       0xa58
.data                   0  0x20000000
.gnu.sgstubs            0       0xa60
.bss                    0  0x20000000
.uninit                 0  0x20000000
.debug_loc            591         0x0
.debug_abbrev        1452         0x0
.debug_info         10634         0x0
.debug_aranges        480         0x0
.debug_ranges        1504         0x0
.debug_str          11716         0x0
.comment               72         0x0
.ARM.attributes        56         0x0
.debug_frame         1036         0x0
.debug_line          5837         0x0
Total               36026

> cargo size --release --features "left-size"  -- -A

slice-rotate  :
section             size        addr
.vector_table       1024         0x0
.text                276       0x400
.rodata                0       0x514
.data                  0  0x20000000
.gnu.sgstubs           0       0x520
.bss                   0  0x20000000
.uninit                0  0x20000000
.debug_loc           347         0x0
.debug_abbrev        965         0x0
.debug_info         4216         0x0
.debug_aranges       168         0x0
.debug_ranges        216         0x0
.debug_str          3615         0x0
.comment              72         0x0
.ARM.attributes       56         0x0
.debug_frame         232         0x0
.debug_line          723         0x0
Total              11910
```

tracking issue: https://github.com/rust-lang/rust/issues/125612
2024-06-17 01:45:22 +00:00
Rayyan Khan
fe9154c64e
doc: Added commas where needed 2024-06-16 15:58:44 -07:00
Lukas Bergdoll
24697ac66b Fix doc-link issue 2024-06-16 20:26:33 +02:00
Lukas Bergdoll
9889ab1f60 Remove reliance on const_trait in sort implementations
const_trait in conjunction with specialization was
deemed not ready for usage in this scenario. So
instead a two-stage trait specialization approach
is used. This approach is likely worse for
compile-times. Future work that enables
const_trait can revert back to the previous
version as outlined in the comment marked
FIXME(effects).
2024-06-16 17:17:36 +02:00
joboet
cf9510cd33
std: move sys_common::backtrace to sys 2024-06-16 13:14:01 +02:00
Lzu Tao
06aee7ee03 use rustc-dep-of-std in panic_unwind
Wihout it, std keeps rebuiling when unchanged.
But we could use `--keep-stage=1` to make it not rebuild.
2024-06-16 09:38:30 +00:00
Jacob Pratt
623cf23621
Rollup merge of #126539 - lukaslueg:patch-1, r=jhpratt
Update `Arc::try_unwrap()` docs

Clarify the language wrt "race condition" not meaning "memory unsafety".

The docs make an important point about a 'logical' race condition that can occur if the `Err`-case in `Arc::try_unwrap()` is not handled properly. The language as is uses the term "race condition", which the reader may associate with "memory unsafety". This PR tries to clarify the scenario and qualify "race condition without memory unsafety".
2024-06-16 03:41:58 -04:00
Jacob Pratt
e4bc7deb78
Rollup merge of #125112 - tbu-:pr_create_dir_all_empty, r=dtolnay
Document behavior of `create_dir_all` wrt. empty path

The behavior makes sense because `Path::new("one_component").parent() == Some(Path::new(""))`, so if one naively wants to create the parent directory for a file to be written, it simply works.

Closes #105108 by documenting the current behavior.
2024-06-16 03:41:57 -04:00
lukaslueg
893f95f1f7
Update Arc::try_unwrap() docs
Clarify the language wrt `race condition` not meaning `memory unsafety`.
2024-06-16 09:07:08 +02:00
Lukas Bergdoll
f7496f5f85 Apply review comments 2024-06-16 08:27:49 +02:00
bors
cd0c944b07 Auto merge of #126299 - scottmcm:tune-sliceindex-ubchecks, r=saethlin
Remove superfluous UbChecks from `SliceIndex` methods

The current implementation calls the unsafe ones from the safe ones, but that means they end up emitting UbChecks that are impossible to hit, since we just checked those things.

This PR adds some new module-local helpers for the code shared between them, so the safe methods can be small enough to inline by avoiding those extra checks, while the unsafe methods still help catch length mistakes.

r? `@saethlin`
2024-06-16 03:22:02 +00:00
Scott McMurray
33c4817d98 Redo SliceIndex implementations 2024-06-15 17:39:25 -07:00
Slanterns
6cce48838b
update comment 2024-06-16 06:31:37 +08:00
Guillaume Gomez
4f83c1d967
Rollup merge of #126229 - ChrisDenton:bindgen, r=Mark-Simulacrum
Bump windows-bindgen to 0.57

This PR updates our generated Windows API bindings using the latest version of `windows-bindgen`.

The only change to the generated code is that `derive` is used for `Copy` and `Clone` instead of `impl`.
2024-06-15 19:51:34 +02:00
bors
92af831290 Auto merge of #126518 - matthiaskrgr:rollup-wb70rzq, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #125829 (rustc_span: Add conveniences for working with span formats)
 - #126361 (Unify intrinsics body handling in StableMIR)
 - #126417 (Add `f16` and `f128` inline ASM support for `x86` and `x86-64`)
 - #126424 ( Also sort `crt-static` in `--print target-features` output)
 - #126428 (Polish `std::path::absolute` documentation.)
 - #126429 (Add `f16` and `f128` const eval for binary and unary operationations)
 - #126448 (End support for Python 3.8 in tidy)
 - #126488 (Use `std::path::absolute` in bootstrap)
 - #126511 (.mailmap: Associate both my work and my private email with me)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-15 14:51:12 +00:00
Jubilee Young
b8eb6ad032 std: suggest OnceLock over Once 2024-06-15 00:09:03 -07:00
Kevin Reid
416888f05b Polish std::path::absolute documentation.
These changes bring it closer to other standard library documentation
and, in particular, `std::fs::canonicalize`, which it will often be
compared with.

* Add `# Platform-specific behavior` section, with content moved from
  Examples section.
* Create `# Errors` section.
* Phrase error description to allow future platforms to have new
  syntactic errors, rather than only emptiness.
* Add missing commas.
* Indent example code 4 spaces.
2024-06-14 13:13:27 -07:00
bors
f9515fdd5a Auto merge of #126473 - matthiaskrgr:rollup-8w2xm09, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123769 (Improve escaping of byte, byte str, and c str proc-macro literals)
 - #126054 (`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration)
 - #126135 (add HermitOS support for vectored read/write operations)
 - #126266 (Unify guarantees about the default allocator)
 - #126285 (`UniqueRc`: support allocators and `T: ?Sized`.)
 - #126399 (extend the check for LLVM build)
 - #126426 (const validation: fix ICE on dangling ZST reference)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 11:29:58 +00:00
Matthias Krüger
b55cabe636
Rollup merge of #126285 - kpreid:unique-rc, r=dtolnay
`UniqueRc`: support allocators and `T: ?Sized`.

Added the following (all unstable):

* Defaulted type pararameter `A: Allocator`.
* `UniqueRc::new_in()`.
* `T:  ?Sized` where possible.
* `impl CoerceUnsized for UniqueRc`.

These changes are motivated by supporting the implementation of unsized `Rc::make_mut()` (PR #116113), but are also intended to be obvious generalizations of `UniqueRc` to support the things `Rc` does.

r? ``````@the8472``````
2024-06-14 12:23:37 +02:00
Matthias Krüger
e923048768
Rollup merge of #126266 - tbu-:pr_doc_alloc_default_system, r=jhpratt
Unify guarantees about the default allocator

`std::alloc` said that the default allocator is unspecified for all crrate types except `cdylib` and `staticlib`. Adjust `std::alloc::System` documentation to say the same.

Fixes #125870.
2024-06-14 12:23:37 +02:00
Matthias Krüger
6396d4c846
Rollup merge of #126135 - hermit-os:fuse, r=jhpratt
add HermitOS support for vectored read/write operations

In general, the I/O interface of hermit-abi is revised and now a more POSIX-like interface. Consequently, platform abstraction layer for HermitOS has slightly adjusted and some inaccuracies remove.

Hermit is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2024-06-14 12:23:36 +02:00
Matthias Krüger
20ca54b6a6
Rollup merge of #123769 - dtolnay:literal, r=fee1-dead
Improve escaping of byte, byte str, and c str proc-macro literals

This PR changes the behavior of `proc_macro::Literal::byte_character` (https://github.com/rust-lang/rust/issues/115268), `byte_string`, and `c_string` (https://github.com/rust-lang/rust/issues/119750) to improve their choice of escape sequences. 3 categories of changes are made:

1. Never use `\x00`. Always prefer `\0`, which is supported in all the same places.

2. Never escape `\'` inside double quotes and `\"` inside single quotes.

3. Never use `\x` for valid UTF-8 in literals that permit `\u`.

The second commit adds tests covering these cases, asserting the **old** behavior.

The third commit implements the behavior change and simultaneously updates the tests to assert the **new** behavior.
2024-06-14 12:23:35 +02:00
Ralf Jung
9e851041d7 div_euclid, rem_euclid: clarify/extend documentation 2024-06-14 11:18:59 +02:00
Matthias Krüger
e1e72aa486
Rollup merge of #126351 - devnexen:to_sol11_upd, r=ChrisDenton
std::unix::fs::link using direct linkat call for Solaris.

Since we support solaris 11 as minimum, we can get rid of the runtime overhead.

try-job: dist-various-2
2024-06-14 08:35:49 +02:00
Matthias Krüger
3494ea1818
Rollup merge of #126402 - firefighterduck:fix-unsafe-precon-copy, r=Nilstrieb
Fix wrong `assert_unsafe_precondition` message for `core::ptr::copy`

A small fix in the `assert_unsafe_precondition` message for `core::ptr::copy` as described by https://github.com/rust-lang/rust/issues/126400 .

fixes #126400
2024-06-13 22:55:49 +02:00
Matthias Krüger
5de59519fb
Rollup merge of #126390 - Kriskras99:master, r=Nilstrieb
Fix wording in {checked_}next_power_of_two

Small documentation update
2024-06-13 22:55:48 +02:00
Matthias Krüger
4dd8813afd
Rollup merge of #126360 - compiler-errors:uplift-structural-traits, r=lcnr
Uplift `structural_traits.rs` into the new trait solver

Self-explanatory. I will leave some comments inline regarding design decisions.
2024-06-13 22:55:46 +02:00
Matthias Krüger
a685cdc34f
Rollup merge of #123726 - jieyouxu:command-new-docs, r=Nilstrieb
Clarify `Command::new` behavior for programs with arguments

I mistakenly passed program path along arguments as the same string into `Command::new` a couple of times now. It might be useful to explicitly highlight that `Command::new` intends to accept path to a program, not path to a program plus arguments. Also nudge the user to use `Command::arg` or `Command::args` if they wish to pass arguments.
2024-06-13 22:55:44 +02:00
David Tolnay
7ddc89e893
Remove superfluous escaping from byte, byte str, and c str literals 2024-06-13 09:49:15 -07:00
Michael Goulet
d3812ac95f LangItem-ify Coroutine trait in solvers 2024-06-13 09:34:28 -04:00
Florian Sextl
0cc099b8a2 fix wrong assert_unsafe_precondition message for core::ptr::copy 2024-06-13 14:45:45 +02:00
León Orell Valerian Liehr
f1a4f30940
Rollup merge of #126384 - RalfJung:is_none_or, r=workingjubilee
add tracking issue for is_none_or

This was forgotten in https://github.com/rust-lang/rust/pull/126328.

Cc https://github.com/rust-lang/rust/issues/126383
2024-06-13 13:05:27 +02:00
León Orell Valerian Liehr
1fc56c94f1
Rollup merge of #126347 - slanterns:try_simplify, r=scottmcm
Simplify `try_*`'s signature on `Iterator`

Inspired by https://github.com/rust-lang/rust/pull/126249#issuecomment-2161859295.

r? `@scottmcm`

(Seems there's no need to explicitly use `<Self as Iterator>::Item`? I only find this occurrence across the whole file.)
2024-06-13 13:05:24 +02:00
Christiaan Biesterbosch
523408e661 Fix wording in {checked_}next_power_of_two 2024-06-13 11:46:42 +02:00
Ralf Jung
898b541cb6 add tracking issue for is_none_or 2024-06-13 10:09:59 +02:00
David Carlier
c81ffab3ec
std::unix::fs::link using direct linkat call for Solaris and macOs.
Since we support solaris 11 and macOs Sierra as minimum, we can get rid
of the runtime overhead.
2024-06-13 04:35:28 +01:00
Jubilee
f5af7eea1a
Rollup merge of #126328 - RalfJung:is_none_or, r=workingjubilee
Add Option::is_none_or

ACP: https://github.com/rust-lang/libs-team/issues/212
2024-06-12 20:03:20 -07:00
Slanterns
fac1733925
Simplify try_* on Iterator 2024-06-13 02:57:36 +08:00
Stefan Lankes
c462328382 export std::os::fd module on HermitOS
The HermitOS' IO interface is similiar to Unix. Consequently,
this PR synchronize the FD implementation between both.
2024-06-12 20:46:52 +02:00
bors
c25ac9d6cc Auto merge of #126273 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
Bump stage0 to 1.80.0

r? `@Mark-Simulacrum`
2024-06-12 18:15:32 +00:00
Ralf Jung
63bdcaa2d9 add is_none_or 2024-06-12 16:12:29 +02:00
Guillaume Gomez
5d22e7a881
Rollup merge of #126322 - m-ou-se:panicinfo-and-panicinfo-2, r=RalfJung
Follow up to splitting core's PanicInfo and std's PanicInfo
2024-06-12 15:45:03 +02:00
Guillaume Gomez
d1414c5e0d
Rollup merge of #126242 - yaahc:simplify-provider, r=jhpratt
Simplify provider api to improve llvm ir

This PR seeks to resolve the last concern in https://github.com/rust-lang/rust/issues/99301#issuecomment-1699427740

We resolve the issue by moving the type_id to be stored in the `Request` itself rather than being accessed through the `Erased` trait, letting the compiler infer that the value of the type id will not change between lookups.

### LLVM Codegen

**Before**

```
; <provider_test::MyError as core::error::Error>::provide
; Function Attrs: nonlazybind uwtable
define void `@"_ZN61_$LT$provider_test..MyError$u20$as$u20$core..error..Error$GT$7provide17hd9c9de412063aa73E"(ptr` noalias nocapture noundef nonnull readonly align 1 %self, ptr noundef nonnull align 1 %request.0, ptr noalias nocapture noundef readonly align 8 dereferenceable(32) %request.1) unnamed_addr #0 personality ptr `@rust_eh_personality` {
start:
  %0 = getelementptr inbounds i8, ptr %request.1, i64 24
  %self.1.val.i = load ptr, ptr %0, align 8
  %1 = tail call { i64, i64 } %self.1.val.i(ptr noundef nonnull align 1 %request.0), !noalias !15
  %2 = extractvalue { i64, i64 } %1, 0
  %3 = extractvalue { i64, i64 } %1, 1
  %_18.i.i = icmp ne i64 %2, 1101338453689927725
  %_2.i.i = icmp ne i64 %3, 472224167662714873
  %or.cond.i.not.i = select i1 %_18.i.i, i1 true, i1 %_2.i.i
  br i1 %or.cond.i.not.i, label %_ZN4core5error7Request7provide17h8f8125d2543333e0E.exit, label %bb2.i
```

**After**

```
; <provider_test::MyError as provider_test::Error>::provide
; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(argmem: readwrite) uwtable
define void `@"_ZN63_$LT$provider_test..MyError$u20$as$u20$provider_test..Error$GT$7provide17h5bbf091795a6d359E"(ptr` noalias nocapture noundef nonnull readonly align 1 %self, ptr nocapture noundef nonnull align 8 %request.0, ptr noalias nocapture noundef readonly align 8 dereferenceable(24) %request.1) unnamed_addr #2 personality ptr `@rust_eh_personality` {
start:
  %_19.i = load i64, ptr %request.0, align 8, !noalias !3, !noundef !3
  switch i64 %_19.i, label %_ZN13provider_test7Request7provide17heb3ee140962e3b2fE.exit [
    i64 7665305208997882008, label %bb12.i
    i64 7050211241160863540, label %bb12.i3
    i64 9112786072622981063, label %bb12.i11
  ]
```
2024-06-12 15:45:00 +02:00
Guillaume Gomez
ee45f5bdb3
Rollup merge of #126039 - dpaoliello:arm64ecbuild, r=davidtwco
Promote `arm64ec-pc-windows-msvc` to tier 2

MCP: <https://github.com/rust-lang/compiler-team/issues/746>

* Update platform support docs
* Add `arm64ec-pc-windows-msvc` as a target to the existing AArch64 Windows build in CI.
* Fix docs build break.
* Add `arm64ec-pc-windows-msvc` to build manifest.

CI build (succeeded, but upload to S3 failed): <https://github.com/rust-lang/rust/actions/runs/9388227822/job/25853013083?pr=126039>
2024-06-12 15:44:57 +02:00
Mara Bos
749a685626 Fix deprecated version. 2024-06-12 13:23:21 +02:00
Mara Bos
9afc91349e Update doc comment on PanicInfo::message(). 2024-06-12 13:17:42 +02:00
Mara Bos
2944eab5e6 Use payload_as_str instead of two downcasts. 2024-06-12 13:15:29 +02:00
Mara Bos
1dc7952303 Fix deprecation version. 2024-06-12 13:15:17 +02:00
Mara Bos
cae18fa7b0 Clarify doc comment. 2024-06-12 13:15:10 +02:00
bors
bbe9a9c20b Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee
Rollup of 16 pull requests

Successful merges:

 - #123374 (DOC: Add FFI example for slice::from_raw_parts())
 - #124514 (Recommend to never display zero disambiguators when demangling v0 symbols)
 - #125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking)
 - #125980 (Nvptx remove direct passmode)
 - #126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.)
 - #126210 (docs(core): make more const_ptr doctests assert instead of printing)
 - #126249 (Simplify `[T; N]::try_map` signature)
 - #126256 (Add {{target}} substitution to compiletest)
 - #126263 (Make issue-122805.rs big endian compatible)
 - #126281 (set_env: State the conclusion upfront)
 - #126286 (Make `storage-live.rs` robust against rustc internal changes.)
 - #126287 (Update a cranelift patch file for formatting changes.)
 - #126301 (Use `tidy` to sort crate attributes for all compiler crates.)
 - #126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`)
 - #126310 (Migrate run make prefer rlib)
 - #126314 (fix RELEASES: we do not support upcasting to auto traits)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-12 11:10:50 +00:00
Jubilee
3862f01655
Rollup merge of #126305 - workingjubilee:fix-os-string-to-string-utf8-invariant, r=joboet
Make PathBuf less Ok with adding UTF-16 then `into_string`

Fixes #126291 which is, as far as I can tell, a regression introduced by #96869.

try-job: x86_64-msvc
2024-06-12 03:57:25 -07:00
Jubilee
ac73965719
Rollup merge of #126287 - nnethercote:reformat-cranelift-patch, r=bjorn3
Update a cranelift patch file for formatting changes.

PR #125443 will reformat all the use declarations in the repo. This would break a patch kept in `rustc_codegen_cranelift` that gets applied to `library/std/src/sys/pal/windows/rand.rs`.

So this commit formats the use declarations in `library/std/src/sys/pal/windows/rand.rs` in advance of #125443 and updates the patch file accordingly.

The motivation is that #125443 is a huge change and we want to get fiddly little changes like this out of the way so it can be nothing more than an `x fmt --all`.

r? ``@bjorn3``
2024-06-12 03:57:24 -07:00
Jubilee
0805ab47c9
Rollup merge of #126281 - ChrisDenton:env, r=jhpratt
set_env: State the conclusion upfront

People tend to skim or skip over long explanations so we should be very upfront that `set_var` and `remove_var` are being made unsafe for a very good reason.

This is just the conclusion restated almost verbatim but earlier in the docs and separated from the explanation:

0c960618b5/library/std/src/env.rs (L338-L339)

I think this may help with people who may not be entirely comfortable with #125937 being rejected.
2024-06-12 03:57:23 -07:00
Jubilee
4de77b6d8a
Rollup merge of #126249 - workingjubilee:simplify-try-map-signature, r=scottmcm
Simplify `[T; N]::try_map` signature

People keep making fun of this signature for being so gnarly.
Associated type bounds admit a much simpler scribbling.

r? ````@scottmcm````
2024-06-12 03:57:21 -07:00
Jubilee
3a37293e92
Rollup merge of #126210 - lolbinarycat:ptr_doctest_assert, r=workingjubilee
docs(core): make more const_ptr doctests assert instead of printing

improves on #124669
2024-06-12 03:57:21 -07:00
Jubilee
8d3b9a19cf
Rollup merge of #123374 - mgeier:doc-slice-from-raw-parts, r=scottmcm
DOC: Add FFI example for slice::from_raw_parts()

For some discussion, see https://users.rust-lang.org/t/missing-guidance-on-converting-ffi-ptr-length-to-slice/106048

See also #120608.
2024-06-12 03:57:18 -07:00
Oli Scherer
0bc2001879 Require any function with a tait in its signature to actually constrain a hidden type 2024-06-12 08:53:59 +00:00
Oli Scherer
39e7bf6826 Revert "Rollup merge of #125362 - joboet:tait_hack, r=Nilstrieb"
This reverts commit 1e4bde1cb9, reversing
changes made to 4ee97fc3db.
2024-06-12 08:47:49 +00:00
Jubilee Young
af04418a05 Make PathBuf less Ok with adding UTF-16 then into_string 2024-06-12 01:00:21 -07:00
Nicholas Nethercote
7e7da49f2a Update a cranelift patch file for formatting changes.
PR #125443 will reformat all the use declarations in the repo. This
would break a patch kept in `rustc_codegen_cranelift` that gets applied
to `library/std/src/sys/pal/windows/rand.rs`.

So this commit formats the use declarations in
`library/std/src/sys/pal/windows/rand.rs` in advance of #125443 and
updates the patch file accordingly.

The motivation is that #125443 is a huge change and we want to get
fiddly little changes like this out of the way so it can be nothing more
than an `x fmt --all`.
2024-06-12 08:52:40 +10:00
Kevin Reid
27ecb71635 UniqueRc: support allocators and T: ?Sized.
Added the following (all unstable):

* Defaulted type pararameter `A: Allocator`.
* `UniqueRc::new_in()`.
* `T:  ?Sized` where possible.
* `impl CoerceUnsized for UniqueRc`.
* Drive-by doc polish: links and periods at the end of sentences.

These changes are motivated by supporting the implementation of unsized
`Rc::make_mut()` (PR #116113), but are also intended to be obvious
generalizations of `UniqueRc` to support the things `Rc` does.
2024-06-11 15:16:47 -07:00
Chris Denton
751143ef40
set_env: State the conclusion upfront 2024-06-11 17:12:20 +00:00
Eduardo Sánchez Muñoz
6a04dfe78c Rename std::fs::try_exists to std::fs::exists and stabilize fs_try_exists 2024-06-11 18:33:40 +02:00
Tobias Bucher
bb8eb44511 Unify guarantees about the default allocator
`std::alloc` said that the default allocator is unspecified for all
crrate types except `cdylib` and `staticlib`. Adjust
`std::alloc::System` documentation to say the same.

Fixes #125870.
2024-06-11 17:13:26 +02:00
Pietro Albini
cd2ed56502
remove cfg(bootstrap) 2024-06-11 16:52:04 +02:00
Pietro Albini
be9e27e490
replace version placeholder 2024-06-11 16:52:02 +02:00
Mara Bos
a6e23b126b Formatting. 2024-06-11 15:47:00 +02:00
Mara Bos
a345c3daf6 Bump deprecation of std's PanicInfo alias to 1.82.0. 2024-06-11 15:47:00 +02:00
Mara Bos
de07c1a928 Add PanicHookInfo::payload_as_str(). 2024-06-11 15:47:00 +02:00
Mara Bos
fb0990d1e1 Fix display of panic message in recursive panic. 2024-06-11 15:47:00 +02:00
Mara Bos
877a26f6c9 Mention core's PanicInfo in error.md. 2024-06-11 15:47:00 +02:00
Mara Bos
32bfe703e2 Add note on panic payload type. 2024-06-11 15:47:00 +02:00
Mara Bos
ce0bc8bd58 Downcast panic payload to String too in example. 2024-06-11 15:47:00 +02:00
Mara Bos
f5fe82fdca Move deprecation of std::panic::PanicInfo to 1.80.0. 2024-06-11 15:47:00 +02:00
Mara Bos
3854357ad2 Fix deprecation version. 2024-06-11 15:47:00 +02:00
Mara Bos
64e56db72a Rename std::panic::PanicInfo to PanicHookInfo. 2024-06-11 15:47:00 +02:00
Mara Bos
b6180a9185 Formatting. 2024-06-11 15:47:00 +02:00
Mara Bos
6b2d7c4707 Fix invalid markdown/html. 2024-06-11 15:47:00 +02:00
Mara Bos
bab26b02c7 Reorder body of begin_panic for consistency.
In the other functions, we put the struct and impl blocks first,
such that the return expression can be at the end of the body as usual.
2024-06-11 15:46:59 +02:00
Mara Bos
1642de33d3 Impl Display for PanicPayload to simplify things. 2024-06-11 15:46:59 +02:00
Mara Bos
22f7399b32 Use unnamed lifetimes for [..]Payload impl blocks. 2024-06-11 15:46:59 +02:00
Mara Bos
4e356f3184 Move downcasting panic payload to str to a function. 2024-06-11 15:46:59 +02:00
Mara Bos
0087d89983 Mark some PanicInfo methods as #[inline] for consistency. 2024-06-11 15:46:59 +02:00
Mara Bos
0642cb2994 Remove std::panic::PanicInfo::internal_constructor+set_payload.
We can just set the payload immediately in the constructor,
and the constructor does not need to be public.
2024-06-11 15:46:59 +02:00
Mara Bos
0266bbf6e4 Remove core::panic::PanicInfo::internal_constructor.
It no longer needs to be public.
2024-06-11 15:46:59 +02:00
Mara Bos
83dd214f06 Update doc comment about core::panicking. 2024-06-11 15:46:59 +02:00
Mara Bos
331b8a3edd Fix doc link. 2024-06-11 15:46:59 +02:00
Mara Bos
16dfc6ddc1 Add core::panic::PanicInfo::payload() for compatibility. 2024-06-11 15:46:59 +02:00
Mara Bos
a519dc85f8 Document difference between core and std's PanicInfo. 2024-06-11 15:46:59 +02:00
Mara Bos
e3e815370e Split core's PanicInfo and std's PanicInfo. 2024-06-11 15:46:59 +02:00
Jubilee Young
d6955445f5 Simplify [T; N]::try_map signature
People keep making fun of this signature for being so gnarly.
Associated type bounds lend it a much simpler scribbling.
ChangeOutputType can also come along for the ride.
2024-06-11 01:50:43 -07:00
Jane Losare-Lusby
6e3134972e Simplify provider api to improve llvm ir 2024-06-10 13:20:22 -07:00
Matthias Krüger
b59507874e
Rollup merge of #126212 - SteveLauC:fix/haiku, r=joboet
fix: build on haiku

## What does this PR do

The std is broken on haiku, this PR fixes it.

## To reproduce the issue

```sh
$ cargo +nightly --version
cargo 1.81.0-nightly (b1feb75d0 2024-06-07)

$ cargo new hello
$ cd hello
$ cargo +nightly check -Zbuild-std --target x86_64-unknown-haiku -q
error[E0433]: failed to resolve: use of undeclared crate or module `std`
   --> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/os.rs:468:13
    |
468 |             std::ptr::null_mut(),
    |             ^^^ use of undeclared crate or module `std`
    |
help: consider importing one of these items
    |
8   + use core::ptr;
    |
8   + use crate::ptr;
    |
help: if you import `ptr`, refer to it directly
    |
468 -             std::ptr::null_mut(),
468 +             ptr::null_mut(),
    |

error[E0433]: failed to resolve: use of undeclared crate or module `std`
   --> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/os.rs:470:13
    |
470 |             std::ptr::null_mut(),
    |             ^^^ use of undeclared crate or module `std`
    |
help: consider importing one of these items
    |
8   + use core::ptr;
```
2024-06-10 21:12:27 +02:00
Matthias Krüger
146f4b316e
Rollup merge of #126191 - ivan-shrimp:nonzero_doc, r=scottmcm
Fix `NonZero` doctest inconsistencies

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
`NonZero`'s doctests contain both `?` and `.unwrap()` with no obvious reason for the difference, so this changes all of them to `?`. Also removes an explicit `std::num::NonZero`.
2024-06-10 21:12:26 +02:00
Chris Denton
8bd8f599eb
Bump windows-bindgen to 0.57 2024-06-10 13:51:29 +00:00
许杰友 Jieyou Xu (Joe)
bd6fca2015 Clarify Command::new behavior if passed programs with arguments 2024-06-10 12:25:05 +00:00