Commit Graph

11261 Commits

Author SHA1 Message Date
Yara
37e1969c97 reflection: remove fields from TypeKind 2026-08-15 01:03:06 +02:00
Yara
f5fc985e7b reflection: update FieldRepresentingType debug to use methods on TypeId 2026-08-15 01:03:06 +02:00
Yara
2b7d180842 reflection: add non-exhaustive to meme::type_info::Variant 2026-08-15 01:03:06 +02:00
Yara
b685be1643 reflection: Add TypeId::variant() returning new Variant 2026-08-15 01:02:32 +02:00
Jacob Pratt
89fe0597a8 Rollup merge of #161055 - Sa4dUs:offload-macro, r=ZuseZ4
`offload!` function-like macro

r? @ZuseZ4
2026-08-13 18:16:30 -04:00
Jacob Pratt
d44b33e46d Rollup merge of #161020 - tgross35:io-error-updates, r=clarfonthey
io: Use `NonNull` for all `Custom` API related to `Box`, update documentation for `Custom`

Use `NonNull` a few more places to avoid the need to convert to and from `*mut T`. Also document the invariants for `Custom`.
2026-08-13 18:16:26 -04:00
Jacob Pratt
9e0b9bc6cd Rollup merge of #158885 - folkertdev:complex-layout, r=workingjubilee
Add `core::num::Complex`

tracking issue: https://github.com/rust-lang/rust/issues/154023

See also [#t-compiler > representing `_Complex`](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/representing.20.60_Complex.60/with/608308993). The RFC states that the `Complex` type should match the ABI of `_Complex` in C, but provides little detail on how to actually achieve this. We concluded that `repr(complex)` is probably the best approach. Like clang, that means we "desugar" the representation early: `_Complex` is not natively represented in LLVM IR.

I've derived the ABI from `clang` for 28 targets, a decent sample of what we actually support. For now I'm only actually testing `x86_64` because (as you'll see) updating the tests is quite labor-intensive. If we're happy with this direction I can fill more of them in, likely in a separate PR.

The libs side of the type is very bare-bones: I'm not as interested in that part. Others can fill in the various instances, methods, write tests for those, and improve the docs.

r? workingjubilee
2026-08-13 18:16:12 -04:00
Jacob Pratt
d34673e3f8 Rollup merge of #161065 - tgross35:funnel-shift-docs, r=clarfonthey
core: Fix a typo in funnel shift documentation
2026-08-13 18:16:12 -04:00
Jacob Pratt
8d82dada19 Rollup merge of #161040 - SomeFlyingThing:agent/audit-codegen-hints, r=joboet
Optimize CStr backing slice bounds checks

Hint that Cstr is non empty bcs it always contains the null byte.     Byte-zero access reduces from 27 to 4 bytes
2026-08-13 18:16:11 -04:00
Jacob Pratt
584abbca87 Rollup merge of #160288 - mejrs:anon_const_attr_docs, r=GuillaumeGomez
rustdoc: use anonymous constant for primitives/keywords/attribute docs

For context: [#t-rustdoc > hiding fake_item modules. @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/hiding.20fake_item.20modules.2E/near/612115954)

r? @GuillaumeGomez

I've rendered the standard library docs and prims/kws/attrs all show up as normal.

However I could not figure out how to run some of the tests, so this may be a bit of CI-debugging for me :(
2026-08-13 18:16:03 -04:00
Jacob Pratt
b5bd6182b6 Rollup merge of #157428 - nia-e:allocator-refactor, r=clarfonthey
allocator: refactor for stabilisation

Adds my current proposal per the doc in rust-lang/rust#156882 and follow-up Zulip conversations (notably for [dyn-compat](https://rust-lang.zulipchat.com/#narrow/channel/197181-t-libs.2Fwg-allocators/topic/Allocator.20dyn-safety/near/599555822)) unstably.

r? libs
2026-08-13 18:16:00 -04:00
Marcelo Dominguez
3de35f270d Add function-like macro 2026-08-13 22:34:03 +03:00
Trevor Gross
2bfb443461 core: Fix a typo in funnel shift documentation 2026-08-13 14:23:16 -04:00
mejrs
6ef144dcb3 rustdoc: use anonymous constant for primitives/keywords/attribute docs 2026-08-13 14:49:49 +02:00
bors
ba28ff76f3 Auto merge of #161031 - jhpratt:rollup-XTZ644V, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#159593 (merge ambiguity errors that blame the same inference variable)
 - rust-lang/rust#160687 (Experiment: Add `core::cmp::smallest` and `core::cmp::largest`)
 - rust-lang/rust#160856 (Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails)
 - rust-lang/rust#160961 (bootstrap: Overhaul matching of command-line selectors to steps)
 - rust-lang/rust#160975 (Remove target argument from get_proc_macros)
 - rust-lang/rust#161023 (bootstrap: Replace the `exit!` macro with a function `helpers::exit_process`)
 - rust-lang/rust#160932 (Make tidy::Version public)
 - rust-lang/rust#161029 (mailmap: Update my default email)
2026-08-13 10:24:48 +00:00
SomeFlyingThing
5f4b091827 Optimize CStr backing slice bounds checks 2026-08-13 02:56:27 -07:00
Jacob Pratt
41c33508fc Rollup merge of #160687 - bushrat011899:experiment_splat_min_max, r=nia-e
Experiment: Add `core::cmp::smallest` and `core::cmp::largest`

Tracking Issue: rust-lang/rust#160728
Zulip: [#t-libs-api/api-changes > variadic min/max](https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs-api.2Fapi-changes/topic/variadic.20min.2Fmax/with/570428142)

# Description

Adds variadic alternatives to `cmp::min` and `cmp::max` which use `#[rustc_splat]` to allow anywhere from 1 to 12 arguments to be compared. Twelve chosen as an arbitrary limit. This doesn't have a pre-existing ACP or tracking issue (linking the `splat` issue since it's the most relevant), so I've added these two functions, `smallest` and `largest` under a new feature, `cmp_splat`.

This mostly exists to demonstrate a possible solution to the problem posited in the linked Zulip thread. Happy to close if undesirable, as my current focus is on `no_std` I/O.
2026-08-13 03:26:28 -04:00
bors
1e5ee35637 Auto merge of #161014 - jhpratt:rollup-lyWH2E3, r=jhpratt
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#160976 (Ensure TLS accesses don't call the global allocator through panic (part 2))
 - rust-lang/rust#160438 ([rustdoc] Change table odd table rows background color to not make it the same as inline code)
 - rust-lang/rust#160985 (self-profile more of borrowck)
 - rust-lang/rust#137858 (Add new `unused_footnote_definition` rustdoc lint)
 - rust-lang/rust#159566 (Add support for generics in `offload`and remove `no_mangle` attribute)
 - rust-lang/rust#160676 (rustc_public: split `def`s out of `ty`)
 - rust-lang/rust#160861 (rustc_parse: suggest removing semicolon before `if` block)
 - rust-lang/rust#160958 (Remove unused `#[non_exhaustive]` in library)
 - rust-lang/rust#160978 (move resolve_path to Session inherent method)
 - rust-lang/rust#160990 (Remove old cfg parser which is now dead code)
 - rust-lang/rust#160991 (Add offload component on nightly)
 - rust-lang/rust#160999 (doc changes to expect messages in process.rs)
 - rust-lang/rust#161003 (Also warn if an invalid `doc` attribute is used on a macro invocation)
2026-08-13 07:24:48 +00:00
Trevor Gross
57b5019a3d io: Improve internal documentation for Custom error
Add comments about what fields do and turn cross-method safety into
easier to follow invariants.
2026-08-13 00:43:47 -04:00
Jacob Pratt
b26f9f8161 Rollup merge of #154150 - tgross35:funnel-updates, r=Mark-Simulacrum
core: Improve the documentation for funnel shifts

Change the variable name to make things a bit more clear, then rework funnel shift documentation. Examples now cover shifting by zero and emulating rotates.

Tracking issue: https://github.com/rust-lang/rust/issues/145686
2026-08-12 23:38:36 -04:00
Trevor Gross
c48651ad30 io: Use NonNull for all Custom API related to Box
`*mut T` is used in a few places where we have a `NonNull`. Use
`NonNull` everywhere to save a few conversions.
2026-08-12 22:10:13 -04:00
Zac Harrold
a6936680c7 Implement core::cmp::{smallest, largest}
Variadic alternatives to `min` and `max` using `splat`.
2026-08-13 11:13:00 +10:00
Trevor Gross
ab93962cd2 core: Improve the documentation for funnel shifts
Shorten the summary line, cover shifts by zeros, rotates, and panics in
examples, and turn the "Panics" section into a complete sentence.
2026-08-12 20:40:23 -04:00
Jacob Pratt
ecc1bbebbf Rollup merge of #160958 - mu001999-contrib:remove-unused-non-exhaustive, r=oli-obk
Remove unused `#[non_exhaustive]` in library

Extracted from https://github.com/rust-lang/rust/pull/160918
2026-08-12 20:17:33 -04:00
Trevor Gross
def6f91655 core: Use the same width for integer primitive literals in docs
It's a bit easier to understand the results of shifts and otherwise
bitwise operations when leading zeros are present.
2026-08-12 20:15:16 -04:00
Trevor Gross
19a5ba789e core: Rename funnel shift rhs parameter to right
`rhs` is confusing since for the `Shl` and `Shr` traits, that is the
name used for the value to shift by (i.e. `self >> rhs`).
2026-08-12 20:15:16 -04:00
bors
52d0866480 Auto merge of #160953 - ChrisDenton:clippy, r=nia-e
Enforce more library clippy lints in CI



Best reviewed commit by commit.

This is testing the waters for enforcing more clippy lints. I've chosen these ones because we mostly adhere to them already (at least in core/alloc/std) so we can reduce the noise in `./x clippy` by fixing or allowing the relatively few violations.
2026-08-12 21:24:01 +00:00
Folkert de Vries
5b66cc1ab2 add Complex type 2026-08-12 22:50:00 +02:00
Chris Denton
c3c4d1f3fb clippy::empty_line_after_doc_comments 2026-08-12 19:14:56 +00:00
Chris Denton
6dab6042c7 clippy::needless_return 2026-08-12 19:11:35 +00:00
Chris Denton
2a57d04b6e clippy::let_and_return 2026-08-12 19:11:34 +00:00
Chris Denton
0428aee4aa clippy::ptr_offset_with_cast 2026-08-12 19:11:34 +00:00
Chris Denton
5c3e5c5fd7 clippy::needless_as_bytes 2026-08-12 19:11:34 +00:00
Chris Denton
2536dc4e77 clippy::len_zero 2026-08-12 19:11:33 +00:00
Chris Denton
7cf49165af clippy::zero_divided_by_zero 2026-08-12 19:11:32 +00:00
Chris Denton
c71d9461bf clippy::legacy_numeric_constants 2026-08-12 19:11:32 +00:00
Chris Denton
568feb64fb clippy::int_plus_on 2026-08-12 19:11:31 +00:00
bors
c98d0cb27c Auto merge of #160980 - JonathanBrouwer:rollup-MX1XSgM, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#160966 (bootstrap: Avoid some unnecessary imports from the crate root)
 - rust-lang/rust#159987 (trait solver: Track canonical response universe assumptions)
 - rust-lang/rust#160886 (Trim `GoalStalledOn::Certainty`)
 - rust-lang/rust#160925 (Add `TypeId::is_signed` method)
 - rust-lang/rust#160926 (sve: add addl. passing test for field projection)
 - rust-lang/rust#160977 (Remove `MutatingUseContext::Retag`)
2026-08-12 14:35:22 +00:00
Jonathan Brouwer
5d8a3c9f20 Rollup merge of #160925 - yara-blue:is_signed, r=oli-obk
Add `TypeId::is_signed` method

Tracking issue https://github.com/rust-lang/rust/issues/146922

r? @oli-obk
2026-08-12 13:52:41 +02:00
Roland Xu
a184a6dd42 Remove unused #[non_exhaustive] in library 2026-08-12 11:07:56 +08:00
Zac Harrold
8cbe25f87b Stabilize Write for Cursor<W: WriteThroughCursor>
Was already stable when using explicit types (e.g. `Vec<u8>`). `WriteThroughCursor` is still unstable/hidden.
2026-08-12 10:11:40 +10:00
Yara
0ea82de957 Add TypeId::is_signed method 2026-08-11 18:36:33 +02:00
bors
e64c8a664d Auto merge of #160908 - jhpratt:rollup-a7bBwHd, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#159064 (Add offload support to the dist-x86_64-linux CI job)
 - rust-lang/rust#160746 (add regression tests for the fn sig ice)
 - rust-lang/rust#160855 (bootstrap: Simplify absolute path handling)
 - rust-lang/rust#160898 (Put `{:#?}` into backticks)
2026-08-11 13:55:42 +00:00
Jacob Pratt
7e9daa7dee Rollup merge of #160898 - ada4a:ada/push-kvmrpuumwylt, r=ShoyuVanilla
Put `{:#?}` into backticks

For consistency with `{:?}` before it
2026-08-11 08:28:10 -04:00
Jonathan Brouwer
8cd8b73209 Rollup merge of #156338 - P8L1:derive-reborrow-coerce-shared, r=oli-obk
Implement derives for Reborrow and CoerceShared

This adds built-in derive support for the experimental `Reborrow` and `CoerceShared` marker traits behind `#![feature(reborrow)]`.

The derives generate the same marker impls users would write manually, while preserving the existing coherence and structural validation path for the experimental reborrow traits.

## Please note this impl:

- Preserves generics, lifetimes, const params, and where clauses in generated impls.
- Preserves multiple lifetime parameters in generated impls instead of duplicating the current experimental one-lifetime limitation in the derive layer.
- Requires an explicit `CoerceShared` target type through the derive helper attribute.
- Adds UI coverage for valid derives, feature gating, malformed helper attributes, unsupported item kinds, validation failures, and multiple-lifetime derive behavior.
- Makes the derive layer future-proof for multiple lifetimes: it preserves all lifetime parameters and generates the same impl shape as a manual impl.

@rustbot label F-reborrow
Tracking: https://github.com/rust-lang/rust/issues/145612
2026-08-11 11:14:51 +02:00
Ada Alakbarova
3eda5ccb98 Put {:#?} into backticks
For consistency with `{:?}` before it
2026-08-11 10:28:23 +02:00
Pieter-Louis Schoeman
599fbed7fe Implement derives for Reborrow and CoerceShared 2026-08-11 06:48:53 +00:00
bors
0913b18e48 Auto merge of #160888 - jhpratt:rollup-OY2pQdT, r=jhpratt
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#160872 (Add back homu-ignore markers around the PR template)
 - rust-lang/rust#160432 (core: generalize `BorrowedCursor::ensure_init`)
 - rust-lang/rust#160843 (Overhaul `rustc_query_impl`)
 - rust-lang/rust#160865 (use `static` instead of `const` for derive(Debug))
 - rust-lang/rust#160866 (Update books)
 - rust-lang/rust#160881 (Implement <OnceCell,OnceLock>::new_init)
2026-08-11 04:22:47 +00:00
Jacob Pratt
80fdf73bad Rollup merge of #160881 - malezjaa:implement_new_init, r=clarfonthey
Implement <OnceCell,OnceLock>::new_init

Tracking issues: rust-lang/rust#159859 rust-lang/rust#159860

I'm not sure If I was supposed to add any other tests apart from the doc tests.
2026-08-10 23:49:39 -04:00
Jacob Pratt
45109098e7 Rollup merge of #160432 - joboet:ensure_init_generic, r=clarfonthey
core: generalize `BorrowedCursor::ensure_init`

Tracking issue: https://github.com/rust-lang/rust/issues/160476

This implements the future possibility left out in https://github.com/rust-lang/rust/pull/149749#issue-3704149674 and makes `ensure_init` generic over `Default`. I used specialisation to make sure the performance in the `u8` case stays equivalent to `memset` irrespective of how clever the optimiser happens to be.

CC @joshtriplett as you've been working on this stuff recently.

This also adds a public `write_default` method on `[MaybeUninit<T>]` that's doing the equivalent of `.write_init(|_| Default::default())`, but uses specialisation for integers. This uses the existing [tracking issue for `maybe_uninit_fill`](https://github.com/rust-lang/rust/issues/117428).
2026-08-10 23:49:36 -04:00