Commit graph

15145 commits

Author SHA1 Message Date
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
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
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
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