about summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2024-01-07edit new section for typos and better wordingGray Olson-16/+21
2024-01-07fix importsGray Olson-6/+5
2024-01-07fix typosGray Olson-4/+4
2024-01-07add section on manual owning ptr managed solution via @kpreidGray Olson-9/+36
2024-01-07improve structural Unpin + formattingGray Olson-8/+10
2024-01-07reword unpin auto impl sectionGray Olson-26/+20
2024-01-07fix link in footnoteGray Olson-3/+3
2024-01-07improve `Pin` struct docs and add examplesGray Olson-8/+89
2024-01-07improve intro and discussion of pinning as library contractGray Olson-39/+59
2024-01-07improve intro and `Unpin`-related discussionGray Olson-67/+145
2024-01-07update doubly linked list commentary and fix linksGray Olson-19/+26
2024-01-07fix one more broken linkGray Olson-1/+1
2024-01-07fix broken linksGray Olson-2/+2
2024-01-07Fix examples, finish polishingGray Olson-48/+87
2024-01-07mostly doneGray Olson-348/+359
2024-01-07Rewrite `Pin<P>` docs to clarify guarantees and usesMiguel Young de la Sota-214/+605
The documentation today does not give a complete treatment of pinning from first principles, which appropriately describes how to design types that use it, nor does it provide formal statements of the guarantees users need to be aware of. This rewrite attempts to address these in a way that makes the concept more approachable while also making the documentation more normative.
2024-01-06Rollup merge of #119657 - cls:slice_split_once-typo, r=ChrisDentonMichael Goulet-2/+2
Fix typo in docs for slice::split_once, slice::rsplit_once This fixes a typo in the doc comments for these methods, which I tripped over while reading the docs: "If any matching elements are **resent** in the slice [...]", which is presumably meant to read **present**. I mentioned this in #112811, the tracking issue for `slice_split_once`, and was encouraged to open a PR.
2024-01-06Rollup merge of #119656 - RalfJung:round-docs, r=Mark-SimulacrumMichael Goulet-6/+12
document rounding behavior of rint/nearbyint for ties It's not possible to change the rounding mode in Rust, so these intrinsics will always behave like `roundeven`.
2024-01-06Auto merge of #119599 - marthadev:position, r=the8472bors-6/+13
Rewrite Iterator::position default impl Storing the accumulating value outside the fold in an attempt to improve code generation has shown speedups on various handwritten benchmarks, see discussion at #119551.
2024-01-06Rollup merge of #119624 - petrochenkov:dialoc4, r=compiler-errorsMatthias Krüger-0/+1
rustc_span: More consistent span combination operations Also add more tests for using `tt` in addition to `ident`, and some other minor tweaks, see individual commits. This is a part of https://github.com/rust-lang/rust/pull/119412 that doesn't yet add side tables for metavariable spans.
2024-01-06Rollup merge of #119595 - mbbill:patch-1, r=Mark-SimulacrumMatthias Krüger-1/+1
Fixed ambiguity in hint.rs Needle and haystack are actually not the same, they remain constant.
2024-01-06Rollup merge of #118781 - RalfJung:core-panic-feature, r=the8472Matthias Krüger-23/+23
merge core_panic feature into panic_internals I don't know why those are two separate features, but it does not seem intentional. This merge is useful because with https://github.com/rust-lang/rust/pull/118123, panic_internals is recognized as an internal feature, but core_panic is not -- but core_panic definitely should be internal.
2024-01-06Add assume into `NonZeroIntX::get`AngelicosPhosphoros-4/+18
LLVM currently don't support range metadata for function arguments so it fails to optimize non zero integers using their invariant if they are provided using by-value function arguments. Related to https://github.com/rust-lang/rust/issues/119422 Related to https://github.com/llvm/llvm-project/issues/76628 Related to https://github.com/rust-lang/rust/issues/49572
2024-01-06document rounding behavior of rint/nearbyint for tiesRalf Jung-6/+12
2024-01-06Fix typo in docs for slice::split_once, slice::rsplit_onceConnor Lane Smith-2/+2
2024-01-05Rollup merge of #119216 - weiznich:use_diagnostic_namespace_in_stdlib, ↵Michael Goulet-30/+31
r=compiler-errors Use diagnostic namespace in stdlib This required a minor fix to have the diagnostics shown in third party crates when the `diagnostic_namespace` feature is not enabled. See https://github.com/rust-lang/rust/pull/119216/commits/5d63f5d8d1a72167c1d5242b2e1ed5b7259fd526 for details. I've opted for having a single PR for both changes as it's really not that much code. If it is required it should be easy to split up the change into several PR's. r? `@compiler-errors`
2024-01-05Remove feature not required by `Ipv6Addr::to_cononical` doctestEthan Brierley-1/+0
The feature does not seem to be required by this doctest.
2024-01-05library: Add `allow(unused_assignments)` to custom MIR doctestVadim Petrochenkov-0/+1
The lint is not yet reported due to span issues, but will be reported later.
2024-01-05Rollup merge of #119583 - AngelicosPhosphoros:const_assume, r=RalfJungMichael Goulet-2/+1
Make `intrinsics::assume` const stable Closes https://github.com/rust-lang/rust/issues/76972 Blocks https://github.com/rust-lang/rust/pull/119452 Approved in https://github.com/rust-lang/rust/pull/119452#issuecomment-1875741678 r? `@RalfJung`
2024-01-05Fix #119551: Rewrite Iterator::position default impl, storing the ↵martha-6/+13
accumulating value outside of the fold in an attempt to improve code generation Squashed with: Add inheriting overflow checks back
2024-01-05Replace some usage of `#[rustc_on_unimplemented]` withGeorg Semmler-30/+31
`#[diagnostic::on_unimplemented]` This commit replaces those `#[rustc_on_unimplemented]` attributes with their equivalent `#[diagnostic::on_unimplemented]` where this is supported (So no filter or any extended option)
2024-01-05Fix a typo in core::ops::Deref's docLaura Demkowicz-Duffy-1/+1
2024-01-04Fixed ambiguity in hint.rsMing, Bai-1/+1
Needle and haystack are actually not the same, they remain constant.
2024-01-04Make `intrinsics::assume` const stableAngelicosPhosphoros-2/+1
Closes https://github.com/rust-lang/rust/issues/76972 Blocks https://github.com/rust-lang/rust/pull/119452 Approved in https://github.com/rust-lang/rust/pull/119452#issuecomment-1875741678
2024-01-04Rollup merge of #119532 - GKFX:offset-of-parse-expr, r=est31Matthias Krüger-0/+10
Make offset_of field parsing use metavariable which handles any spacing As discussed at and around comments https://github.com/rust-lang/rust/issues/106655#issuecomment-1793485081 and https://github.com/rust-lang/rust/issues/106655#issuecomment-1793774183, the current arguments to offset_of do not accept all the whitespace combinations: `0. 1.1.1` and `0.1.1. 1` are currently treated specially in `tests/ui/offset-of/offset-of-tuple-nested.rs`. They also do not allow [forwarding individual fields as in](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=444cdf0ec02b99e8fd5fd8d8ecb312ca) ```rust macro_rules! off { ($a:expr) => { offset_of!(m::S, 0. $a) } } ``` This PR replaces the macro arguments with `($Container:ty, $($fields:expr)+ $(,)?)` which does allow any arrangement of whitespace that I could come up with and the forwarding of fields example above. This also allows for array indexing in the future, which I think is the last future extension to the syntax suggested in the offset_of RFC. Tracking issue for offset_of: #106655 ``@rustbot`` label F-offset_of ``@est31``
2024-01-04Rollup merge of #119325 - RalfJung:custom-mir, r=compiler-errorsMatthias Krüger-12/+45
custom mir: make it clear what the return block is Custom MIR recently got support for specifying the "unwind action", so now there's two things coming after the actual call part of `Call` terminators. That's not very self-explaining so I propose we change the syntax to imitate keyword arguments: ``` Call(popped = Vec::pop(v), ReturnTo(drop), UnwindContinue()) ``` Also fix some outdated docs and add some docs to `Call` and `Drop`.
2024-01-02Make offset_of field parsing use metavariable which handles any spacingGeorge Bateman-0/+10
2023-12-31Clarify ambiguity in select_nth_unstable docsBrian Romanowski-7/+7
2023-12-31Initial implementation of `str::from_raw_parts[_mut]`Sky-1/+42
2023-12-30Rollup merge of #119424 - ojeda:send-sync, r=est31Matthias Krüger-1/+3
Primitive docs: fix confusing `Send` in `&T`'s list The two lists in this document describe what traits are implemented on references when their underlying `T` also implements them. However, while it is true that `T: Send + Sync` implies `&T: Send` (which is what the sentence is trying to explain), it is confusing to have `Send` in the list because `T: Send` is not needed for that. In particular, the "also require" part may be interpreted as "both `T: Send` and `T: Sync` are required". Instead, move `Send` back to where it was before commit 7a477869b72e ("Makes docs for references a little less confusing"), i.e. to the `&mut` list (where no extra nota is needed, i.e. it fits naturally) and move the `Sync` definition/note to the bottom as something independent.
2023-12-29Primitive docs: fix confusing `Send` in `&T`'s listMiguel Ojeda-1/+3
The two lists in this document describe what traits are implemented on references when their underlying `T` also implements them. However, while it is true that `T: Send + Sync` implies `&T: Send` (which is what the sentence is trying to explain), it is confusing to have `Send` in the list because `T: Send` is not needed for that. In particular, the "also require" part may be interpreted as "both `T: Send` and `T: Sync` are required". Instead, move `Send` back to where it was before commit 7a477869b72e ("Makes docs for references a little less confusing"), i.e. to the `&mut` list (where no extra nota is needed, i.e. it fits naturally) and move the `Sync` definition/note to the bottom as something independent. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-12-28fix typoEmil Gardström-1/+1
2023-12-26custom mir: better type-checkingRalf Jung-7/+9
2023-12-26custom mir: make it clear what the return block isRalf Jung-9/+40
2023-12-26explain what crates should do when adding comparison with foreign typesRalf Jung-0/+38
2023-12-26PartialOrd: transitivity and duality are required only if the corresponding ↵Ralf Jung-6/+10
impls exist
2023-12-26PartialEq: handle longer transitive chainsRalf Jung-2/+4
2023-12-26Auto merge of #119133 - scottmcm:assert-unchecked, r=thomccbors-1/+49
Add `hint::assert_unchecked` Libs-API expressed interest, modulo bikeshedding, in https://github.com/rust-lang/libs-team/issues/315#issuecomment-1863159430 I think that means this is good for nightly, since we can always rename it before stabilization. Tracking issue: https://github.com/rust-lang/rust/issues/119131
2023-12-25select AsyncFn traits during overloaded call opMichael Goulet-0/+3
2023-12-25We do not need impl_trait_in_assoc_tyMichael Goulet-7/+6