about summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2024-11-13Auto merge of #132972 - matthiaskrgr:rollup-456osr7, r=matthiaskrgrbors-12/+11
Rollup of 7 pull requests Successful merges: - #132702 (CFI: Append debug location to CFI blocks) - #132851 (Update the doc comment of `ASCII_CASE_MASK`) - #132948 (stabilize const_unicode_case_lookup) - #132950 (Use GNU ld on m68k-unknown-linux-gnu) - #132962 (triagebot: add codegen reviewers) - #132966 (stabilize const_option_ext) - #132970 (Add tracking issue number to unsigned_nonzero_div_ceil feature) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-12Rollup merge of #132970 - tyilo:nonzero-u-div-ceil-issue, r=tgross35Matthias Krüger-1/+1
Add tracking issue number to unsigned_nonzero_div_ceil feature Tracking issue: #132968
2024-11-12Rollup merge of #132966 - RalfJung:const_option_ext, r=jhprattMatthias Krüger-5/+4
stabilize const_option_ext Fixes https://github.com/rust-lang/rust/issues/91930 FCP passed in that issue.
2024-11-12Rollup merge of #132948 - RalfJung:const_unicode_case_lookup, r=NoratriebMatthias Krüger-5/+5
stabilize const_unicode_case_lookup Fixes https://github.com/rust-lang/rust/issues/101400 See there for t-libs-api FCP
2024-11-12Rollup merge of #132851 - chansuke:update-comment, r=thomccMatthias Krüger-1/+1
Update the doc comment of `ASCII_CASE_MASK` Revived and continued the work from https://github.com/rust-lang/rust/pull/120282. the original [branch](https://github.com/mahmudsudo/rust-1/tree/patch-1) was deleted, i created a new branch to carry the changes forward
2024-11-12Auto merge of #132870 - Noratrieb:inline-int-parsing, r=tgross35bors-0/+3
`#[inline]` integer parsing functions This improves the performance of `str::parse` into integers. Before: ``` compare fastest │ slowest │ median │ mean │ samples │ iters ╰─ std │ │ │ │ │ ├─ 328920585 10.23 ns │ 24.8 ns │ 10.34 ns │ 10.48 ns │ 100 │ 25600 ├─ 3255 8.551 ns │ 8.59 ns │ 8.551 ns │ 8.56 ns │ 100 │ 25600 ╰─ 5 7.847 ns │ 7.887 ns │ 7.847 ns │ 7.853 ns │ 100 │ 25600 ``` After: ``` compare fastest │ slowest │ median │ mean │ samples │ iters ╰─ std │ │ │ │ │ ├─ 328920585 8.316 ns │ 23.7 ns │ 8.355 ns │ 8.491 ns │ 100 │ 25600 ├─ 3255 4.566 ns │ 4.588 ns │ 4.586 ns │ 4.576 ns │ 100 │ 51200 ╰─ 5 2.877 ns │ 3.697 ns │ 2.896 ns │ 2.945 ns │ 100 │ 102400 ``` Benchmark: ```rust fn std(input: &str) -> Result<u64, ParseIntError> { input.parse() } ```
2024-11-12Add tracking issue number to unsigned_nonzero_div_ceil featureAsger Hautop Drewsen-1/+1
2024-11-12Make `CloneToUninit` dyn-compatibleZachary S-14/+15
2024-11-12stabilize const_option_extRalf Jung-5/+4
2024-11-12stabilize const_unicode_case_lookupRalf Jung-5/+5
2024-11-12Stabilize `Ipv6Addr::is_unique_local` and `Ipv6Addr::is_unicast_link_local`umgefahren-6/+4
2024-11-12adds new declaration to codegenaaishwarymishra@gmail.com-0/+2
2024-11-12Auto merge of #132943 - matthiaskrgr:rollup-164l3ej, r=matthiaskrgrbors-3/+3
Rollup of 8 pull requests Successful merges: - #132651 (Remove attributes from generics in built-in derive macros) - #132668 (Feature gate yield expressions not in 2024) - #132771 (test(configure): cover `parse_args` in `src/bootstrap/configure.py`) - #132895 (Generalize `NonNull::from_raw_parts` per ACP362) - #132914 (Update grammar in std::cell docs.) - #132927 (Consolidate type system const evaluation under `traits::evaluate_const`) - #132935 (Make sure to ignore elided lifetimes when pointing at args for fulfillment errors) - #132941 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-12Rollup merge of #132914 - rcorre:cell-grammar, r=tgross35Matthias Krüger-2/+2
Update grammar in std::cell docs. Using "having" in both the leading sentence and the bullets is unnecessary. It makes it read as "it is only possible to have having several immutable...".
2024-11-12Rollup merge of #132895 - scottmcm:generalize-nonnull-from-raw-parts, ↵Matthias Krüger-1/+1
r=ibraheemdev Generalize `NonNull::from_raw_parts` per ACP362 I did the raw pointers in #125701, but apparently forgot `NonNull`. cc https://github.com/rust-lang/libs-team/issues/362
2024-11-12remove no-longer-needed abs_privateRalf Jung-51/+17
2024-11-12Rollup merge of #132847 - RalfJung:addr-dont-expose, r=Mark-SimulacrumMatthias Krüger-4/+4
elem_offset / subslice_range: use addr() instead of 'as usize' There's no reason to use ptr-to-int casts with their subtle semantics here.
2024-11-12new intrinsic declarationaaishwarymishra@gmail.com-1228/+1278
2024-11-12new intrinsic declarationaaishwarymishra@gmail.com-108/+530
2024-11-11Rollup merge of #132144 - adetaylor:receiver-trait-itself, r=wesleywiserMatthias Krüger-2/+89
Arbitrary self types v2: (unused) Receiver trait This commit contains a new `Receiver` trait, which is the basis for the Arbitrary Self Types v2 RFC. This allows smart pointers to be method receivers even if they're not Deref. This is currently unused by the compiler - a subsequent PR will start to use this for method resolution if the `arbitrary_self_types` feature gate is enabled. This is being landed first simply to make review simpler: if people feel this should all be in an atomic PR let me know. This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519 https://github.com/rust-lang/rust/issues/44874 r? `@wesleywiser`
2024-11-11Update dangling pointer testsgavincrawford-0/+1
2024-11-11Tag relevant functions with #[rustc_as_ptr] attributegavincrawford-0/+11
2024-11-11Update grammar in std::cell docs.Ryan Roden-Corrent-2/+2
Using "having" in both the leading sentence and the bullets is unnecessary. It makes it read as "it is only possible to have having several immutable...".
2024-11-11Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomezbors-0/+3
rustdoc-search: simplify rules for generics and type params **Heads up!**: This PR is a follow-up that depends on #124544. It adds 12dc24f46007f82b93ed85614347a42d47580afa, a change to the filtering behavior, and 9900ea48b566656fb12b5fcbd0a1b20aaa96e5ca, a minor ranking tweak. Part of https://github.com/rust-lang/rust-project-goals/issues/112 This PR overturns https://github.com/rust-lang/rust/pull/109802 ## Preview * no results: [`Box<[A]> -> Vec<B>`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=Box%3C%5BA%5D%3E%20-%3E%20Vec%3CB%3E) * results: [`Box<[A]> -> Vec<A>`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=Box%3C%5BA%5D%3E%20-%3E%20Vec%3CA%3E) * [`T -> U`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=T%20-%3E%20U) * [`Cx -> TyCtxt`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3-compiler/rustdoc/index.html?search=Cx%20-%3E%20TyCtxt) ![image](https://github.com/user-attachments/assets/015ae28c-7469-4f7f-be03-157d28d7ec97) ## Description This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. - Order within generics is significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. - Generics are only "unboxed" if a type is explicitly opted into it. References and tuples are hardcoded to allow unboxing, and Box, Rc, Arc, Option, Result, and Future are opted in with an unstable attribute. Search result unboxing is the process that allows you to search for `i32 -> str` and get back a function with the type signature `&Future<i32> -> Box<str>`. - Instead of ranking by set overlap, it ranks by the number of items in the type signature. This makes it easier to find single type signatures like transmute. ## Find the discussion on * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search>
2024-11-11Generalize `NonNull::from_raw_parts` per ACP362Scott McMurray-1/+1
I did the raw pointers in 125701, but apparently forgot `NonNull`.
2024-11-11vectorize slice::is_sortedLaiho-1/+17
2024-11-10`#[inline]` integer parsing functionsNoratrieb-0/+3
This improves the performance of `str::parse` into integers. Before: ``` compare fastest │ slowest │ median │ mean │ samples │ iters ╰─ std │ │ │ │ │ ├─ 328920585 10.23 ns │ 24.8 ns │ 10.34 ns │ 10.48 ns │ 100 │ 25600 ├─ 3255 8.551 ns │ 8.59 ns │ 8.551 ns │ 8.56 ns │ 100 │ 25600 ╰─ 5 7.847 ns │ 7.887 ns │ 7.847 ns │ 7.853 ns │ 100 │ 25600 ``` After: ``` compare fastest │ slowest │ median │ mean │ samples │ iters ╰─ std │ │ │ │ │ ├─ 328920585 8.316 ns │ 23.7 ns │ 8.355 ns │ 8.491 ns │ 100 │ 25600 ├─ 3255 4.566 ns │ 4.588 ns │ 4.586 ns │ 4.576 ns │ 100 │ 51200 ╰─ 5 2.877 ns │ 3.697 ns │ 2.896 ns │ 2.945 ns │ 100 │ 102400 ``` Benchmark: ```rust fn std(input: &str) -> Result<u64, ParseIntError> { input.parse() } ```
2024-11-10Update the doc comment of `ASCII_CASE_MASK`chansuke-1/+1
2024-11-10elem_offset / subslice_range: use addr() instead of 'as usize'Ralf Jung-4/+4
2024-11-10Rollup merge of #132136 - RalfJung:target-feature-abi-compat, r=Mark-SimulacrumMatthias Krüger-26/+6
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-09Improve documentation of `element_offset` and related methodswr7-3/+4
2024-11-09Rename `elem_offset` to `element_offset`wr7-4/+4
2024-11-08remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic ↵Ralf Jung-78/+102
functions instead
2024-11-08mark is_val_statically_known intrinsic as stably const-callableRalf Jung-9/+5
2024-11-07core: move intrinsics.rs into intrinsics folderRalf Jung-0/+0
2024-11-07Rollup merge of #132665 - tyilo:nonzero-u-div-ceil, r=joboetJonas Böttiger-0/+29
Implement `div_ceil` for `NonZero<unsigned>` ACP: https://github.com/rust-lang/libs-team/issues/471
2024-11-06optimize char::to_digit and assert radix is at least 2Jacob Lifshay-13/+31
approved by t-libs: https://github.com/rust-lang/libs-team/issues/475#issuecomment-2457858458
2024-11-06Auto merge of #131721 - okaneco:const_eq_ignore_ascii_case, r=m-ou-sebors-3/+25
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-06Add `is_ascii` function optimized for x86-64 for [u8]okaneco-12/+58
The new `is_ascii` function is optimized to use the `pmovmskb` vector instruction which tests the high bit in a lane. This corresponds to the same check of whether a byte is ASCII so ASCII validity checking can be vectorized. This instruction does not exist on other platforms so it is likely to regress performance and is gated to all(target_arch = "x86_64", target_feature = "sse2"). Add codegen test Remove crate::mem import for functions included in the prelude
2024-11-06Auto merge of #132500 - RalfJung:char-is-whitespace-const, r=jhprattbors-3/+4
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-05Add new unstable feature `const_eq_ignore_ascii_case`okaneco-3/+25
Mark `[u8]`, `str` `eq_ignore_ascii_case` functions const
2024-11-06Auto merge of #132664 - matthiaskrgr:rollup-i27nr7i, r=matthiaskrgrbors-2/+3
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-05Rollup merge of #131261 - clarfonthey:unsafe-cell-from-mut, r=m-ou-seMatthias Krüger-2/+3
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-05Auto merge of #132661 - matthiaskrgr:rollup-npytbl6, r=matthiaskrgrbors-456/+478
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-05Implement div_ceil for NonZero<unsigned>Asger Hautop Drewsen-0/+29
2024-11-05Rollup merge of #132571 - RalfJung:const_eval_select_macro, r=oli-obkMatthias Krüger-456/+478
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-05Rollup merge of #132473 - ZhekaS:core_fmt_radix_no_panic, r=joboetJubilee-1/+4
[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-05Rollup merge of #132153 - bjoernager:const-char-encode-utf16, r=dtolnayJubilee-3/+5
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-05add const_eval_select macro to reduce redundancyRalf Jung-456/+478
also move internal const_panic helpers to a better location
2024-11-04Rollup merge of #132606 - eduardosm:char-slice-str-pattern-doc, r=tgross35Jubilee-2/+2
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.