Commit Graph

9538 Commits

Author SHA1 Message Date
ltdk
055e05a338 Mark float intrinsics with no preconditions as safe 2025-09-21 20:37:51 -04:00
Jules Bertholet
97b2292b06 Allow shared access to Exclusive<T> when T: Sync 2025-09-21 14:12:54 -04:00
Ben Kimock
df58fd8cf7 Change the cfg to a dash 2025-09-21 13:12:20 -04:00
Ben Kimock
888679013d Add panic=immediate-abort 2025-09-21 13:12:18 -04:00
Stuart Cook
b0c55c8554 Rollup merge of #145664 - Darksonn:stab-file-with-nul, r=Mark-Simulacrum
Stabilize `std::panic::Location::file_as_c_str`

Closes: rust-lang/rust#141727

Nominating this for T-lang as per ```@traviscross```  https://github.com/rust-lang/rust/issues/141727#issuecomment-3201318429
2025-09-21 14:42:34 +10:00
Thalia Archibald
776c199c7b Fix std build for xtensa 2025-09-19 19:18:10 -06:00
Matthias Krüger
96a4ae3ab9 Rollup merge of #146690 - npmccallum:convo, r=tgross35
add `[const] PartialEq` bound to `PartialOrd`

This change is included for discussion purposes.

The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?
2025-09-19 22:53:54 +02:00
Yotam Ofek
eb7abeb261 Specialize Iterator::eq[_by] for TrustedLen iterators 2025-09-18 22:47:54 +03:00
Nathaniel McCallum
8d7ec96c00 add [const] PartialEq bound to PartialOrd
This change is included for discussion purposes.

The PartialOrd bound on PartialEq is not strictly necessary. It
is, rather, logical: anything which is orderable should by
definition have equality. Is the same true for constness? Should
every type which is const orderable also have const equality?
2025-09-17 16:39:01 -05:00
Stuart Cook
6473a0f02d Rollup merge of #146564 - cjgillot:mir-nolen, r=scottmcm
Remove Rvalue::Len again.

Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`.

r? ``@scottmcm``
2025-09-17 14:56:48 +10:00
Stuart Cook
cefd932520 Rollup merge of #146410 - hkBst:repeat-1, r=jhpratt
Iterator repeat: no infinite loop for `last` and `count`

This removes two cases of infinite looping from [`Repeat`](https://doc.rust-lang.org/nightly/std/iter/struct.Repeat.html):
- [`last`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.last): By viewing the iterator as returning None after [omega](https://en.wikipedia.org/wiki/Ordinal_number) calls to `next`, this method can simply return the repeated element.

- [`count`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.count): From its docs: """The method does no guarding against overflows, so counting elements of an iterator with more than [usize::MAX](https://doc.rust-lang.org/nightly/std/primitive.usize.html#associatedconstant.MAX) elements either produces the wrong result or panics. If overflow checks are enabled, a panic is guaranteed.""", so a panic'ing impl is allowed by the docs, and is more honest than an infinite loop.
2025-09-17 14:56:46 +10:00
Stuart Cook
6ad98750e0 Rollup merge of #145660 - jbatez:darwin_objc, r=jdonszelmann,madsmtm,tmandry
initial implementation of the darwin_objc unstable feature

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

This feature makes it possible to reference Objective-C classes and selectors using the same ABI used by native Objective-C on Apple/Darwin platforms. Without it, Rust code interacting with Objective-C must resort to loading classes and selectors using costly string-based lookups at runtime. With it, these references can be loaded efficiently at dynamic load time.

r? ```@tmandry```

try-job: `*apple*`
try-job: `x86_64-gnu-nopt`
2025-09-17 14:56:44 +10:00
Camille Gillot
f018b46558 Update docs. 2025-09-16 22:23:19 +00:00
Camille Gillot
53b91ea87f Remove Rvalue::Len. 2025-09-16 22:23:19 +00:00
Joe Birr-Pixton
325ceef018 Fix other uses of "adaptor" 2025-09-16 11:58:12 +01:00
Marijn Schouten
c89b6a955c Iterator repeat: no infinite loop for last and count 2025-09-16 10:09:20 +00:00
bors
8a1b39995e Auto merge of #146614 - Zalathar:rollup-hcxvdi1, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#145095 (Migrate `UnsizedConstParamTy`  to unstable impl of `ConstParamTy_`)
 - rust-lang/rust#145960 (Split `FnCtxt::report_args_error` into subfunctions)
 - rust-lang/rust#146402 (interpret: fix overlapping aggregate initialization)
 - rust-lang/rust#146466 (llvm-wrapper: other cleanup)
 - rust-lang/rust#146574 (compiletest: Enable new-output-capture by default)
 - rust-lang/rust#146599 (replace some `#[const_trait]` with `const trait`)
 - rust-lang/rust#146601 (compiletest: Make `./x test --test-args ...` work again)
 - rust-lang/rust#146608 (improve internal bootstrap docs)
 - rust-lang/rust#146609 (bootstrap: lower verbosity of cargo to one less than bootstrap's)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-16 04:26:18 +00:00
Stuart Cook
f3c395b118 Rollup merge of #146599 - npmccallum:cleanup, r=fmease
replace some `#[const_trait]` with `const trait`
2025-09-16 10:25:42 +10:00
Stuart Cook
edd6721583 Rollup merge of #145095 - tiif:unstable_const_param, r=BoxyUwU
Migrate `UnsizedConstParamTy`  to unstable impl of `ConstParamTy_`

Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait.

r? `@BoxyUwU`
2025-09-16 10:25:38 +10:00
Matthias Krüger
4950bf5c19 Rollup merge of #146533 - Zalathar:array-default, r=compiler-errors
Note some previous attempts to change the Default impl for `[T; 0]`

Recently, rust-lang/rust#145457 experimented with changing the Default impl for `[T; 0]`.

Subsequently, rust-lang/rust#146531 also aimed to perform a similar experiment.

It seems like a good idea to add some links to the relevant source code, so that the historical context of this tricky topic is easier to find.
2025-09-15 22:09:48 +02:00
Aapo Alasuutari
c4a87eb62c fix: Move CoerceShared into ops 2025-09-15 20:50:00 +03:00
Aapo Alasuutari
c8663eec6a Introduce CoerceShared lang item and trait 2025-09-15 20:23:26 +03:00
Nathaniel McCallum
2d76bb1f23 replace some #[const_trait] with const trait 2025-09-15 11:33:40 -04:00
tiif
b919a5f518 Remove UnsizedConstParamTy trait and make it into an unstable impl 2025-09-15 08:57:22 +00:00
Matthias Krüger
fa63dbf301 Rollup merge of #146284 - Kivooeo:blazing-fast-division-bignum, r=Mark-Simulacrum
Remove `div_rem` from `core::num::bignum`

This fixes very old fixme that sounds like this

```
Stupid slow base-2 long division taken from
https://en.wikipedia.org/wiki/Division_algorithm
FIXME use a greater base ($ty) for the long division.
```

By deleting this method since it was never used
2025-09-15 06:03:45 +02:00
Zalathar
16c720645c Note some previous attempts to change the Default impl for [T; 0] 2025-09-14 14:45:50 +10:00
Jo Bates
1ebf69d1b1 initial implementation of the darwin_objc unstable feature 2025-09-13 16:06:22 -07:00
Jacob Pratt
da1c27df16 Rollup merge of #146521 - folkertdev:document-va-arg-safe, r=workingjubilee
document `core::ffi::VaArgSafe`

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

A modification of https://github.com/rust-lang/rust/pull/146454, keeping just the documentation changes, but not unsealing the trait.

Although conceptually we'd want to unseal the trait, there are many edge cases to supporting arbitrary types. We'd need to exhaustively test that all targets/calling conventions support all types that rust might generate (or generate proper error messages for unsupported cases). At present, many of the `va_arg` implementations assume that the argument is a scalar, and has an alignment of at most 8. That is totally  sufficient for an MVP (accepting all of the "standard" C types), but clearly does not cover all rust types.

This PR also adds some various other tests for edge cases of c-variadic:

- the `#[inline]` attribute in its various forms. At present, LLVM is unable to inline c-variadic functions, but the attribute should still be accepted. `#[rustc_force_inline]` already rejects c-variadic functions.
- naked functions should accept and work with a C variable argument list. In the future we'd like to allow more ABIs with naked functions (basically, any ABI for which we accept defining foreign c-variadic functions), but for now only  `"C"` and `"C-unwind` are supported
- guaranteed tail calls: c-variadic functions cannot be tail-called. That was already rejected, but there was not test for it.

r? `@workingjubilee`
2025-09-13 18:55:20 -04:00
Folkert de Vries
61a3593786 c-variadic: document core::ffi::VaArgSafe
and document `VaList::arg`.
2025-09-13 21:04:58 +02:00
Evgenii Zheltonozhskii
ff9b1c1d28 Constify Eq, Ord, PartialOrd 2025-09-12 12:39:31 +03:00
Stuart Cook
602841dc8c Rollup merge of #142315 - lolbinarycat:core-dedup-ptr-docs-139190-pt3, r=workingjubilee
core::ptr: deduplicate docs for as_ref, addr, and as_uninit_ref

also add INFO.md file explaining the purpose of the ptr/docs dir, and give some pointers (heh) to future maintainers.

follow up to rust-lang/rust#142101

part of rust-lang/rust#139190

r? `@workingjubilee`
2025-09-11 14:06:26 +10:00
binarycat
d50a80e1d0 core::ptr: deduplicate docs for as_ref, addr, and as_uninit_ref
also add INFO.md file explaining the purpouse of the ptr/docs dir.
2025-09-10 11:00:08 -05:00
Matthias Krüger
d0ba5e33ff Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhpratt
inclusive `Range`s: change `end` to `last`

Tracking issue: rust-lang/rust#125687
ACP: rust-lang/libs-team#511
2025-09-10 14:17:37 +02:00
Marco Cavenati
83a99aadcf Bump unicode printable to version 17.0.0 2025-09-09 15:01:47 +02:00
Marco Cavenati
400e687598 Bump unicode_data to version 17.0.0 2025-09-09 09:03:52 +02:00
Stuart Cook
fde2ef616d Rollup merge of #146326 - cyrgani:int-module-1, r=jhpratt
simplify the declaration of the legacy integer modules (`std::u32` etc.)

This PR removes some duplicated code from the declaration of the legacy integer modules by expanding the macro which is already used to generate `MIN` and `MAX` to now generate the whole module.
This would also make the remaining steps listed in rust-lang/rust#68490 such as fully deprecating the modules or placing `#[doc(hidden)]` on them easier.
2025-09-09 14:35:06 +10:00
Stuart Cook
915f9ff160 Rollup merge of #146324 - RalfJung:no-ptr-fragment, r=oli-obk
const-eval: disable pointer fragment support

This fixes https://github.com/rust-lang/rust/issues/146291 by disabling pointer fragment support for const-eval. I want to properly fix this eventually, but won't get to it in the next few weeks, so this is an emergency patch to prevent the buggy implementation from landing on stable. The beta cutoff is on Sep 12th so if this PR lands after that, we'll need a backport.
2025-09-09 14:35:05 +10:00
Stuart Cook
b543b1444b Rollup merge of #146314 - cyrgani:hide-fmt-args-nl, r=GuillaumeGomez
mark `format_args_nl!` as `#[doc(hidden)]`

The `#[unstable]` attribute of the macro already says:

> `format_args_nl` is only for internal language use and is subject to change

It does seem plausible to hide it from the `std` docs accordingly.

The PR also removes the single usage of the macro outside of `std` as it does not seem like the macro is actually needed there.
2025-09-09 14:35:04 +10:00
Stuart Cook
598577911f Rollup merge of #146300 - bjoernager:f16-f128-sum-product, r=jhpratt
Implement `Sum` and `Product` for `f16` and `f128`.

Tracking issue: rust-lang/rust#116909.

This PR implements `core::iter::{Sum, Product}` for `f16` and `f128`.

I'm curious as to why these two traits aren't already implemented. I've been unable to find any information about it at all, so if there is anything that currently blocks them, I would appreciate if someone could fill me in.
2025-09-09 14:35:04 +10:00
Jeremy Smart
8d0c07f1a1 change end to last 2025-09-08 22:07:43 -04:00
cyrgani
9899ab3fa4 simplify the declaration of the legacy integer modules (std::u32 etc.) 2025-09-08 22:28:36 +02:00
Matthias Krüger
803b5b56f3 Rollup merge of #146319 - justinyaodu:patch-1, r=jhpratt
Fix typo in default.rs

This sentence currently reads:

> Rust implements `Default` for various primitives types.

I think it should just be "primitive types".
2025-09-08 16:34:59 +02:00
cyrgani
edc94e6184 mark format_args_nl! as #[doc(hidden)] 2025-09-08 15:02:25 +02:00
Ralf Jung
aed0ed4c93 const-eval: disable pointer fragment support 2025-09-08 13:22:52 +02:00
bors
beeb8e3af5 Auto merge of #146173 - Kmeakin:km/unicode-data/no-ascii, r=jhpratt
Don't include ASCII characters in Unicode tables

Split off from https://github.com/rust-lang/rust/pull/145219
2025-09-08 07:25:07 +00:00
Justin Yao Du
7fa23530bf Fix typo in default.rs 2025-09-07 21:16:35 -07:00
Kivooeo
a2d66db9ba remove unsused div_rem method from bignum 2025-09-07 17:21:47 +00:00
Gabriel Bjørnager Jensen
02602ef651 Implement 'Sum' and 'Product' for 'f16' and 'f128'; 2025-09-07 18:01:39 +02:00
Karl Meakin
a8c669461f optimization: Don't include ASCII characters in Unicode tables
The ASCII subset of Unicode is fixed and will never change, so we don't
need to generate tables for it with every new Unicode version. This
saves a few bytes of static data and speeds up `char::is_control` and
`char::is_grapheme_extended` on ASCII inputs.

Since the table lookup functions exported from the `unicode` module will
give nonsensical errors on ASCII input (and in fact will panic in debug
mode), I had to add some private wrapper methods to `char` which check
for ASCII-ness first.
2025-09-07 15:21:24 +02:00
bors
f13ef0d75d Auto merge of #146216 - LorrensP-2158466:miri-float-nondet-foreign-items-take2, r=RalfJung
Miri: non-deterministic floating point operations in foreign_items

Take 2 of rust-lang/rust#143906. The last 2 commits are what changed compared to the original pr.

Verified the tests using (fish shell):
```fish
env MIRIFLAGS="-Zmiri-max-extra-rounding-error -Zmiri-many-seeds" ./x miri --no-fail-fast std core coretests  -- f32 f64
```

r? `@RalfJung`
2025-09-07 10:46:38 +00:00