Commit Graph

18482 Commits

Author SHA1 Message Date
Chris Denton
3cb53df1fe
Return OutOfMemoryError and update docs 2025-03-07 17:51:56 +00:00
Chris Denton
0dfe2ae3fb
Windows: Use MoveFileEx by default in fs:rename 2025-03-07 17:51:49 +00:00
bors
03eb454523 Auto merge of #138155 - matthiaskrgr:rollup-xq5buio, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #137674 (Enable `f16` for LoongArch)
 - #138034 (library: Use `size_of` from the prelude instead of imported)
 - #138060 (Revert #138019 after further discussion about how hir-pretty printing should work)
 - #138073 (Break critical edges in inline asm before code generation)
 - #138107 (`librustdoc`: clippy fixes)
 - #138111 (Use `default_field_values` for `rustc_errors::Context`, `rustc_session::config::NextSolverConfig` and `rustc_session::config::ErrorOutputType`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-07 13:47:27 +00:00
Matthias Krüger
b834632071
Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35
library: Use `size_of` from the prelude instead of imported

Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.

try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-msvc-1
2025-03-07 10:12:44 +01:00
Matthias Krüger
6e7d1353d1
Rollup merge of #137674 - heiher:enable-f16-loong, r=tgross35
Enable `f16` for LoongArch

Blocked on https://github.com/rust-lang/compiler-builtins/pull/770

r? ```@tgross35```

Tracking issue for f16: https://github.com/rust-lang/rust/issues/116909

try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
2025-03-07 10:12:43 +01:00
Matthias Krüger
c33e9d6844
Rollup merge of #138129 - RalfJung:stabilize-const-things, r=tgross35
Stabilize const_char_classify, const_sockaddr_setters

FCP for const_char_classify: #132241
FCP for const_sockaddr_setters: #131714

Fixes #132241
Fixes #131714

Cc ``@rust-lang/wg-const-eval``
2025-03-07 10:02:30 +01:00
Matthias Krüger
9e16082e63
Rollup merge of #137904 - scottmcm:ordering-is, r=workingjubilee
Improve the generic MIR in the default `PartialOrd::le` and friends

It looks like I regressed this accidentally in #137197 due to #137901

So this PR does two things:
1. Tweaks the way we're calling `is_some_and` so that it optimizes in the generic MIR (rather than needing to optimize it in every monomorphization) -- the first commit adds a MIR test, so you can see the difference in the second commit.
2. Updates the implementations of `is_le` and friends to be slightly simpler, and parallel how clang does them.
2025-03-07 10:02:26 +01:00
Matthias Krüger
a98df54bdc
Rollup merge of #137832 - wgwoods:fix-bufreader-peek, r=joboet
Fix crash in BufReader::peek()

`bufreader_peek` tracking issue: #128405

This fixes a logic error in `Buffer::read_more()` that would make `BufReader::peek()` expose uninitialized data and/or segfault if `read_more()` was called with a partially-full buffer and a non-empty inner reader.
2025-03-07 10:02:22 +01:00
Matthias Krüger
d9860276b8
Rollup merge of #137777 - thaliaarchi:os_string-push-str, r=joboet
Specialize `OsString::push` and `OsString as From` for UTF-8

When concatenating two WTF-8 strings, surrogate pairs at the boundaries need to be joined. However, since UTF-8 strings cannot contain surrogate halves, this check can be skipped when one string is UTF-8. Specialize `OsString::push` to use a more efficient concatenation in this case.

The WTF-8 version of `OsString` tracks whether it is known to be valid UTF-8 with its `is_known_utf8` field. Specialize `From<AsRef<OsStr>>` so this can be set for UTF-8 string types.

Unfortunately, a specialization for `T: AsRef<str>` conflicts with `T: AsRef<OsStr>`, so stamp out string types with a macro.

r? ``@ChrisDenton``
2025-03-07 10:02:20 +01:00
Matthias Krüger
458095aa17
Rollup merge of #137107 - thaliaarchi:io-optional-methods/cursors, r=joboet
Override default `Write` methods for cursor-like types

Override the default `io::Write` methods for cursor-like types to provide more efficient versions.

Writes to resizable containers already write everything, so implement `write_all` and `write_all_vectored` in terms of those. For fixed-sized containers, cut out unnecessary error checking and looping for those same methods.

| `impl Write for T`              | `vectored` | `all` | `all_vectored` | `fmt`   |
| ------------------------------- | ---------- | ----- | -------------- | ------- |
| `&mut [u8]`                     | Y          | Y     | new            |         |
| `Vec<u8>`                       | Y          | Y     | new            | #137762 |
| `VecDeque<u8>`                  | Y          | Y     | new            | #137762 |
| `std::io::Cursor<&mut [u8]>`    | Y          | new   | new            |         |
| `std::io::Cursor<&mut Vec<u8>>` | Y          | new   | new            | #137762 |
| `std::io::Cursor<Vec<u8>>`      | Y          | new   | new            | #137762 |
| `std::io::Cursor<Box<[u8]>>`    | Y          | new   | new            |         |
| `std::io::Cursor<[u8; N]>`      | Y          | new   | new            |         |
| `core::io::BorrowedCursor<'_>`  | new        | new   | new            |         |

Tracked in https://github.com/rust-lang/rust/issues/136756.

# Open questions

Is it guaranteed by `Write::write_all` that the maximal write is performed when not everything can be written? Its documentation describes the behavior of the default implementation, which writes until a 0-length write is encountered, thus implying that a maximal write is expected. In contrast, `Read::read_exact` declares that the contents of the buffer are unspecified for short reads. If it were allowed, these cursor-like types could bail on the write altogether if it has insufficient capacity.
2025-03-07 10:02:20 +01:00
Matthias Krüger
0b151c6c4f
Rollup merge of #136667 - vita-rust:revert-vita-c-char, r=cuviper
Revert vita's c_char back to i8

# Description

Hi!

https://github.com/rust-lang/rust/pull/132975 changed the definition of `c_char` from i8 to u8 for most ARM targets. While that would usually be correct, [VITASDK uses signed chars by default](https://github.com/vitasdk/buildscripts/blob/master/patches/gcc/0001-gcc-10.patch#L33-L34). The Clang definitions are incorrect because Clang is not (yet?) supported by the vita commmunity / `VITADSK`, On the Rust side, the pre-compiled libraries the user can link to are all compiled using vita's `gcc` and [we set `TARGET_CC` and `TARGET_CXX`](d564a132cb/src/commands/build.rs (L230)) in `cargo vita` for build scripts using `cc`.

I'm creating it as a draft PR so that we can discuss it and possibly get it approved here, but wait to merge the [libc side](https://github.com/rust-lang/libc/pull/4258) and get a libc version first, as having the definitions out of sync breaks std. As a nightly-only target it can be confusing/frustrating for new users when the latest nightly, which is the default, is broken.
2025-03-07 10:02:19 +01:00
Thalia Archibald
5dfa2f5fd0 Use turbofish for size_of<T> and align_of<T> in docs 2025-03-06 20:20:38 -08:00
Thalia Archibald
988eb19970 library: Use size_of from the prelude instead of imported
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.
2025-03-06 20:20:38 -08:00
bors
91a0e1604f Auto merge of #138127 - compiler-errors:rollup-kcarqrz, r=compiler-errors
Rollup of 17 pull requests

Successful merges:

 - #137827 (Add timestamp to unstable feature usage metrics)
 - #138041 (bootstrap and compiletest: Use `size_of_val` from the prelude instead of imported)
 - #138046 (trim channel value in `get_closest_merge_commit`)
 - #138053 (Increase the max. custom try jobs requested to `20`)
 - #138061 (triagebot: add a `compiler_leads` ad-hoc group)
 - #138064 (Remove - from xtensa targets cpu names)
 - #138075 (Use final path segment for diagnostic)
 - #138078 (Reduce the noise of bootstrap changelog warnings in --dry-run mode)
 - #138081 (Move `yield` expressions behind their own feature gate)
 - #138090 (`librustdoc`: flatten nested ifs)
 - #138092 (Re-add `DynSend` and `DynSync` impls for `TyCtxt`)
 - #138094 (a small borrowck cleanup)
 - #138098 (Stabilize feature `const_copy_from_slice`)
 - #138103 (Git ignore citool's target directory)
 - #138105 (Fix broken link to Miri intrinsics in documentation)
 - #138108 (Mention me (WaffleLapkin) when changes to `rustc_codegen_ssa` occur)
 - #138117 ([llvm/PassWrapper] use `size_t` when building arg strings)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-07 02:56:46 +00:00
bors
98a48781fe Auto merge of #138114 - compiler-errors:rollup-7xr4b69, r=compiler-errors
Rollup of 25 pull requests

Successful merges:

 - #135733 (Implement `&pin const self` and `&pin mut self` sugars)
 - #135895 (Document workings of successors more clearly)
 - #136922 (Pattern types: Avoid having to handle an Option for range ends in the type system or the HIR)
 - #137303 (Remove `MaybeForgetReturn` suggestion)
 - #137327 (Undeprecate env::home_dir)
 - #137358 (Match Ergonomics 2024: add context and examples to the unstable book)
 - #137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden))
 - #137565 (Try to point of macro expansion from resolver and method errors if it involves macro var)
 - #137637 (Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck)
 - #137643 (Add DWARF test case for non-C-like `repr128` enums)
 - #137744 (Re-add `Clone`-derive on `Thir`)
 - #137758 (fix usage of ty decl macro fragments in attributes)
 - #137764 (Ensure that negative auto impls are always applicable)
 - #137772 (Fix char count in `Display` for `ByteStr`)
 - #137798 (ci: use ubuntu 24 on arm large runner)
 - #137802 (miri native-call support: all previously exposed provenance is accessible to the callee)
 - #137805 (adjust Layout debug printing to match the internal field name)
 - #137808 (Do not require that unsafe fields lack drop glue)
 - #137820 (Clarify why InhabitedPredicate::instantiate_opt exists)
 - #137825 (Provide more context on resolve error caused from incorrect RTN)
 - #137834 (rustc_fluent_macro: use CARGO_CRATE_NAME instead of CARGO_PKG_NAME)
 - #137868 (Add minimal platform support documentation for powerpc-unknown-linux-gnuspe)
 - #137910 (Improve error message for `AsyncFn` trait failure for RPIT)
 - #137920 (interpret/provenance_map: consistently use range_is_empty)
 - #138038 (Update `compiler-builtins` to 0.1.151)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-06 23:39:38 +00:00
Ralf Jung
8f8c7fcb8b stabilize const_sockaddr_setters 2025-03-06 22:29:07 +01:00
Ralf Jung
98dc15fb0f stabilize const_char_classify 2025-03-06 22:28:48 +01:00
Santiago Pastorino
5a6d00c05d
Add allow(incomplete_features) to alloc 2025-03-06 17:58:35 -03:00
Santiago Pastorino
a68db7e3a8
Add examples in stdlib demonstrating the use syntax 2025-03-06 17:58:34 -03:00
Santiago Pastorino
dcdfd551f0
Add UseCloned trait related code 2025-03-06 17:58:32 -03:00
Michael Goulet
61aaec7965
Rollup merge of #138105 - reddevilmidzy:fix-broken-link, r=saethlin
Fix broken link to Miri intrinsics in documentation

This PR updates an outdated link in the library/core/src/intrinsics/mod.rs file. The previous link, pointing to the Miri repository's src/shims/intrinsics directory, has been replaced with the correct one: https://github.com/rust-lang/miri/tree/master/src/intrinsics. This ensures that users can access the appropriate resources for the relevant intrinsic functions.
2025-03-06 15:40:09 -05:00
Eric Huss
a78d1b092c Update stdarch 2025-03-06 11:11:55 -08:00
Michael Goulet
071bc46880
Rollup merge of #138038 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.151

This enables `f16` builtins for loongarch [1] and adds support for Cygwin [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/770
[2]: https://github.com/rust-lang/compiler-builtins/pull/774

try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
2025-03-06 12:22:29 -05:00
Michael Goulet
1c3733aa69
Rollup merge of #137808 - jswrenn:droppy-unsafe-fields, r=nnethercote
Do not require that unsafe fields lack drop glue

Instead, we adopt the position that introducing an `unsafe` field itself carries a safety invariant: that if you assign an invariant to that field weaker than what the field's destructor requires, you must ensure that field is in a droppable state in your destructor.

See:
- https://github.com/rust-lang/rfcs/pull/3458#discussion_r1971676100
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/unsafe.20fields.20RFC/near/502113897

Tracking Issue: #132922
2025-03-06 12:22:19 -05:00
Michael Goulet
fe926384c1
Rollup merge of #137772 - thaliaarchi:bstr-display, r=joshtriplett
Fix char count in `Display` for `ByteStr`

`ByteStr as Display` performs a byte count when a char count is required.

r? ```````````@joshtriplett```````````
2025-03-06 12:22:16 -05:00
Michael Goulet
00132141c7
Rollup merge of #137764 - compiler-errors:always-applicable-negative-impl, r=lcnr
Ensure that negative auto impls are always applicable

r? lcnr (or reassign if you dont want to review)

https://github.com/rust-lang/rust/issues/68318#issuecomment-2689265030
2025-03-06 12:22:16 -05:00
Michael Goulet
978893ac40
Rollup merge of #137327 - arlosi:home-dir, r=Mark-Simulacrum
Undeprecate env::home_dir

#132515 fixed the implementation of `env::home_dir`, but didn't remove the deprecation.

Based on [this comment](https://github.com/rust-lang/rust/pull/132515#discussion_r1829715262), libs-api decided to undeprecate in the next release. Let's do that!

cc #132650
2025-03-06 12:22:11 -05:00
Michael Goulet
6ac714d526
Rollup merge of #136922 - oli-obk:pattern-types-option-ends, r=BoxyUwU
Pattern types: Avoid having to handle an Option for range ends in the type system or the HIR

Instead,

1. during hir_ty_lowering, we now generate constants for the min/max when the range doesn't have a start/end specified.
2. in a later commit we generate those constants during ast lowering, simplifying everything further by not having to handle the range end inclusivity anymore in the type system (and thus avoiding any issues of `0..5` being different from `0..=4`

I think it makes all the type system code simpler, and the cost of the extra `ConstKind::Value` processing seems negligible.

r? `@BoxyUwU`

cc `@joshtriplett` `@scottmcm`
2025-03-06 12:22:10 -05:00
Michael Goulet
5b074125e5
Rollup merge of #135895 - hkBst:patch-15, r=joboet
Document workings of successors more clearly

This is an attempt to fix #135087 together with https://github.com/rust-lang/rust/pull/135886, but I am not sure if I've succeeded in adding much clarity here, so don't be shy with your comments.
2025-03-06 12:22:09 -05:00
Redddy
6b14125102
Fix broken link to Miri intrinsics in documentation
Replaced the outdated link to https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics with the correct link https://github.com/rust-lang/miri/tree/master/src/intrinsics in the library/core/src/intrinsics/mod.rs file.
2025-03-07 00:55:24 +09:00
okaneco
d4c0c94577 Stabilize const_copy_from_slice feature
Stabilizes `copy_from_slice` method on `[T]`
2025-03-06 07:32:52 -05:00
Oli Scherer
e8f7a382be Remove the Option part of range ends in the HIR 2025-03-06 10:47:40 +00:00
Scott McMurray
eae5ed609d Make is_le and friends work like clang's 2025-03-05 21:58:46 -08:00
许杰友 Jieyou Xu (Joe)
257b4947ed
Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk
Remove unsizing coercions for tuples

See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification.

Tracking issue: #42877
Fixes: #135217
2025-03-05 21:46:44 +08:00
许杰友 Jieyou Xu (Joe)
4aa61e77ff
Rollup merge of #137679 - bjorn3:coretests_improvements, r=jieyouxu,onur-ozkan
Various coretests improvements

The first commit is not yet strictly necessary as directly testing libcore works though useless work, but will be necessary once https://github.com/rust-lang/rust/pull/136642 migrates the liballoc tests into a separate package. The second commit fixes https://github.com/rust-lang/rust/issues/137478 and ensures that coretests actually gets tested on all CI job. The third commit fixes an error that didn't get caught because coretests doesn't run on the wasm32 CI job.
2025-03-05 21:46:42 +08:00
许杰友 Jieyou Xu (Joe)
604d1ba61c
Rollup merge of #137569 - aDotInTheVoid:for-iurii, r=ibraheemdev
Stabilize `string_extend_from_within`

FCP'd here: https://github.com/rust-lang/rust/issues/103806#issuecomment-2674989531.

Closes  #103806.
2025-03-05 21:46:41 +08:00
许杰友 Jieyou Xu (Joe)
24d481cc29
Rollup merge of #137477 - Ayush1325:uefi-service-binding, r=Noratrieb
uefi: Add Service Binding Protocol abstraction

- Some UEFI protocols such as TCP4, TCP6, UDP4, UDP6, etc are managed by service binding protocol.
- A new instance of such protocols is created and destroyed using the corresponding service binding protocol.
- This PR adds abstractions to make using such protocols simpler using Rust Drop trait.
- The reason to add these abstractions in a seperate PR from TCP4 Protocol is to make review easier.

[EFI_SERVICE_BINDING_PROTCOL](https://uefi.org/specs/UEFI/2.11/11_Protocols_UEFI_Driver_Model.html#efi-service-binding-protocol)

cc ````@nicholasbishop````
2025-03-05 21:46:40 +08:00
许杰友 Jieyou Xu (Joe)
fde23c87a5
Rollup merge of #137463 - sunshowers:illumos-posix-spawn, r=Mark-Simulacrum
[illumos] attempt to use posix_spawn to spawn processes

illumos has `posix_spawn`, and the very newest versions also have `_addchdir`, so use that. POSIX standardized this function so I also added a weak symbol lookup for the non `_np` version. (illumos has both.)

This probably also works on Solaris, but I don't have access to an installation to validate this so I decided to focus on illumos instead.

This is a nice ~4x performance improvement for process creation. My go-to as usual is nextest against the clap repo, which acts as a stress test for process creation -- with [this commit]:

```console
$ cargo nextest run -E 'not test(ui_tests) and not test(example_tests)'
before: Summary [   1.747s] 879 tests run: 879 passed, 2 skipped
after:  Summary [   0.445s] 879 tests run: 879 passed, 2 skipped
```

[this commit]: fde45f9aea
2025-03-05 21:46:40 +08:00
许杰友 Jieyou Xu (Joe)
4f1a0479a7
Rollup merge of #137240 - jieyouxu:remove_dir_all, r=Mark-Simulacrum
Slightly reformat `std::fs::remove_dir_all` error docs

To make the error cases easier to spot on a quick glance, as I've been bitten by this a couple of times already 💀

cc #137230.
2025-03-05 21:46:38 +08:00
许杰友 Jieyou Xu (Joe)
6c4ce3ad95
Rollup merge of #136798 - pcorwin:master, r=tgross35
Added documentation for flushing per #74348

Resolves #74348
2025-03-05 21:46:34 +08:00
许杰友 Jieyou Xu (Joe)
1b9b515674
Rollup merge of #136662 - thaliaarchi:formatter-pad-char-count, r=m-ou-se
Count char width at most once in `Formatter::pad`

When both width and precision flags are specified, then `Formatter::pad` counts the character width twice. Instead, record the character width when truncating it to the precision, so it does not need to be recomputed. Simplify control flow so the cases are more clear.

Related:
- 6c9e708f4b (`fmt::Formatter::pad`: don't call chars().count() more than one time, 2021-09-01): Reduce counting chars from thrice to twice in worst case
- ede39aeb33 (feat: reinterpret `precision` field for strings, 2016-06-29): Change meaning of precision for strings
- b820748ff5 (Implement formatting arguments for strings and integers, 2013-08-10): Implement `Formatter::pad`
2025-03-05 21:46:33 +08:00
许杰友 Jieyou Xu (Joe)
9b8accbeb6
Rollup merge of #134063 - tgross35:dec2flt-refactoring, r=Noratrieb
dec2flt: Clean up float parsing modules

This is the first portion of my work adding support for parsing and printing `f16`. Changes in `float.rs` replace the magic constants with expressions and add some use of generics to better support the new float types. Everything else is related to documentation or naming; there are no functional changes in this PR.

This can be reviewed by commit.
2025-03-05 21:46:31 +08:00
bors
4559163ccb Auto merge of #138031 - workingjubilee:rollup-5bsotpz, r=workingjubilee
Rollup of 15 pull requests

Successful merges:

 - #137829 (Stabilize [T]::split_off... methods)
 - #137850 (Stabilize `box_uninit_write`)
 - #137912 (Do not recover missing lifetime with random in-scope lifetime)
 - #137913 (Allow struct field default values to reference struct's generics)
 - #137923 (Simplify `<Postorder as Iterator>::size_hint`)
 - #137949 (Update MSVC INSTALL.md instructions to recommend VS 2022 + recent Windows 10/11 SDK)
 - #137963 (Add ``dyn`` keyword to `E0373` examples)
 - #137975 (Remove unused `PpMode::needs_hir`)
 - #137981 (rustdoc search: increase strictness of typechecking)
 - #137986 (Fix some typos)
 - #137991 (Add `avr-none` to SUMMARY.md and platform-support.md)
 - #137993 (Remove obsolete comment from DeduceReadOnly)
 - #137996 (Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl Sync"")
 - #138019 (Pretty-print `#[deprecated]` attribute in HIR.)
 - #138026 (Make CrateItem::body() function return an option)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-05 06:59:11 +00:00
Trevor Gross
7923031e7e Update compiler-builtins to 0.1.151
This enables `f16` builtins for loongarch [1] and adds support for
Cygwin [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/770
[2]: https://github.com/rust-lang/compiler-builtins/pull/774
2025-03-05 01:35:02 -05:00
Jubilee
131867b68b
Rollup merge of #137986 - fuyangpengqi:master, r=Amanieu
Fix some typos

Fix some typos
2025-03-04 19:37:04 -08:00
Jubilee
0bb2f95c26
Rollup merge of #137850 - slanterns:box_uninit_write, r=ibraheemdev
Stabilize `box_uninit_write`

Closes: https://github.com/rust-lang/rust/issues/129397.
2025-03-04 19:37:00 -08:00
Jubilee
29d3ad9eba
Rollup merge of #137829 - cramertj:stabilize-split-off, r=jhpratt
Stabilize [T]::split_off... methods

This was previously known as the slice_take feature.

Closes #62280
2025-03-04 19:36:59 -08:00
Jubilee
dd594f642e
Rollup merge of #137634 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.149

Includes a change to make a subset of math symbols available on all platforms [1], and disables `f16` on aarch64 without neon [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/763
[2]: https://github.com/rust-lang/compiler-builtins/pull/775

try-job: aarch64-gnu
try-job: aarch64-gnu-debug
try-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: dist-aarch64-linux
try-job: dist-arm-linux
try-job: dist-armv7-linux
try-job: dist-x86_64-linux
try-job: test-various
2025-03-04 14:50:40 -08:00
Michael Goulet
3d62b279dd Ensure that negative auto impls are always applicable 2025-03-04 17:45:18 +00:00
pcorwin
c392cf7690 Added documentation for flushing 2025-03-04 12:21:12 -05:00
Henry Jiang
2a7ad952a7 Fix test hangs on AIX 2025-03-04 10:06:28 -05:00
Ralf Jung
1a5a453743 atomic: clarify that failing conditional RMW operations are not 'writes' 2025-03-04 15:14:59 +01:00
fuyangpengqi
4febd273e5 Fix some typos
Signed-off-by: fuyangpengqi <995764973@qq.com>
2025-03-04 16:05:32 +08:00
bors
fd17deacce Auto merge of #137959 - matthiaskrgr:rollup-62vjvwr, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - #135767 (Future incompatibility warning `unsupported_fn_ptr_calling_conventions`: Also warn in dependencies)
 - #137852 (Remove layouting dead code for non-array SIMD types.)
 - #137863 (Fix pretty printing of unsafe binders)
 - #137882 (do not build additional stage on compiler paths)
 - #137894 (Revert "store ScalarPair via memset when one side is undef and the other side can be memset")
 - #137902 (Make `ast::TokenKind` more like `lexer::TokenKind`)
 - #137921 (Subtree update of `rust-analyzer`)
 - #137922 (A few cleanups after the removal of `cfg(not(parallel))`)
 - #137939 (fix order on shl impl)
 - #137946 (Fix docker run-local docs)
 - #137955 (Always allow rustdoc-json tests to contain long lines)
 - #137958 (triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-04 02:27:56 +00:00
Matthias Krüger
b0bf3d561f
Rollup merge of #137054 - jhpratt:phantom-variance, r=Mark-Simulacrum
Make phantom variance markers transparent
2025-03-03 10:40:59 +01:00
Speedy_Lex
7c62a4766f fix order on shl impl
this doesn't fix any bugs, it just looks more consistent with the other impl's
2025-03-03 09:51:51 +01:00
Matthias Krüger
8152da82b5
Rollup merge of #137873 - tgross35:disable-f16-without-neon, r=workingjubilee
Disable `f16` on Aarch64 without `neon`

LLVM has crashes at some `half` operations when built with assertions enabled if fp-armv8 is not available [1]. Things seem to usually work, but we are reaching LLVM undefined behavior so this needs to be disabled.

[1]: https://github.com/llvm/llvm-project/issues/129394
2025-03-02 22:44:26 +01:00
Matthias Krüger
c994a29392
Rollup merge of #137871 - pitaj:rangebounds-is_empty-intersect, r=scottmcm
fix `RangeBounds::is_empty` documentation

One-sided ranges are never empty

follow-up for https://github.com/rust-lang/rust/pull/137304#pullrequestreview-2646899461
2025-03-02 22:44:26 +01:00
Matthias Krüger
e8134a3380
Rollup merge of #137641 - kpreid:dealloc, r=Amanieu
More precisely document `Global::deallocate()`'s safety.

There is a subtlety which "other conditions must be upheld by the caller" does not capture: `GlobalAlloc`/`alloc::dealloc()` require that the provided layout will be *equal*, not just that it "fits", the layout used to allocate. This is always true here due to how `allocate()`, `grow()`, and `shrink()` are implemented (they never return a larger allocation than requested), but that is a non-local property of the implementation, so it should be documented explicitly.

r? libs

`@rustbot` label A-allocators
2025-03-02 22:44:24 +01:00
Matthias Krüger
f47c7e8564
Rollup merge of #137375 - steffahn:clarify-read_line-comment, r=Mark-Simulacrum
Minor internal comments fix for `BufRead::read_line`

Just a little fix that came up while I was reading through this source code, and had to search for a few minutes to find out what was actually *meant* here.
2025-03-02 22:44:23 +01:00
Marijn Schouten
6867806f67 Document workings of successors more clearly
This is an attempt to fix #135087 together with https://github.com/rust-lang/rust/pull/135886, but I am not sure if I've succeeded in adding much clarity here, so don't be shy with your comments.
2025-03-02 17:41:42 +01:00
Trevor Gross
37e223ccaa dec2flt: Refactor the fast path
This is just a bit of code cleanup to make use of returning early.
2025-03-02 09:35:42 +00:00
Trevor Gross
19a909ae0e dec2flt: Refactor float traits
A lot of the magic constants can be turned into expressions. This
reduces some code duplication.

Additionally, add traits to make these operations fully generic. This
will make it easier to support `f16` and `f128`.
2025-03-02 09:35:42 +00:00
Trevor Gross
6c34daff57 dec2flt: Rename fields to be consistent with documented notation 2025-03-02 07:08:01 +00:00
Trevor Gross
626d2c5eed dec2flt: Rename Number to Decimal
The previous commit renamed `Decimal` to `DecimalSeq`. Now, rename the
type that represents a decimal floating point number to be `Decimal`.

Additionally, add some tests for internal behavior.
2025-03-02 07:08:01 +00:00
Trevor Gross
49a2d4c757 dec2flt: Rename Decimal to DecimalSeq
This module currently contains two decimal types, `Decimal` and
`Number`. These names don't provide a whole lot of insight into what
exactly they are, and `Number` is actually the one that is more like an
expected `Decimal` type.

In accordance with this, rename the existing `Decimal` to `DecimalSeq`.
This highlights that it contains a sequence of decimal digits, rather
than representing a base-10 floating point (decimal) number.

Additionally, add some tests to validate internal behavior.
2025-03-02 07:08:00 +00:00
Trevor Gross
5a2da96a44 dec2flt: Update documentation of existing methods
Fix or elaborate existing float parsing documentation. This includes
introducing a convention that should make naming more consistent.
2025-03-02 07:08:00 +00:00
Trevor Gross
a0ed304c21 float: Update some constants to pub(crate)
These constants can be useful outside of their current module. Make them
`pub(crate)` to allow for this.
2025-03-02 07:08:00 +00:00
Trevor Gross
c51b229140 Disable f16 on Aarch64 without neon
LLVM has crashes at some `half` operations when built with assertions
enabled if fp-armv8 is not available [1]. Things seem to usually work,
but we are reaching LLVM undefined behavior so this needs to be
disabled.

[1]: https://github.com/llvm/llvm-project/issues/129394
2025-03-01 23:10:21 +00:00
Karol Zwolak
4e703f5825 docs(std): mention LazyLock in const/static HashMap construction 2025-03-01 23:06:33 +01:00
Peter Jaszkowiak
596c14ade4 fix RangeBounds::is_empty documentation
One-sided ranges are never empty
2025-03-01 14:38:07 -07:00
Trevor Gross
8b4007a91d Update compiler-builtins to 0.1.150
Includes a change to make a subset of math symbols available on all
platforms [1], and disables `f16` on aarch64 without neon [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/763
[2]: https://github.com/rust-lang/compiler-builtins/pull/775
2025-03-01 20:02:51 +00:00
Ayush Singh
86aae8e2d6
uefi: Add Service Binding Protocol abstraction
- Some UEFI protocols such as TCP4, TCP6, UDP4, UDP6, etc are managed by
  service binding protocol.
- A new instance of such protocols is created and destroyed using the
  corresponding service binding protocol.
- This PR adds abstractions to make using such protocols simpler using
  Rust Drop trait.
- The reason to add these abstractions in a seperate PR from TCP4
  Protocol is to make review easier.

[EFI_SERVICE_BINDING_PROTCOL](https://uefi.org/specs/UEFI/2.11/11_Protocols_UEFI_Driver_Model.html#efi-service-binding-protocol)

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-03-02 01:02:42 +05:30
Matthias Krüger
c112b70f12
Rollup merge of #137828 - folkertdev:simd-intrinsic-doc-fixes, r=workingjubilee
Fix inaccurate `std::intrinsics::simd` documentation

This addresses two issues:

- the docs on comparison operators (`simd_gt` etc.) said they only work for floating-point vectors, but they work for integer vectors too.
- the docs on various functions that use a mask did not document that the mask must be a signed integer vector. Unsigned integer vectors would cause invalid behavior when the mask vector is widened (unsigned integers would use zero extension, producing incorrect results).

r? ``@workingjubilee``
2025-03-01 16:03:19 +01:00
Matthias Krüger
bc89ab19c3
Rollup merge of #137809 - Noratrieb:io-error-casing, r=thomcc
Use correct error message casing for `io::const_error`s

Error messages are supposed to start with lowercase letters, but a lot of `io::const_error` messages did not. This fixes them to start with a lowercase letter.
I did consider adding a const check for this to the macro, but some of them start with proper nouns that make sense to uppercase them.

See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-03-01 16:03:13 +01:00
Slanterns
3786a7a908
stabilize box_uninit_write 2025-03-01 20:11:39 +08:00
Matthias Krüger
c1b4454275
Rollup merge of #137730 - RalfJung:checked_ilog_tests, r=tgross35
checked_ilog tests: deal with a bit of float imprecision

Fixes https://github.com/rust-lang/rust/issues/137591

r? `@tgross35`
2025-03-01 05:49:54 +01:00
Will Woods
6d07144613 Fix logic error in Buffer::read_more()
Buffer::read_more() is supposed to refill the buffer without discarding
its contents, which are in the range `pos .. filled`.

It mistakenly borrows the range `pos ..`, fills that, and then
increments `filled` by the amount read. This overwrites the buffer's
existing contents and sets `filled` to a too-large value that either
exposes uninitialized bytes or walks off the end of the buffer entirely.

This patch makes it correctly fill only the unfilled portion of the
buffer, which should maintain all the type invariants and fix the test
failure introduced in commit b1196717fc.
2025-02-28 17:36:19 -08:00
Will Woods
b1196717fc Tweak BufReader::peek() doctest to expose bug in Buffer::read_more()
This patch makes BufReader::peek()'s doctest call read_more() to refill
the buffer before the inner reader hits EOF. This exposes a bug in
read_more() that causes an out-of-bounds slice access and segfault.
2025-02-28 17:30:53 -08:00
Folkert de Vries
854e9f4803
intrinsics::simd: document that masks must be signed integer vectors
this is because they may be widened, and that only works when sign extension is used: zero extension would produce invalid results
2025-03-01 00:28:47 +01:00
Folkert de Vries
45492662c7
correct the docs on simd_ comparison operators
these all also accept integer vectors as arguments
2025-03-01 00:18:54 +01:00
Taylor Cramer
a8bff87cfb Stabilize [T]::split_off... methods
This was previously known as the slice_take feature.
2025-02-28 14:04:54 -08:00
Thalia Archibald
83407b828b Specialize constructing OsString from strings
The WTF-8 version of `OsString` tracks whether it is known to be valid
UTF-8 with its `is_known_utf8` field. Specialize `From<AsRef<OsStr>>` so
this can be set for UTF-8 string types.
2025-02-28 13:50:31 -08:00
Thalia Archibald
a8d78fec52 Specialize OsString::push for strings
When concatenating two WTF-8 strings, surrogate pairs at the boundaries
need to be joined. However, since UTF-8 strings cannot contain surrogate
halves, this check can be skipped when one string is UTF-8. Specialize
`OsString::push` to use a more efficient concatenation in this case.

Unfortunately, a specialization for `T: AsRef<str>` conflicts with
`T: AsRef<OsStr>`, so stamp out string types with a macro.
2025-02-28 13:42:31 -08:00
Noratrieb
cdef38812d Use correct error message casing for io::const_errors
Error messages are supposed to start with lowercase letters, but a lot
of `io::const_error` messages did not. This fixes them to start with a
lowercase letter.
I did consider adding a const check for this to the macro, but some of
them start with proper nouns that make sense to uppercase them.

See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-02-28 17:50:38 +01:00
Jack Wrenn
91034adf30 Do not require that unsafe fields lack drop glue
Instead, we adopt the position that introducing an `unsafe` field
itself carries a safety invariant: that if you assign an invariant
to that field weaker than what the field's destructor requires,
you must ensure that field is in a droppable state in your
destructor.

See:
- https://github.com/rust-lang/rfcs/pull/3458#discussion_r1971676100
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/unsafe.20fields.20RFC/near/502113897
2025-02-28 16:32:06 +00:00
许杰友 Jieyou Xu (Joe)
4606610b21
Rollup merge of #137673 - ChrisDenton:search-path-bug, r=dtolnay
Fix Windows `Command` search path bug

Currently `Command::new` on Windows works differently depending on whether any environment variable is set. For example,

```rust
// Searches for "myapp" in the application and system paths first (aka Windows native behaviour).
Command::new("myapp").spawn();

// Search for "myapp" in `PATH` first
Command::new("myapp").env("a", "b").spawn();
```

This is a bug because the search path should only change if `PATH` is changed for the child (i.e. `.env("PATH", "...")`).

This was discussed in a libs-api meeting where the exact semantics of `Command::new` was not decided but there seemed to be broad agreement that this particular thing is just a bug that can be fixed.

r? libs-api
2025-02-28 22:29:53 +08:00
许杰友 Jieyou Xu (Joe)
50ef985be2
Rollup merge of #137551 - folkertdev:import-simd-intrinsics, r=RalfJung
import `simd_` intrinsics

In most cases, we can import the simd intrinsics rather than redeclare them. Apparently, most of these tests were written before `std::intrinsics::simd` existed.

There are a couple of exceptions where we can't yet import:

- the intrinsics are not declared as `const fn` in the standard library, causing issues in the `const-eval` tests
- the `simd_shuffle_generic` function is not exposed from `std::intrinsics`
- the `simd_fpow` and `simd_fpowi` functions are not exposed from `std::intrinsics` (removed in https://github.com/rust-lang/rust/pull/137595)
- some tests use `no_core`, and therefore cannot use `std::intrinsics`

r? ```@RalfJung```

cc ```@workingjubilee``` do you have context on why some intrinsics are not exposed?
2025-02-28 22:29:51 +08:00
许杰友 Jieyou Xu (Joe)
87cac9fdb5
Rollup merge of #137197 - scottmcm:cmp-20, r=ibraheemdev
Update some comparison codegen tests now that they pass in LLVM20

Fixes #106107

Needed one tweak to the default `PartialOrd::le` to get the test to pass.  Everything but the derived 2-field `le` test passes even without the change to the defaults in the trait.
2025-02-28 22:29:50 +08:00
Thalia Archibald
b2bb7cc8ae Fix char count in Display for ByteStr 2025-02-27 19:06:06 -08:00
Thalia Archibald
41bdd2b74a Override default Write methods for cursor-like types 2025-02-27 17:09:09 -08:00
Thalia Archibald
67cc82a704 Inline VecDeque<u8> and BorrowedCursor methods
All other methods in this file have #[inline] and these methods are very
similar to those of &[u8] which are already inlined here.
2025-02-27 17:07:20 -08:00
Thalia Archibald
0ca1c9c1dd Count char width at most once in Formatter::pad
When both width and precision flags are specified, then the character
width is counted twice. Instead, record the character width when
truncating it to the precision, so it does not need to be recomputed.
Simplify control flow so the cases are more clear.
2025-02-27 16:41:42 -08:00
Ralf Jung
31388f5280 checked_ilog tests: deal with a bit of float imprecision 2025-02-27 15:38:22 +01:00
Folkert de Vries
4e961dc015
make simd_insert and simd_extract const fns 2025-02-27 12:23:00 +01:00
Alice Ryhl
44cccae02a Delete tuple unsizing 2025-02-27 10:26:33 +00:00
Matthias Krüger
f19d4b5f97
Rollup merge of #137480 - fuzzypixelz:fix/124466, r=workingjubilee
Return unexpected termination error instead of panicing in `Thread::join`

There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes #124466.
2025-02-27 08:56:39 +01:00
Matthias Krüger
3499846073
Rollup merge of #137304 - pitaj:rangebounds-is_empty-intersect, r=ibraheemdev
add `IntoBounds::intersect` and `RangeBounds::is_empty`

- ACP: https://github.com/rust-lang/libs-team/issues/539
- Tracking issue for `is_empty`: #137300
- Tracking issue for `IntoBounds`: #136903
2025-02-27 08:56:38 +01:00
Deadbeef
ef66cbb27b require trait impls to have matching const stabilities as the traits 2025-02-27 04:56:27 +00:00
León Orell Valerian Liehr
c5d57274c0
Rollup merge of #137620 - SergioGasquez:fix/espidf-maybeunit, r=ChrisDenton
Fix `attr` cast for espidf

https://github.com/rust-lang/rust/pull/136826 broke ESP-IDF builds with: https://github.com/esp-rs/esp-idf-template/actions/runs/13516221587/job/37765336588.

This PR fixes it.

cc: ``@ivmarkov`` ``@xizheyin``
2025-02-26 19:03:55 +01:00
León Orell Valerian Liehr
f3a445bf75
Rollup merge of #136187 - hkBst:patch-27, r=workingjubilee
Use less CString in the examples of CStr.

Fixes #83999
2025-02-26 19:03:54 +01:00
León Orell Valerian Liehr
bcfff3d40a
Rollup merge of #134585 - cyrgani:uninit_array, r=Amanieu
remove `MaybeUninit::uninit_array`

Closes #134584.
Closes #66845.
The future of this unstable method was described in https://github.com/rust-lang/rust/pull/125082#issuecomment-2161242816. Since `inline_const` was stabilized in 1.79 (4 stable releases away) and no one expressed interest for keeping it in https://github.com/rust-lang/rust/issues/96097, I think it can be removed now as it is not a stable method.
2025-02-26 19:03:53 +01:00
bjorn3
169e731f53 Fix unused import in coretests on wasm32 2025-02-26 15:11:05 +00:00
Chris Denton
4fcebee60a
Fix Windows Command search path bug 2025-02-26 13:56:47 +00:00
WANG Rui
30703af6f3 Enable f16 for LoongArch 2025-02-26 21:40:14 +08:00
León Orell Valerian Liehr
0d4af0861e
Rollup merge of #137614 - xizheyin:issue-134874, r=cuviper
fix doc in library/core/src/pin.rs

Fixes #134874
2025-02-26 04:15:08 +01:00
León Orell Valerian Liehr
49249eae11
Rollup merge of #137311 - martn3:enable-f16-mips, r=tgross35
Enable `f16` for MIPS

Blocked on https://github.com/rust-lang/compiler-builtins/pull/762

It seems as if `f16` works on MIPS now according to my testing on Rust master with LLVM 20, and I was asked [here](https://github.com/rust-lang/rust/pull/137167#issuecomment-2669387820) to create PRs with my changes.

I only tested on the flavour of `mipsel-unknown-linux-gnu` hardware that happens to be available to me, so I can't say anything about other MIPS hardware, but from a casual skimming of the LLVM code ([1], [2]) it seems like `f16` should work on all MIPS hardware. So enable it for all MIPS hardware.

[1]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/Target/Mips/MipsISelLowering.h#L370
[2]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/CodeGen/TargetLoweringBase.cpp#L1367-L1388

`@rustbot` label +O-MIPS +F-f16_and_f128 +S-blocked

Tracking issue for f16: https://github.com/rust-lang/rust/issues/116909

r? `@tgross35`
2025-02-26 04:15:03 +01:00
León Orell Valerian Liehr
e121dcffbe
Rollup merge of #137154 - thaliaarchi:wtf8-fast-paths, r=ChrisDenton
Add UTF-8 validation fast paths in `Wtf8Buf`

This adds two more fast paths for UTF-8 validation in `Wtf8Buf`, making use of the `is_known_utf8` flag added in https://github.com/rust-lang/rust/pull/96869 (Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8).

r? `@ChrisDenton`
2025-02-26 04:15:02 +01:00
bors
cb06d12710 Auto merge of #137594 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`

try-job: x86_64-gnu-aux
2025-02-25 22:59:40 +00:00
Kevin Reid
33ee398fda More precisely document Global::deallocate()'s safety.
There is a subtlety which "other conditions must be upheld by the caller"
does not capture: `GlobalAlloc`/`alloc::dealloc()` require that the
provided layout will be *equal*, not just that it "fits", the layout
used to allocate. This is always true here due to how `allocate()`,
`grow()`, and `shrink()` are implemented (they never return a larger
allocation than requested), but that is a non-local property of the
implementation, so it should be documented explicitly.
2025-02-25 13:07:52 -08:00
bors
85abb27636 Auto merge of #137608 - fmease:rollup-h4siso6, r=fmease
Rollup of 8 pull requests

Successful merges:

 - #137370 (adjust_abi: make fallback logic for ABIs a bit easier to read)
 - #137444 (Improve behavior of `IF_LET_RESCOPE` around temporaries and place expressions)
 - #137464 (Fix invalid suggestion from type error for derive macro)
 - #137539 ( Add rustdoc-gui regression test for #137082 )
 - #137576 (Don't doc-comment BTreeMap<K, SetValZST, A>)
 - #137595 (remove `simd_fpow` and `simd_fpowi`)
 - #137600 (type_ir: remove redundant part of comment)
 - #137602 (feature: fix typo in attribute description)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-25 19:36:17 +00:00
Sergio Gasquez
622b4fac82 fix: attr cast for espidf 2025-02-25 16:07:05 +01:00
xizheyin
48483adcb4
fix doc in library/core/src/pin.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-25 21:21:00 +08:00
León Orell Valerian Liehr
86fa9f895c
Rollup merge of #137515 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.148

Includes `f16` symbols on MIPS [1], updates for `libm` [2], and reapplies the patch that drops the `public_test_deps!` macro [3].

[1]: https://github.com/rust-lang/compiler-builtins/pull/762
[2]: https://github.com/rust-lang/compiler-builtins/pull/765
[3]: https://github.com/rust-lang/compiler-builtins/pull/766

try-job: aarch64-gnu
try-job: i686-mingw-1
try-job: i686-mingw-2
try-job: test-various
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: x86_64-rust-for-linux
2025-02-25 13:32:55 +01:00
Mahmoud Mazouz
7058f62d0a
Use .expect(..) instead 2025-02-25 13:11:03 +01:00
León Orell Valerian Liehr
c8741c60cd
Rollup merge of #137576 - goffrie:setvalzst, r=lcnr
Don't doc-comment BTreeMap<K, SetValZST, A>

This otherwise shows up in documentation as an empty impl block (worse, at the *top* of the docs above the public impls).
2025-02-25 13:07:38 +01:00
Ralf Jung
5e4c582b3e disable a potentially bogus test on Miri 2025-02-25 09:35:28 +01:00
bors
ad27045c31 Auto merge of #137571 - tgross35:rollup-i1tcnv1, r=tgross35
Rollup of 8 pull requests

Successful merges:

 - #134655 (Stabilize `hash_extract_if`)
 - #135933 (Explain how Vec::with_capacity is faithful)
 - #136668 (Stabilize `core::str::from_utf8_mut` as `const`)
 - #136775 (Update `String::from_raw_parts` safety requirements)
 - #137109 (stabilize extract_if)
 - #137349 (Implement `read_buf` for zkVM stdin)
 - #137493 (configure.py: don't instruct user to run nonexistent program)
 - #137516 (remove some unnecessary rustc_const_unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-25 05:41:34 +00:00
xizheyin
3835dc2a04
fix doc in library/core/src/sync/atomic.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-25 13:01:19 +08:00
Geoffry Song
7a60c49c64
Don't doc-comment BTreeMap<K, SetValZST, A> 2025-02-24 18:24:22 -08:00
Michael Goulet
74e5366020
Rollup merge of #137543 - petrochenkov:wintest, r=ChrisDenton
std: Fix another new symlink test on Windows

Checking for `got_symlink_permission` first is a standard procedure for such tests.
2025-02-24 19:21:48 -05:00
Michael Goulet
8f729e9cff
Rollup merge of #137489 - RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk
remove `#[rustc_intrinsic_must_be_overridde]`

In https://github.com/rust-lang/rust/pull/135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it.

r? `@oli-obk`

There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
2025-02-24 19:21:47 -05:00
Michael Goulet
1cd083d73f
Rollup merge of #137321 - aviraxp:patch-1, r=cuviper
Correct doc about `temp_dir()` behavior on Android

Since commit d5ccb038f6, `TMPDIR` will be set to application's cache dir when app starts.
2025-02-24 19:21:46 -05:00
Trevor Gross
91dc3eed50
Rollup merge of #137516 - RalfJung:rustc_const_unstable-cleanup, r=Amanieu
remove some unnecessary rustc_const_unstable

If the function is anyway unstable, it doesn't need to be `rustc_const_unstable`.

`copy_from_slice` turns out to not do anything const-unstable itself, we just haven't stably committed to it being available in const yet. See [here](https://rustc-dev-guide.rust-lang.org/stability.html?highlight=rustc_const_stable_indirect) for more details on the `rustc_const_stable_indirect` attribute.
2025-02-24 18:46:37 -05:00
Trevor Gross
50940109cc
Rollup merge of #137349 - thaliaarchi:io-optional-methods/zkvm, r=Noratrieb
Implement `read_buf` for zkVM stdin

For the zkVM, even when a guest buffer is uninitialized, from the host's perspective it is just a normal piece of memory which was initialized before letting the guest write into it. This makes `sys_read` safe to use with an uninitialized buffer. See https://github.com/risc0/risc0/issues/2853.

cc `@bobbobbio,` `@flaub`

r? `@Noratrieb`

Tracked in https://github.com/rust-lang/rust/issues/136756
2025-02-24 18:46:36 -05:00
Trevor Gross
57ce16ca27
Rollup merge of #137109 - bend-n:knife, r=oli-obk
stabilize extract_if

Tracking issue: #43244
Closes: #43244
FCP completed: https://github.com/rust-lang/rust/issues/43244#issuecomment-2523595704
2025-02-24 18:46:35 -05:00
Trevor Gross
03326daf23
Rollup merge of #136775 - robertbastian:patch-2, r=Amanieu
Update `String::from_raw_parts` safety requirements

These have become out of sync with `Vec::from_raw_part`'s safety requirements, and are likely to diverge again. I think it's safest to just point at `Vec`'s requirements.

https://github.com/rust-lang/rust/issues/119206#issuecomment-2180116680
2025-02-24 18:46:35 -05:00
Trevor Gross
fe2876fcba
Rollup merge of #136668 - WaffleLapkin:from_utf8_mut, r=Amanieu
Stabilize `core::str::from_utf8_mut` as `const`

cc #91006 (tracking issue)

r? libs-api
2025-02-24 18:46:34 -05:00
Trevor Gross
dc2b86feb8
Rollup merge of #135933 - hkBst:patch-19, r=workingjubilee
Explain how Vec::with_capacity is faithful

This is a revival of https://github.com/rust-lang/rust/pull/99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes https://github.com/rust-lang/rust/issues/99385.
2025-02-24 18:46:34 -05:00
Trevor Gross
23e113200d
Rollup merge of #134655 - GrigorenkoPV:hash_extract_if, r=cuviper
Stabilize `hash_extract_if`

FCP complete: https://github.com/rust-lang/rust/issues/59618#issuecomment-2674880530

Tracking issue: #59618
Closes #59618
2025-02-24 18:46:33 -05:00
Alona Enraght-Moony
78615ff2ae Stablize string_extend_from_within 2025-02-24 23:34:46 +00:00
Michael Goulet
5c5ed92c37 Simplify trait error message for CoercePointee validation 2025-02-24 19:34:54 +00:00
David Wood
d6bb98e757
span: add a "future" edition
It's hard to implement edition migrations without having a perma-unstable
"future" edition to target.
2025-02-24 14:35:30 +00:00
Vadim Petrochenkov
9c65672397 std: Fix another new symlink test on Windows 2025-02-24 17:12:37 +03:00
Robert Bastian
562880cfd9
Update string.rs
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2025-02-24 10:02:55 +01:00
Mahmoud Mazouz
1ccdc06136
Remove speculation on cause of error
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-02-24 09:50:46 +01:00
Ralf Jung
68543abb45 remove some unnecessary rustc_const_unstable 2025-02-24 08:54:53 +01:00
Trevor Gross
fb5f804f52 Update compiler-builtins to 0.1.148
Includes `f16` symbols on MIPS [1], updates for `libm` [2], and
reapplies the patch that drops the `public_test_deps!` macro [3].

[1]: https://github.com/rust-lang/compiler-builtins/pull/762
[2]: https://github.com/rust-lang/compiler-builtins/pull/765
[3]: https://github.com/rust-lang/compiler-builtins/pull/766
2025-02-24 07:46:55 +00:00
Jacob Pratt
3a1549ca8e
Rollup merge of #137495 - madhav-madhusoodanan:feature-unstable-control-flow-into-value, r=jhpratt
Added into_value function to ControlFlow<T, T>
2025-02-24 02:11:36 -05:00
Jacob Pratt
8a8c0e25c9
Rollup merge of #137484 - chenyukang:yukang-fix-sort-doc, r=Noratrieb
Fix documentation for unstable sort on slice

Fixes #136665
2025-02-24 02:11:35 -05:00
Jacob Pratt
56fca2638f
Rollup merge of #137482 - rust9x:win-file-open-truncate, r=ChrisDenton
Windows: use existing wrappers in `File::open_native`

Just a small improvement I've noticed - prevents accidents regarding `SetFileInformationByHandle` parameters.

Probably ``@ChrisDenton`` since we talked about it on discord :)
2025-02-24 02:11:34 -05:00
Jacob Pratt
31640178bd
Rollup merge of #137393 - chorman0773:unbounded-shifts-stabilize, r=Amanieu
Stabilize `unbounded_shifts`

This stabilizes and const-stabilizes `<iN>::unbounded_shl` and `<uN>::unbounded_shr` from https://github.com/rust-lang/rust/issues/129375.
2025-02-24 02:11:34 -05:00
Jacob Pratt
b7f11ef362
Rollup merge of #137061 - progressive-galib:gen_future-closing#76249, r=ibraheemdev
Unstable `gen_future` Feature Tracking

This PR removes the reference to the closed tracking issue **#50547** for the `gen_future` feature. Since `gen_future` is an internal feature used in async block desugaring, it does not require a public tracking issue.

#### Changes:
- Replaced `issue = "50547"` with `issue = "none"` in **library/core/src/future/mod.rs**.
- Ensures that it is correctly identified as an internal feature.

#### Rationale:
With this change, the Unstable Book will now state:
> *"This feature has no tracking issue and is therefore likely internal to the compiler, not being intended for general use."*

Closes **#76249**. 🚀🦀
2025-02-24 02:11:33 -05:00
Ralf Jung
5a58a922e2 remove uses of rustc_intrinsic_must_be_overridden from standard library 2025-02-24 07:53:57 +01:00
Madhav Madhusoodanan
f49b6c6cd5 Added into_value const function to ControlFlow<T, T>
Fixed issue with usage of generics and moved feature gate to crate root

Removed const tag

Fixed alphabetical ordering of feature gate, added same to doctest

Removed crate-level declaration of feature gate control_flow_into_value

Used const_precise_live_drops to constify into_value without issue of a drop
2025-02-24 07:36:27 +05:30
Trevor Gross
18ffee2126
Rollup merge of #137483 - bend-n:😅, r=Noratrieb
rename sub_ptr to offset_from_unsigned

i also made `byte_sub_ptr` `byte_offset_from_unsigned`

fixes #137121
tracking issue #95892
2025-02-23 14:30:28 -05:00
Trevor Gross
fb54acd700
Rollup merge of #137297 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.147

Removes an ABI hack that used `<2 x i64>` to return `i128` in `xmm0` on Windows [1].

[1]: https://github.com/rust-lang/compiler-builtins/pull/759
Link: https://github.com/rust-lang/rust/issues/116558
Link: https://github.com/rust-lang/compiler-builtins/issues/758

try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
2025-02-23 14:30:27 -05:00
Trevor Gross
a2bb4d748d
Rollup merge of #136543 - RalfJung:round-ties-even, r=tgross35
intrinsics: unify rint, roundeven, nearbyint in a single round_ties_even intrinsic

LLVM has three intrinsics here that all do the same thing (when used in the default FP environment). There's no reason Rust needs to copy that historically-grown mess -- let's just have one intrinsic and leave it up to the LLVM backend to decide how to lower that.

Suggested by `@hanna-kruppe` in https://github.com/rust-lang/rust/issues/136459; Cc `@tgross35`

try-job: test-various
2025-02-23 14:30:25 -05:00
bendn
c813d8f3e4
rename sub_ptr 😅 2025-02-23 23:11:00 +07:00
yukang
1a440d56d6 Fix documentation for unstable sort 2025-02-23 22:29:53 +08:00