summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2023-04-16replace version placeholdersPietro Albini-39/+39
2023-04-14Rollup merge of #110244 - kadiwa4:unnecessary_imports, r=JohnTitorMatthias Krüger-12/+1
Remove some unneeded imports / qualified paths Continuation of #105537.
2023-04-14Rollup merge of #110154 - DaniPopes:library-typos, r=JohnTitorMatthias Krüger-3/+3
Fix typos in library I ran [`typos -w library`](https://github.com/crate-ci/typos) to fix typos in the `library` directory. Refs #110150
2023-04-14Rollup merge of #110110 - lukas-code:display-panic-info, r=JohnTitorMatthias Krüger-6/+2
Use `Display` in top-level example for `PanicInfo` Addresses https://github.com/rust-lang/rust/issues/110098. This confused me as well, when I was writing a `no_std` panic handler for the first time, so here's a better top-level example. `Display` is stable, prints the `.message()` if available, and falls back to `.payload().downcast_ref<&str>()` if the message is not available. So this example should provide strictly more information and also work for formatted panics. The old example still exists on the `payload` method.
2023-04-14Rollup merge of #109947 - clubby789:cmp-macro-crosslink, r=JohnTitorMatthias Krüger-4/+7
Add links from `core::cmp` derives to their traits Fixes #109946 Adds intra-doc links from the `core::cmp` derives to their respective traits, and a link to their derive behaviour `@rustbot` label +A-docs
2023-04-14Rollup merge of #110269 - scottmcm:sort-features, r=jyn514Yuki Okushi-22/+28
Add `tidy-alphabetical` to features in `core` So that people have to keep them sorted in future, rather than just sticking them on the end where they conflict more often.
2023-04-14Auto merge of #101959 - Xaeroxe:clamp-better-assert, r=ChrisDentonbors-2/+2
Add better assert messages for f32/f64 clamps
2023-04-14Rollup merge of #109800 - bryangarza:safe-transmute-improved-errors, ↵Matthias Krüger-4/+0
r=compiler-errors Improve safe transmute error reporting This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-13Improve safe transmute error reportingBryan Garza-4/+0
This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-13Rollup merge of #110259 - ndrewxie:issue-109964-fix-gitstuff, r=cjgillotMatthias Krüger-1/+1
Added diagnostic for pin! macro in addition to Box::pin if Unpin isn't implemented I made a PR earlier, but accidentally renamed a branch and that deleted the PR... sorry for the duplicate Currently, if an operation on `Pin<T>` is performed that requires `T` to implement `Unpin`, the diagnostic suggestion is to use `Box::pin` ("note: consider using `Box::pin`"). This PR suggests pin! as well, as that's another valid way of pinning a value, and avoids a heap allocation. Appropriate diagnostic suggestions were included to highlight the difference in semantics (local pinning for pin! vs non-local for Box::pin). Fixes #109964
2023-04-13Rollup merge of #110233 - nbdd0121:intrinsic, r=tmiaskoMatthias Krüger-1/+235
Make rust-intrinsic ABI unwindable Fix #104451, fix https://github.com/rust-lang/miri/issues/2839 r? `@RalfJung`
2023-04-13Document catch_fn in r#try cannot unwindGary Guo-0/+2
2023-04-13Add `tidy-alphabetical` to features in `core`Scott McMurray-22/+28
So that people have to keep them sorted in future.
2023-04-12Update unwind_safe.rsJustin Symonds-1/+1
Typo in the documentation.
2023-04-12Added diagnostic for pin! macro in addition to Box::pin if Unpin isn't ↵Andrew Xie-1/+1
implemented
2023-04-12remove some unneeded importsKaDiWa-12/+1
2023-04-12Rollup merge of #110190 - cbeuw:mir-offset, r=oli-obkMatthias Krüger-0/+2
Custom MIR: Support `BinOp::Offset` Since offset doesn't have an infix operator, a new function `Offset` is added which is lowered to `Rvalue::BinaryOp(BinOp::Offset, ..)` r? ```@oli-obk``` or ```@tmiasko``` or ```@JakobDegen```
2023-04-12Make rust-intrinsic ABI unwindableGary Guo-1/+233
Stick `#[rustc_nounwind]` to all except `const_eval_select` to undo the change for all other intrinsics.
2023-04-11Rollup merge of #110104 - kormosi:todo_typo, r=cuviperMichael Goulet-2/+2
Reword the docstring in todo! macro definition, fixing a typo
2023-04-11Reword the docstring in todo! macro definitionPatrik Kormosi-2/+2
2023-04-11Add Offset binary op to custom mirAndy Wang-0/+2
2023-04-11Rollup merge of #110070 - scottmcm:wrapping-neg, r=cuviperYuki Okushi-5/+4
The `wrapping_neg` example for unsigned types shouldn't use `i8` Probably it should have at least one example with an unsigned type.
2023-04-10Fix typos in libraryDaniPopes-3/+3
2023-04-10Auto merge of #107007 - TDecking:float_parsing_improvments, r=Mark-Simulacrumbors-287/+187
Improve the floating point parser in dec2flt. Greetings everyone, I've benn studying the rust floating point parser recently and made the following tweaks: * Remove all remaining traces of `unsafe`. The parser is now 100% safe Rust. * The trick in which eight digits are processed in parallel is now in a loop. * Parsing of inf/NaN values has been reworked. On my system, the changes result in performance improvements for some input values.
2023-04-10Rollup merge of #110044 - scottmcm:more-size-of-val, r=ChrisDentonDylan DPC-12/+4
Avoid some manual slice length calculation No need for us to write the multiplication when `size_of_val` does exactly what we need. (https://github.com/rust-lang/rust-clippy/pull/10601)
2023-04-10Improve the floating point parser in `dec2flt`.Tobias Decking-287/+187
* Remove all remaining traces of unsafe. * Put `parse_8digits` inside a loop. * Rework parsing of inf/NaN values.
2023-04-09Auto merge of #109684 - fee1-dead-contrib:rv_const_range, r=Mark-Simulacrumbors-45/+16
Revert #104100, Allow using `Range` as an `Iterator` in const contexts. This fixes #109632.
2023-04-09Use `Display` in top-level example for `PanicInfo`Lukas Markeffsky-6/+2
2023-04-09Fix typo in todo! macro docstringPatrik Kormosi-1/+1
2023-04-09Auto merge of #110101 - JohnTitor:rollup-ol20aw7, r=JohnTitorbors-0/+1
Rollup of 6 pull requests Successful merges: - #110058 (Remove `box_syntax` usage) - #110059 (ignore_git → omit_git_hash) - #110060 (Document that `&T` and `&mut T` are `Sync` if `T` is) - #110074 (Make the "codegen" profile of `config.toml` download and build llvm from source.) - #110086 (Add `max_line_length` to `.editorconfig`, matching rustfmt) - #110096 (Tweak tuple indexing suggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-09Rollup merge of #110060 - WaffleLapkin:sync_refs, r=jyn514Yuki Okushi-0/+1
Document that `&T` and `&mut T` are `Sync` if `T` is Proof: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fec8dc9ec36e873bf2962a2367d67045
2023-04-08Enforce that PointerLike requires a pointer-like ABIMichael Goulet-1/+1
2023-04-08Revert "Make the `Step` implementations const."Deadbeef-17/+7
This reverts commit 7bc67ef6e02d69023c6fb04c2258beab54ac22b8.
2023-04-08Revert "Mark DoubleEndedIterator as #[const_trait] using ↵Deadbeef-28/+9
rustc_do_not_const_check, implement const Iterator and DoubleEndedIterator for Range." This reverts commit 8a9d6bf4fd540b2a2882193cbd6232b86e5dcd7e.
2023-04-07The `wrapping_neg` example for unsigned types shouldn't use `i8`Scott McMurray-5/+4
2023-04-07Fix wrong type in docs: i16 -> u16Jörn Bethune-1/+1
@rustbot label +A-docs r? docs
2023-04-07Document that `&T` and `&mut T` are `Sync` if `T` isMaybe Waffle-0/+1
2023-04-07Avoid some manual slice length calculationScott McMurray-12/+4
No need for us to write the multiplication when `size_of_val` does exactly what we need.
2023-04-07Inline try_from and try_intoTomasz Miąsko-0/+2
To avoid link time dependency between core and compiler-builtins, when using opt-level that implicitly enables -Zshare-generics. While compiler-builtins should be compiled with -Zshare-generics disabled, the -Zbuild-std does not ensure this at the moment.
2023-04-06Stabilize is_some_andJonas Platte-8/+3
2023-04-05Auto merge of #94786 - joshlf:patch-5, r=dtolnaybors-0/+7
Document NonZeroXxx layout guarantees Document that `NonZeroXxx` has the same layout and bit validity as `Xxx` with the exception of `0`.
2023-04-04Add links from `core::cmp` derives to their traitsclubby789-4/+7
2023-04-03Add links to <cell.rs>Sergey Kaunov-1/+1
`UnsafeCell` page could benefit too from having links to these most popular structs in the module.
2023-04-02Rollup merge of #109839 - sartak:iter-grammar, r=scottmcmNilstrieb-2/+2
Improve grammar of Iterator.partition_in_place This is my first PR against Rust, please let me know if there's anything I should be providing here! I didn't find any instructions specific to documentation grammar in the [std-dev guide](https://std-dev-guide.rust-lang.org/documentation/summary.html).
2023-04-01Auto merge of #109483 - joboet:optimize_lazycell, r=Mark-Simulacrumbors-11/+77
Optimize `LazyCell` size `LazyCell` can only store either the initializing function or the data it produces, so it does not need to reserve the space for both. Similar to #107329, but uses an `enum` instead of a `union`.
2023-04-01Improve grammar of Iterator.partition_in_placeShawn M Moore-2/+2
b9535c0b7d6 Auto merge of #109801 - aliemjay:test-implied-normalization, r=petrochenkov
2023-03-31Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddleGuillaume Gomez-25/+50
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes` Fixes #88070. It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem. r? `@jyn514`
2023-03-31Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obkbors-0/+14
Insert alignment checks for pointer dereferences when debug assertions are enabled Closes https://github.com/rust-lang/rust/issues/54915 - [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit) - [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue! - [x] Implement a more helpful panic message like slice bounds checking. r? `@oli-obk`
2023-03-30Replace doc(primitive) with rustc_doc_primitiveGuillaume Gomez-25/+50
2023-03-30add comment to `impl !Error for &str`Lukas Markeffsky-0/+1