about summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2023-01-09Remove unstable featureCaio-8/+0
2023-01-09Stabilize `nonzero_min_max`Caio-4/+4
2023-01-09Relocate changesFabian Hintringer-12/+12
2023-01-08Rollup merge of #104163 - H4x5:once-repeat-with-debug, r=dtolnayMichael Goulet-2/+22
Don't derive Debug for `OnceWith` & `RepeatWith` Closures don't impl Debug, so the derived impl is kinda useless. The behavior of not debug-printing closures is consistent with the rest of the iterator adapters/sources.
2023-01-07Improve the documentation of `black_box`Trevor Gross-0/+69
2023-01-07Rollup merge of #106564 - Folyd:feat-repeatn, r=scottmcmMatthias Krüger-1/+1
Change to immutable borrow when cloning element of RepeatN
2023-01-07Rollup merge of #104081 - joshlf:patch-6, r=dtolnayMatthias Krüger-0/+6
PhantomData layout guarantees
2023-01-07Don't derive Debug for `OnceWith` & `RepeatWith`Sky-2/+22
2023-01-07Change to immutable borrow when cloning element of RepeatNFolyd-1/+1
2023-01-06Remove HTML tags around warningGijs Burghoorn-6/+0
2023-01-05Better phrasing for hygiene of include macroGijs Burghoorn-4/+5
2023-01-04Link to Option/Result for `Iterator::sum/product`clubby789-0/+6
2023-01-04Tidy up whitespaceGijs Burghoorn-11/+11
2023-01-04Improve include macro documentationGijs Burghoorn-20/+44
2023-01-04Rollup merge of #106200 - compiler-errors:suggest-impl-trait, r=estebankMatthias Krüger-0/+1
Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions Follow-up to #106172, only the last commit is relevant. Can rebase once that PR is landed for easier review. Suggests `impl Future` and `impl Fn{,Mut,Once}` in `-> _` return suggestions. r? `@estebank`
2023-01-03Rollup merge of #106045 - RalfJung:oom-nounwind-panic, r=AmanieuMichael Goulet-6/+17
default OOM handler: use non-unwinding panic, to match std handler The OOM handler in std will by default abort. This adjusts the default in liballoc to do the same, using the `can_unwind` flag on the panic info to indicate a non-unwinding panic. In practice this probably makes little difference since the liballoc default will only come into play in no-std situations where people write a custom panic handler, which most likely will not implement unwinding. But still, this seems more consistent. Cc `@rust-lang/wg-allocators,` https://github.com/rust-lang/rust/issues/66741
2023-01-03Suggest more impl Trait on `-> _`Michael Goulet-0/+1
2023-01-03Added error documentation for write_fmtAlexander Shirokov-0/+5
This continuation of work at rust-lang#98861
2023-01-03Auto merge of #95644 - WaffleLapkin:str_split_as_str_refactor_take2, r=Amanieubors-84/+104
`Split*::as_str` refactor I've made this patch almost a year ago, so the rename and the behavior change are in one commit, sorry 😅 This fixes #84974, as it's required to make other changes work. This PR - Renames `as_str` method of string `Split*` iterators to `remainder` (it seems like the `as_str` name was confusing to users) - Makes `remainder` return `Option<&str>`, to distinguish between "the iterator is exhausted" and "the tail is empty", this was [required on the tracking issue](https://github.com/rust-lang/rust/issues/77998#issuecomment-832696619) r? `@m-ou-se`
2023-01-02Add PhantomData marker to Context to make Context !Send and !SyncJames Higgins-1/+4
2023-01-02default OOM handler: use non-unwinding panic (unless -Zoom=panic is set), to ↵Ralf Jung-6/+17
match std handler
2022-12-31Auto merge of #106275 - Nilstrieb:const-eval-select-me-some-compile-time, ↵bors-22/+66
r=thomcc Use some more `const_eval_select` in pointer methods for compile times Builds on top of #105435 `is_aligned_to` is _huge_ with calling `align_offset`, so this should cut it down a lot. This shows up in https://github.com/rust-lang/rust/issues/65031#issuecomment-1367574340
2022-12-30Rollup merge of #106248 - dtolnay:revertupcastlint, r=jackh726Michael Goulet-3/+0
Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint" This is a clean revert of #105484. I confirmed that reverting that PR fixes the regression reported in #106247. ~~I can't say I understand what this code is doing, but maybe it can be re-landed with a different implementation.~~ **Edit:** https://github.com/rust-lang/rust/issues/106247#issuecomment-1367174384 has an explanation of why #105484 ends up surfacing spurious `where_clause_object_safety` errors. The implementation of `where_clause_object_safety` assumes we only check whether a trait is object safe when somebody actually uses that trait with `dyn`. However the implementation of `multiple_supertrait_upcastable` added in the problematic PR involves checking *every* trait for whether it is object-safe. FYI `@nbdd0121` `@compiler-errors`
2022-12-30Stabilize f16c_target_featureKathryn Long-1/+1
2022-12-30Auto merge of #105651 - tgross35:once-cell-inline, r=m-ou-sebors-1/+16
Add #[inline] markers to once_cell methods Added inline markers to all simple methods under the `once_cell` feature. Relates to #74465 and #105587 This should not block #105587
2022-12-30Rollup merge of #103707 - jonathanCogan:master, r=m-ou-seMatthias Krüger-33/+33
Replace libstd, libcore, liballoc terminology in docs Fixes #103551. I changed line comments containing the outdated terms as well. It would be great if someone with more experience could weigh in on whether these changes introduce ambiguity as suggested in https://github.com/rust-lang/rust/issues/103551#issuecomment-1291225315.
2022-12-30Rollup merge of #99244 - gthb:doc-improve-iterator-scan, r=m-ou-seMatthias Krüger-6/+11
doc: clearer and more correct Iterator::scan The `Iterator::scan` documentation seemed a little misleading to my newcomer eyes, and this tries to address that. * I found “similar to `fold`” unhelpful because (a) the similarity is only that they maintain state between iterations, and (b) the _dissimilarity_ is no less important: one returns a final value and the other an iterator. So this replaces that with “which, like `fold`, holds internal state, but unlike `fold`, produces a new iterator. * I found “the return value from the closure, an `Option`, is yielded by the iterator” to be downright incorrect, because “yielded by the iterator” means “returned by the `next` method wrapped in `Some`”, so this implied that `scan` would convert an input iterator of `T` to an output iterator of `Option<T>`. So this replaces “yielded by the iterator” with “returned by the `next` method” and elaborates: “Thus the closure can return `Some(value)` to yield `value`, or `None` to end the iteration.” * This also changes the example to illustrate the latter point by returning `None` to terminate the iteration early based on `state`.
2022-12-30Use some more `const_eval_select` in pointer methods for compile timesNilstrieb-22/+66
2022-12-30Update paths in comments.jonathanCogan-1/+1
2022-12-30Replace libstd, libcore, liballoc in line comments.jonathanCogan-17/+17
2022-12-30Replace libstd, libcore, liballoc in docs.jonathanCogan-15/+15
2022-12-30Auto merge of #106210 - fee1-dead-contrib:const-closure-trait-method, ↵bors-6/+12
r=compiler-errors Allow trait method paths to satisfy const Fn bounds r? `@oli-obk`
2022-12-29Revert "Implement allow-by-default multiple_supertrait_upcastable lint"David Tolnay-3/+0
This reverts commit 5e44a65517bfcccbe6624a70b54b9f192baa94f3.
2022-12-29Auto merge of #105741 - pietroalbini:pa-1.68-nightly, r=Mark-Simulacrumbors-575/+69
Bump master bootstrap compiler This PR bumps the bootstrap compiler to the beta created earlier this week, cherry-picks the stabilization version number updates, and updates the `cfg(bootstrap)`s. r? `@Mark-Simulacrum`
2022-12-28Rollup merge of #106161 - meithecatte:iter-find-position, r=Mark-SimulacrumMatthias Krüger-0/+3
Iterator::find: link to Iterator::position in docs for discoverability
2022-12-28fix custom mir doc testsLukas Markeffsky-2/+4
2022-12-28Update bootstrap cfgPietro Albini-539/+31
2022-12-28update stabilization version numbersPietro Albini-34/+34
2022-12-28Rollup merge of #106172 - estebank:suggest-impl-trait, r=compiler-errorsMatthias Krüger-0/+1
Suggest `impl Iterator` when possible for `_` return type Address #106096.
2022-12-28Auto merge of #106209 - fee1-dead-contrib:rollup-47ysdcu, r=fee1-deadbors-7/+5
Rollup of 9 pull requests Successful merges: - #94145 (Test leaking of BinaryHeap Drain iterators) - #103945 (Remove `iter::Empty` hack) - #104024 (Fix `unused_must_use` warning for `Box::from_raw`) - #104708 (Fix backoff doc to match implementation) - #105347 (Account for `match` expr in single line) - #105484 (Implement allow-by-default `multiple_supertrait_upcastable` lint) - #106184 (Fix `core::any` docs) - #106201 (Emit fewer errors on invalid `#[repr(transparent)]` on `enum`) - #106205 (Remove some totally duplicated files in `rustc_infer`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-28Allow trait method paths to satisfy const Fn boundsDeadbeef-6/+12
2022-12-28Rollup merge of #106184 - albertlarsan68:docs-106154, r=Nilstriebfee1-dead-1/+1
Fix `core::any` docs Thanks to ``@pbevin`` in #106154 Closes #106154 ``@rustbot`` labels +A-docs
2022-12-28Rollup merge of #105484 - nbdd0121:upcast, r=compiler-errorsfee1-dead-0/+3
Implement allow-by-default `multiple_supertrait_upcastable` lint The lint detects when an object-safe trait has multiple supertraits. Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them. r? `@nikomatsakis`
2022-12-28Rollup merge of #103945 - H4x5:remove-iter-empty-hack, r=compiler-errorsfee1-dead-6/+1
Remove `iter::Empty` hack `iter::Empty` uses a newtype to work around `#![feature(const_fn_fn_ptr_basics)]`, which has been stable since 1.61.0.
2022-12-28Auto merge of #103881 - ChayimFriedman2:patch-2, r=compiler-errorsbors-8/+9
Clarify docs of `RefCell` Comparison operators only panic if the `RefCell` is mutably borrowed, and `RefCell::swap()` can also panic if swapping a `RefCell` with itself.
2022-12-27Fix `core::any` mod-level docsAlbert Larsan-1/+1
2022-12-27Rollup merge of #106189 - alexhrao:master, r=NilstriebMichael Goulet-1/+1
Fix UnsafeCell Documentation Spelling Error This fixes the spelling of "deallocated" (instead of the original "deallocted") In the `cell.rs` source file. Honestly probably not worth the time to evaluate, but since it doesn't involve any code change, I figure why not?
2022-12-27Rollup merge of #106179 - RetroSeven:typo_fix, r=compiler-errorsMichael Goulet-1/+1
Fix a formatting error in Iterator::for_each docs There is a formatting error (extra space in an assignment) in the documentation of `core::iter::Iterator::for_each`, which I have fixed in this pull request.
2022-12-27Rollup merge of #103718 - matklad:infer-lazy, r=dtolnayMichael Goulet-3/+1
More inference-friendly API for lazy The signature for new was ``` fn new<F>(f: F) -> Lazy<T, F> ``` Notably, with `F` unconstrained, `T` can be literally anything, and just `let _ = Lazy::new(|| 92)` would not typecheck. This historiacally was a necessity -- `new` is a `const` function, it couldn't have any bounds. Today though, we can move `new` under the `F: FnOnce() -> T` bound, which gives the compiler enough data to infer the type of T from closure.
2022-12-27Fix UnsafeCell Documentation Spelling ErrorAlex Rao-1/+1
This fixes the spelling of "deallocated" (instead of the original "deallocted") In the `cell.rs` source file