Commit Graph

16949 Commits

Author SHA1 Message Date
Matthias Krüger
94cc01af15
Rollup merge of #132136 - RalfJung:target-feature-abi-compat, r=Mark-Simulacrum
ABI compatibility: remove section on target features

Once https://github.com/rust-lang/rust/pull/127731 lands, we will properly diagnose ABI issues caused by target feature mismatch (at least on tier 1 targets). So I'd say we can remove the corresponding part of the docs here -- this is now something the compiler can take care of, so programmers don't need to be concerned. For now this is just a lint, but that's just a transition period, like in prior cases where we fix I-unsound bugs by adding a new check that goes through the "future incompatibility" stages. We have decided that it's actually a bug that we have ABI risks around target features, and we shouldn't document that bug as-if it was intended behavior.

Cc `@rust-lang/opsem` `@chorman0773` `@veluca93`
2024-11-10 10:09:52 +01:00
Jubilee
dc647392d6
Rollup merge of #132778 - lolbinarycat:io-Error-into_inner-docs, r=cuviper
update io::Error::into_inner to acknowledge io::Error::other
2024-11-08 20:46:13 -08:00
binarycat
b004cac72e update io::Error::into_inner to acknowlage io::Error::other 2024-11-08 10:43:34 -06:00
bors
209799f3b9 Auto merge of #132717 - RalfJung:rustc_safe_intrinsic, r=compiler-errors
remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead

This brings us one step closer towards removing support for `extern "rust-intrinsic"` blocks, in favor of `#[rustc_intrinsic]` functions.

Also move `#[rustc_intrinsic]` under the `intrinsics` feature gate, to match the `extern "rust-intrinsic"` style.
2024-11-08 10:28:47 +00:00
Ralf Jung
e3010e84db remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
Stuart Cook
4b904ceb46
Rollup merge of #132738 - cuviper:channel-heap-init, r=ibraheemdev
Initialize channel `Block`s directly on the heap

The channel's `Block::new` was causing a stack overflow because it held
32 item slots, instantiated on the stack before moving to `Box::new`.
The 32x multiplier made modestly-large item sizes untenable.

That block is now initialized directly on the heap.

Fixes #102246

try-job: test-various
2024-11-08 18:51:30 +11:00
Jubilee
c9009ae8c8
Rollup merge of #132696 - fortanix:raoul/rte-235-fix_fmodl_missing_symbol_issue, r=tgross35
Compile `test_num_f128` conditionally on `reliable_f128_math` config

With #132434 merged, our internal SGX CI started failing with:
```
05:27:34   = note: rust-lld: error: undefined symbol: fmodl
05:27:34           >>> referenced by arith.rs:617 (core/src/ops/arith.rs:617)
05:27:34           >>>               /home/jenkins/workspace/rust-sgx-ci/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-fortanix-unknown-sgx/release/deps/std-5d5f11eb008c9091.std.d8141acc61ab7ac8-cgu.10.rcgu.o:(std::num::test_num::h7dd9449f6c01fde8)
05:27:34           >>> did you mean: fmodf
05:27:34           >>> defined in: /home/jenkins/workspace/rust-sgx-ci/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-fortanix-unknown-sgx/release/deps/libcompiler_builtins-0376f439a2ebf305.rlib(compiler_builtins-0376f439a2ebf305.compiler_builtins.c22db39d25d6f802-cgu.148.rcgu.o)
```
This originated from the `test_num_f128` test not having the required conditional compilation. This PR fixes that issue.

cc: ````@jethrogb,```` ````@workingjubilee````
2024-11-07 18:48:23 -08:00
Jubilee
0683e031a8
Rollup merge of #132639 - RalfJung:intrinsics, r=workingjubilee,Amanieu
core: move intrinsics.rs into intrinsics folder

This makes the rustbot notification we have set up for this folder in `triagebot.toml` actually work. Also IMO it makes more sense to have it all in one folder.
2024-11-07 18:48:23 -08:00
Josh Stone
03383ad102 Initialize channel Blocks directly on the heap
The channel's `Block::new` was causing a stack overflow because it held
32 item slots, instantiated on the stack before moving to `Box::new`.
The 32x multiplier made modestly-large item sizes untenable.

That block is now initialized directly on the heap.

Fixes #102246
2024-11-07 10:09:45 -08:00
Ralf Jung
ab1787b223 core: move intrinsics.rs into intrinsics folder 2024-11-07 17:49:45 +01:00
bors
9a77c3c2cb Auto merge of #132714 - mati865:update-memchr, r=tgross35
unpin and update memchr

I'm unable to build x86_64-pc-windows-gnu Rust due to some weird binutils bug, but thinlto issue seems to be no longer present. Let's give it a go on the CI.
Possibly fixed by https://github.com/rust-lang/rust/pull/129079

Fixes #127890
2024-11-07 15:34:14 +00:00
Jonas Böttiger
0a0cadfe8a
Rollup merge of #132715 - tabokie:fix-lazy-lock-doc, r=Noratrieb
fix `LazyLock::get` and `LazyLock::get_mut` document
2024-11-07 13:08:29 +01:00
Jonas Böttiger
49a58c8723
Rollup merge of #132665 - tyilo:nonzero-u-div-ceil, r=joboet
Implement `div_ceil` for `NonZero<unsigned>`

ACP: https://github.com/rust-lang/libs-team/issues/471
2024-11-07 13:08:27 +01:00
Raoul Strackx
072088074e Separate f128 % operation to deal with missing fmodl symbol 2024-11-07 11:33:10 +01:00
bors
546a1eaab9 Auto merge of #132705 - kornelski:inline-repeat, r=tgross35
Inline str::repeat

`str` is non-generic and `str.repeat()` doesn't get inlined, which makes it use a slower algorithm in case of 1-char repetitions. Equivalent byte slice does get inlined: https://rust.godbolt.org/z/4arvh97r4
2024-11-07 04:26:33 +00:00
Xinye
557c7f8cdd fix lazylock comment
Signed-off-by: Xinye <xinye.tao@metabit-trading.com>
2024-11-07 10:51:00 +08:00
bors
775f6d8d9d Auto merge of #131888 - ChrisDenton:deopt, r=ibraheemdev
Revert using `HEAP` static in Windows alloc

Fixes #131468

This does the minimum to remove the `HEAP` static that was causing chromium issues. It would be worth having a more substantial look at this module but for now I think this addresses the immediate issue.

cc `@danakj`
2024-11-07 01:23:47 +00:00
Mateusz Mikuła
7cdbb59c26 unpin and update memchr 2024-11-07 02:09:39 +01:00
Kornel
5a855654de Inline str::repeat 2024-11-06 18:54:50 +00:00
Guillaume Gomez
d6a43d4724
Rollup merge of #132617 - uellenberg:fix-rendered-doc, r=cuviper
Fix an extra newline in rendered std doc

Fixes #132564

![17308581942254367500907812250579](https://github.com/user-attachments/assets/9e946c49-c0a6-40ba-ab69-b80fe0e085e1)
(taken from the issue above)

The problem with the formatting is due to that newline between `<code>` and `<svg>`. Any newlines outside of the code (i.e., within elements inside of it) are fine.
2024-11-07 02:09:51 +08:00
bors
2796048328 Auto merge of #131721 - okaneco:const_eq_ignore_ascii_case, r=m-ou-se
Add new unstable feature `const_eq_ignore_ascii_case`

Tracking issue - #131719

Mark `[u8]`, `str` `eq_ignore_ascii_case` functions const

---

The codegen for this implementation matches the existing `iter::zip` implementation better than incrementing with a counter

while loop with counter - https://rust.godbolt.org/z/h9cs5zajc
while let - https://rust.godbolt.org/z/ecMeMjjEb
2024-11-06 09:08:53 +00:00
bors
cf2b370ad0 Auto merge of #132500 - RalfJung:char-is-whitespace-const, r=jhpratt
make char::is_whitespace unstably const

I am adding this to the existing https://github.com/rust-lang/rust/issues/132241 feature gate, since `is_digit` and `is_whitespace` seem similar enough that one can group them together.
2024-11-06 04:07:32 +00:00
okaneco
dedc441fa5 Add new unstable feature const_eq_ignore_ascii_case
Mark `[u8]`, `str` `eq_ignore_ascii_case` functions const
2024-11-05 22:22:31 -05:00
bors
a69df72bdc Auto merge of #132664 - matthiaskrgr:rollup-i27nr7i, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #131261 (Stabilize `UnsafeCell::from_mut`)
 - #131405 (bootstrap/codegen_ssa: ship llvm-strip and use it for -Cstrip)
 - #132077 (Add a new `wide-arithmetic` feature for WebAssembly)
 - #132562 (Remove the `wasm32-wasi` target from rustc)
 - #132660 (Remove unused errs.rs file)

Failed merges:

 - #131721 (Add new unstable feature `const_eq_ignore_ascii_case`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-06 01:21:42 +00:00
uellenberg
934be9b63b Change some code blocks to quotes in rendered std doc
Fixes #132564
2024-11-05 16:11:47 -08:00
Matthias Krüger
efa5af96a1
Rollup merge of #131261 - clarfonthey:unsafe-cell-from-mut, r=m-ou-se
Stabilize `UnsafeCell::from_mut`

Closes #111645.
FCP: https://github.com/rust-lang/rust/issues/111645#issuecomment-2393893003

Note that because `const_mut_refs` and `const_refs_to_cell` was stabilized, it's okay to const-stabilize this method as well.
2024-11-05 23:43:55 +01:00
bors
4a91ff6bb5 Auto merge of #132661 - matthiaskrgr:rollup-npytbl6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #132259 (rustc_codegen_llvm: Add a new 'pc' option to branch-protection)
 - #132409 (CI: switch 7 linux jobs to free runners)
 - #132498 (Suggest fixing typos and let bindings at the same time)
 - #132524 (chore(style): sync submodule exclusion list between tidy and rustfmt)
 - #132567 (Properly suggest `E::assoc` when we encounter `E::Variant::assoc`)
 - #132571 (add const_eval_select macro to reduce redundancy)
 - #132637 (Do not filter empty lint passes & re-do CTFE pass)
 - #132642 (Add documentation on `ast::Attribute`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-05 22:43:15 +00:00
Asger Hautop Drewsen
97a1b940ca Implement div_ceil for NonZero<unsigned> 2024-11-05 23:42:19 +01:00
Matthias Krüger
aa4fe48afe
Rollup merge of #132571 - RalfJung:const_eval_select_macro, r=oli-obk
add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from https://github.com/rust-lang/rust/pull/132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc ``@oli-obk`` ``@saethlin`` ``@tgross35``

try-job: dist-aarch64-msvc
2024-11-05 20:10:52 +01:00
Jubilee
57f64c67e0
Rollup merge of #132473 - ZhekaS:core_fmt_radix_no_panic, r=joboet
[core/fmt] Replace checked slice indexing by unchecked to support panic-free code

Fixes #126425

Replace the potentially panicking `[]` indexing with `get_unchecked()` to prevent linking with panic-related code.
2024-11-05 01:34:23 -08:00
Jubilee
1ee6617414
Rollup merge of #132153 - bjoernager:const-char-encode-utf16, r=dtolnay
Stabilise `const_char_encode_utf16`.

Closes: #130660

This PR stabilises the `const_char_encode_utf16` feature gate (i.e. support for `char::encode_utf16` in constant expressions).

~~Note that the linked tracking issue is as of this writing currently awaiting FCP until 2024-11-02.~~
2024-11-05 01:34:22 -08:00
Ralf Jung
613f53ef19 add const_eval_select macro to reduce redundancy
also move internal const_panic helpers to a better location
2024-11-05 09:26:08 +01:00
Jubilee
7bff6ff3a6
Rollup merge of #132609 - NotWearingPants:patch-1, r=Amanieu
docs: fix grammar in doc comment at unix/process.rs

Fixed the grammar of a sentence in the docs
2024-11-04 20:40:50 -08:00
Jubilee
67477ca342
Rollup merge of #132606 - eduardosm:char-slice-str-pattern-doc, r=tgross35
Improve example of `impl Pattern for &[char]`

The previous version used `['l', 'l']` as pattern, which would suggest that it matches the `ll` of `Hello world` as a whole.
2024-11-04 20:40:49 -08:00
Ralf Jung
5069434c81 most const intrinsics don't need an explicit rustc_const_unstable any more 2024-11-04 23:27:46 +01:00
Ralf Jung
1f0ed2b0f5 add new rustc_const_stable_intrinsic attribute for const-stable intrinsics 2024-11-04 23:27:46 +01:00
Ralf Jung
7934f26613 convert all const-callable intrinsics into the new form (without extern block) 2024-11-04 23:21:22 +01:00
NotWearingPants
107b4fdba2
docs: fix grammar in doc comment at unix/process.rs 2024-11-04 20:42:21 +02:00
Eduardo Sánchez Muñoz
4872b6bcbd Improve example of impl Pattern for &[char]
The previous version used `['l', 'l']` as pattern, which would suggest that it matches the `ll` of `Hello world` as a whole.
2024-11-04 19:08:28 +01:00
Eugene Shamis
65d8f1b8bf Fixed typo, rebased 2024-11-04 12:43:57 -05:00
Eugene Shamis
37f48da802 Updated SAFETY comment to address underflow 2024-11-04 12:36:24 -05:00
Eugene Shamis
02a1ab8071 Replace checked slice indexing by unchecked to support panic-free code
Fixes #126425

Replace the potentially panicking `[]` indexing with `get_unchecked()`
to prevent linking with panic-related code.
2024-11-04 12:36:24 -05:00
Matthias Krüger
46ae1555e2
Rollup merge of #132579 - RalfJung:rustc-std-workspace-crates, r=Amanieu
add rustc std workspace crate sources

This adds the sources for the crates listed at https://crates.io/search?q=rustc-std-workspace in this repo. The first commit adds the original sources as downloaded from crates.io (with `Cargo.toml.orig` moved back over `Cargo.toml`), and adds a README explaining what this is about. The 2nd commit updates the sources to make the core and alloc crates re-exports of the "actual" core and alloc crates, as was already the case with `std`, and also adds a `repository` link to the manifest so one can figure out where to find these crates.

I bumped the version for the core and alloc crates in the hope that the new versions can be published on crates.io shortly after this PR lands.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/rustc-std-workspace-core.20crate.20is.20empty) for a bit more context.

r? `@Amanieu`
2024-11-04 18:12:47 +01:00
Gabriel Bjørnager Jensen
7faa84e20e Stabilise 'const_char_encode_utf16'; 2024-11-04 13:09:44 +01:00
bors
56c6a2f9b1 Auto merge of #132586 - workingjubilee:rollup-qrmn49a, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #131222 (Generate correct symbols.o for sparc-unknown-none-elf)
 - #132423 (remove const-support for align_offset and is_aligned)
 - #132565 (Reduce dependence on the target name)
 - #132576 (remove attribute ids from hir stats (they're simply not needed))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-04 06:45:33 +00:00
Ralf Jung
b12745863e update rustc-std-workspace crates
- make rustc-std-workspace-core/alloc re-exports of their underlying crates, like std
= cleanup manifests
2024-11-04 07:45:15 +01:00
Jubilee
3313e760d0
Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay
remove const-support for align_offset and is_aligned

As part of the recent discussion to stabilize `ptr.is_null()` in const context, the general vibe was that it's okay for a const function to panic when the same operation would work at runtime (that's just a case of "dynamically detecting that something is not supported as a const operation"), but it is *not* okay for a const function to just return a different result.

Following that, `is_aligned` and `is_aligned_to` have their const status revoked in this PR, since they do return actively wrong results at const time. In the future we can consider having a new intrinsic or so that can check whether a pointer is "guaranteed to be aligned", but the current implementation based on `align_offset` does not have the behavior we want.

In fact `align_offset` itself behaves quite strangely in const, and that support needs a bunch of special hacks. That doesn't seem worth it. Instead, the users that can fall back to a different implementation should just use const_eval_select directly, and everything else should not be made const-callable. So this PR does exactly that, and entirely removes const support for align_offset.

Closes some tracking issues by removing the associated features:
Closes https://github.com/rust-lang/rust/issues/90962
Closes https://github.com/rust-lang/rust/issues/104203

Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-11-03 20:08:13 -08:00
bors
706eec8ce1 Auto merge of #132434 - tgross35:f128-tests, r=workingjubilee
Update `compiler-builtins` and enable f128 tests on all non-buggy platforms

Update compiler_builtins to 0.1.138 and pin it. This updates to a new version of builtins that includes [1], which was
the last blocker to us enabling `f128` tests on all platforms.

With that, we now provide symbols necessary to work with `f128` everywhere. This means that we are no longer restricted to systems that provide `f128` symbols themselves, and can enable tests by default.

There are still a handful of platforms that need to remain disabled because of bugs and some that had to get updated.

Math support is still off by default since those symbols are not yet available.

[1]: https://github.com/rust-lang/compiler-builtins/pull/624

try-job: test-various
try-job: i686-gnu-nopt
2024-11-04 04:03:29 +00:00
Trevor Gross
c0fc25cc20 Enable f128 tests on all non-buggy platforms 🎉
With the `compiler-builtins` update to 0.1.137 [1], we now provide
symbols necessary to work with `f128` everywhere. This means that we are
no longer restricted to 64-bit linux, and can enable tests by default.

There are still a handful of platforms that need to remain disabled
because of bugs. This patch additionally disables the following:

1. MIPS [2]
2. 32-bit x86 [3]

Math support is still off by default since those symbols are not yet
available.

[1]: https://github.com/rust-lang/rust/pull/132433
[2]: https://github.com/llvm/llvm-project/issues/96432
[3]: https://github.com/llvm/llvm-project/issues/77401
2024-11-03 19:33:04 -06:00
bors
43c78051ea Auto merge of #132581 - workingjubilee:rollup-4wj318p, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

 - #126136 (Call the target libdir target libdir)
 - #132516 (Add bad-reg inline assembly ui test for RISC-V and s390x)
 - #132521 (replace manual time convertions with std ones, comptime time format parsing)
 - #132560 (Remove outdated tidy license fixmes)
 - #132563 (Modify `NonZero` documentation to reference the underlying integer type)
 - #132574 (compiler: Directly use rustc_abi almost everywhere)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-04 00:54:17 +00:00