about summary refs log tree commit diff
path: root/library/core/src/task
AgeCommit message (Collapse)AuthorLines
2025-09-01Constify conversion traitsltdk-2/+4
2025-08-20fix: typoTuomas Tajakka-1/+1
The return type is correct in the source code but incorrect in the docstring
2025-06-13Rollup merge of #142158 - xizheyin:141617, r=jdonszelmannMatthias Krüger-4/+4
Tracking the old name of renamed unstable library features This PR resolves the first problem of rust-lang/rust#141617 : tracking renamed unstable features. The first commit is to add a ui test, and the second one tracks the changes. I will comment on the code for clarification. r? `@jdonszelmann` There have been a lot of PR's reviewed by you lately, thanks for your time! cc `@jyn514`
2025-06-12Tracking the old name of renamed unstable library attributexizheyin-4/+4
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-12Allow `unpredictable_function_pointer_comparisons` lint in more placesUrgau-0/+1
2025-03-06Remove #[cfg(not(test))] gates in coreThalia Archibald-1/+1
These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-02-15docs: fix broken intra-doc links that never workedMichael Howell-5/+2
2025-01-08update version placeholdersPietro Albini-3/+3
2024-12-17Use field init shorthand where possibleJosh Triplett-1/+1
Field init shorthand allows writing initializers like `tcx: tcx` as `tcx`. The compiler already uses it extensively. Fix the last few places where it isn't yet used.
2024-12-09Remove rustc_const_stable attribute on const NOOPEric Holk-1/+0
This was accidentally reintroduced while editing #133089.
2024-12-05Stabilize noop_wakerEric Holk-8/+5
Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com>
2024-11-27update cfgsBoxy-2/+0
2024-11-02get rid of a whole bunch of unnecessary rustc_const_unstable attributesRalf Jung-7/+0
2024-10-25Re-do recursive const stability checksRalf Jung-2/+2
Fundamentally, we have *three* disjoint categories of functions: 1. const-stable functions 2. private/unstable functions that are meant to be callable from const-stable functions 3. functions that can make use of unstable const features This PR implements the following system: - `#[rustc_const_stable]` puts functions in the first category. It may only be applied to `#[stable]` functions. - `#[rustc_const_unstable]` by default puts functions in the third category. The new attribute `#[rustc_const_stable_indirect]` can be added to such a function to move it into the second category. - `const fn` without a const stability marker are in the second category if they are still unstable. They automatically inherit the feature gate for regular calls, it can now also be used for const-calls. Also, several holes in recursive const stability checking are being closed. There's still one potential hole that is hard to avoid, which is when MIR building automatically inserts calls to a particular function in stable functions -- which happens in the panic machinery. Those need to *not* be `rustc_const_unstable` (or manually get a `rustc_const_stable_indirect`) to be sure they follow recursive const stability. But that's a fairly rare and special case so IMO it's fine. The net effect of this is that a `#[unstable]` or unmarked function can be constified simply by marking it as `const fn`, and it will then be const-callable from stable `const fn` and subject to recursive const stability requirements. If it is publicly reachable (which implies it cannot be unmarked), it will be const-unstable under the same feature gate. Only if the function ever becomes `#[stable]` does it need a `#[rustc_const_unstable]` or `#[rustc_const_stable]` marker to decide if this should also imply const-stability. Adding `#[rustc_const_unstable]` is only needed for (a) functions that need to use unstable const lang features (including intrinsics), or (b) `#[stable]` functions that are not yet intended to be const-stable. Adding `#[rustc_const_stable]` is only needed for functions that are actually meant to be directly callable from stable const code. `#[rustc_const_stable_indirect]` is used to mark intrinsics as const-callable and for `#[rustc_const_unstable]` functions that are actually called from other, exposed-on-stable `const fn`. No other attributes are required.
2024-10-15replace placeholder versionJosh Stone-4/+4
(cherry picked from commit 567fd9610cbfd220844443487059335d7e1ff021)
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-19[Clippy] Swap `waker_clone_wake` to use diagnostic item instead of pathGnomedDev-0/+1
2024-09-07Auto merge of #129941 - BoxyUwU:bump-boostrap, r=albertlarsan68bors-5/+5
Bump boostrap compiler to new beta Accidentally left some comments on the update cfgs commit directly xd
2024-09-03replace placeholder versionBoxy-5/+5
2024-09-02Add `Waker::new` and `LocalWaker::new`Kevin Mehall-0/+55
Per the `waker_getters` FCP: https://github.com/rust-lang/rust/issues/96992#issuecomment-1941998046 Docs largely copied from `RawWaker::new`.
2024-09-02Stabilize waker_gettersKevin Mehall-4/+4
2024-09-02Move the `data` and `vtable` methods from `RawWaker` to `Waker`Kevin Mehall-22/+22
Per the `waker_getters` FCP: https://github.com/rust-lang/rust/issues/96992#issuecomment-1941998046
2024-08-25link to Future::poll from the Poll docsJack O'Connor-0/+2
The most important thing about Poll is that Future::poll returns it, but previously the docs didn't emphasize this.
2024-08-15Rollup merge of #128064 - ijackson:noop-waker-doc, r=workingjubileeJubilee-1/+19
Improve docs for Waker::noop and LocalWaker::noop * Add a warning about a likely misuse. (See my commit message for longer rationale.) * Apply some probably-accidentally-omitted changes to `LocalWaker`'s docs * Add a comment about the clone-and-hack of the docs I have used [semantic linefeeds](https://rhodesmill.org/brandon/2012/one-sentence-per-line/) for the docs formatting.
2024-08-15Add cautionary paragraph about noop wakers.Ian Jackson-0/+8
Based on a suggestion from @kpreid, with some further editing.
2024-08-09make LocalWaker::will_wake consistent with Waker::will_wakeRalf Jung-1/+7
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28Rollup merge of #128228 - slanterns:const_waker, r=dtolnay,oli-obkGuillaume Gomez-12/+12
Stabilize `const_waker` Closes: https://github.com/rust-lang/rust/issues/102012. For `local_waker` and `context_ext` related things, I just ~~moved them to dedicated feature gates and reused their own tracking issue (maybe it's better to open a new one later, but at least they should not be tracked under https://github.com/rust-lang/rust/issues/102012 from the beginning IMO.)~~ reused their own feature gates as suggested by ``@tgross35.`` ``@rustbot`` label: +T-libs-api r? libs-api
2024-07-28stabilize const_wakerSlanterns-12/+12
2024-07-26Fix doc nitsJohn Arundel-16/+17
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-07-24Rollup merge of #128046 - GrigorenkoPV:90435, r=tgross35Matthias Krüger-2/+2
Fix some `#[cfg_attr(not(doc), repr(..))]` Now that #90435 seems to have been resolved.
2024-07-22LocalWaker docs: Make long-ago omitted but probably intended changesIan Jackson-1/+3
In 6f8a944ba4311cbcf5922132721095c226c6fbab, titled Change return type of unstable `Waker::noop()` from `Waker` to `&Waker`. the summary line for Waker was changed: - /// Creates a new `Waker` that does nothing when `wake` is called. + /// Returns a reference to a `Waker` that does nothing when used. and the sentence about clone was added. LocalWaker's docs were not changed, even though the types were, but there is no explanation for why not. It seems like it was simply a slip induced by the clone-and-hack.
2024-07-22Docs for Waker and LocalWaker: Add cross-refs in commentIan Jackson-0/+8
2024-07-22Fix some `#[cfg_attr(not(doc), repr(..))]`Pavel Grigorenko-2/+2
Now that #90435 seems to have been resolved.
2024-07-15lib: replace some `mem::forget`'s with `ManuallyDrop`Pavel Grigorenko-10/+5
2024-06-21Remove `feature(effects)` from the standard libraryDeadbeef-2/+2
2024-05-21Wrap Context.ext in AssertUnwindSafeJubilee Young-4/+7
2024-04-17Rollup merge of #122201 - coolreader18:doc-clone_from, r=dtolnayMatthias Krüger-0/+36
Document overrides of `clone_from()` in core/std As mentioned in https://github.com/rust-lang/rust/pull/96979#discussion_r1379502413 Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source". I reused some of the wording over and over for similar impls, but I'm not sure that the wording is actually *good*. Would appreciate feedback about that. Also, now some of these seem to provide pretty specific guarantees about behavior (e.g. will reuse the exact same allocation iff the len is the same), but I was basing it off of the docs for [`Box::clone_from`](https://doc.rust-lang.org/1.75.0/std/boxed/struct.Box.html#method.clone_from-1) - I'm not sure if providing those strong guarantees is actually good or not.
2024-04-02set tracking issueJustin Karneges-4/+4
2024-03-29rustfmtJustin Karneges-2/+14
2024-03-29Add `Context::ext`Justin Karneges-3/+52
2024-03-09fix: remove memory leak due to missing drop implementation for local waker. ↵Tomás Vallotton-5/+16
Also, fix some of the stability attributes of LocalWaker's methods.
2024-03-08Document overrides of `clone_from()`Noa-0/+36
Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source".
2024-02-15Auto merge of #119863 - tmiasko:will-wake, r=m-ou-sebors-1/+3
Waker::will_wake: Compare vtable address instead of its content Optimize will_wake implementation by comparing vtable address instead of its content. The existing best practice to avoid false negatives from will_wake is to define a waker vtable as a static item. That approach continues to works with the new implementation. While this potentially changes the observable behaviour, the function is documented to work on a best-effort basis. The PartialEq impl for RawWaker remains as it was.
2024-02-14Rollup merge of #116387 - kpreid:wake-doc, r=cuviperOli Scherer-3/+17
Additional doc links and explanation of `Wake`. This is intended to clarify: * That `Wake` exists and can be used instead of `RawWaker`. * How to construct a `Waker` when you are looking at `Wake` (which was previously only documented in the example).
2024-02-11add comparison warning to RawWakerVTable as wellRalf Jung-0/+6
2024-02-10Additional doc links and explanation of `Wake`.Kevin Reid-3/+17
This is intended to clarify: * That `Wake` exists and can be used instead of `RawWaker`. * How to construct a `Waker` when you are looking at `Wake` (which was previously only documented in the example).
2024-01-20doc: fix some doctests after rebaseTomás Vallotton-3/+3
2024-01-20refactor: make waker mandatory.Tomás Vallotton-81/+18
This also removes * impl From<&Context> for ContextBuilder * Context::try_waker() The from implementation is removed because now that wakers are always supported, there are less incentives to override the current context. Before, the incentive was to add Waker support to a reactor that didn't have any.
2024-01-20chore: make method order consistent with wakerTomás Vallotton-13/+13