Commit Graph

15172 Commits

Author SHA1 Message Date
Vonr
7321e79114
Replace move|| with move || in compiler/ and library/
Edit from #126631 to revert changes on ui tests
2024-06-18 23:25:08 +08:00
bors
f873ae029e Auto merge of #126330 - m-ou-se:panic-message-type, r=Amanieu
Return opaque type from PanicInfo::message()

This changes the return type of the (unstable) PanicInfo::message() method to an opaque type (that implements Display). This allows for a bit more flexibility in the future.

See https://github.com/rust-lang/rust/issues/66745
2024-06-18 07:20:26 +00:00
Mara Bos
6c2507cab5 Add PanicMessage type for PanicInfo::message(). 2024-06-17 20:44:55 +02:00
Daria Sukhonina
a6a78d28e6 Add tracking issue to async_drop API 2024-06-17 17:20:13 +03:00
bors
fd7eefc275 Auto merge of #126569 - jieyouxu:rollup-1uvkb2y, r=jieyouxu
Rollup of 8 pull requests

Successful merges:

 - #125258 (Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope)
 - #126250 (docs(change): Don't mention a Cargo 2024 edition change for 1.79)
 - #126288 (doc: Added commas where needed)
 - #126346 (export std::os::fd module on HermitOS)
 - #126468 (div_euclid, rem_euclid: clarify/extend documentation)
 - #126531 (Add codegen test for `Request::provide_*`)
 - #126535 (coverage: Arrange span extraction/refinement as a series of passes)
 - #126538 (coverage: Several small improvements to graph code)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-17 04:01:54 +00:00
许杰友 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
joboet
cf9510cd33
std: move sys_common::backtrace to sys 2024-06-16 13:14:01 +02: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
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