about summary refs log tree commit diff
path: root/library/core/src/prelude
AgeCommit message (Collapse)AuthorLines
2025-08-18Remove the `From` derive macro from preludeJakub Beránek-7/+0
To avoid backwards compatibility problems.
2025-08-15Create unstable `From` builtin macro and register itJakub Beránek-0/+7
2025-07-17Make `derive_const` usable within libcore againOli Scherer-1/+1
Also make it *only* usable on nightly
2025-06-24Remove the deprecated `concat_idents!` macroTrevor Gross-2/+1
In [137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://www.github.com/rust-lang/rust/issues/29599 [137653]: https://www.github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://www.github.com/rust-lang/rust/issues/124225
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-04-24Deprecate the unstable `concat_idents!`Trevor Gross-0/+1
`concat_idents` has been around unstably for a long time, but there is now a better (but still unstable) way to join identifiers using `${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves a lot of the problems with `concat_idents` and is on a better track toward stabilization, so there is no need to keep both versions around. `concat_idents!` still has a lot of use in the ecosystem so deprecate it before removing, as discussed in [1]. Link: https://github.com/rust-lang/rust/issues/124225 [1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
2025-04-09update cfgsBoxy-1/+0
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+8
2025-02-24span: add a "future" editionDavid Wood-0/+23
It's hard to implement edition migrations without having a perma-unstable "future" edition to target.
2025-02-11Remove the common prelude moduleEric Huss-12/+6
This fixes the issues described in https://github.com/rust-lang/rust/issues/136102. Primarily, this resolves some issues with how the documentation for the prelude is generated: - It avoids showing "unstable" for macros in the prelude that are actually stable. - Avoids duplication of some pages due to the previous lack of `doc(no_inline)`. - Makes the different edition preludes consistent, and sets a pattern that can be used by future editions. We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems.
2025-02-02Rollup merge of #134272 - RalfJung:destabilize-rustc_encodable_decodable, ↵Matthias Krüger-10/+0
r=oli-obk Remove rustc_encodable_decodable feature This has been shown in future-compat reports since Rust 1.79 (https://github.com/rust-lang/rust/pull/116016), released June 2024. Let's see if crater still finds any issues. Part of https://github.com/rust-lang/rust/issues/134301. Cc ``@rust-lang/libs-api``
2025-01-22Add `AsyncFn*` to core preludeLukas Markeffsky-0/+3
2025-01-14remove Rustc{En,De}codable from library and compilerRalf Jung-9/+0
2025-01-14make rustc_encodable_decodable feature properly unstableRalf Jung-2/+1
2025-01-08update version placeholdersPietro Albini-2/+2
2024-12-11Stabilize the Rust 2024 preludeEric Huss-2/+2
2024-07-17Avoid comments that describe multiple `use` items.Nicholas Nethercote-0/+6
There are some comments describing multiple subsequent `use` items. When the big `use` reformatting happens some of these `use` items will be reordered, possibly moving them away from the comment. With this additional level of formatting it's not really feasible to have comments of this type. This commit removes them in various ways: - merging separate `use` items when appropriate; - inserting blank lines between the comment and the first `use` item; - outright deletion (for comments that are relatively low-value); - adding a separate "top-level" comment. We also entirely skip formatting for four library files that contain nothing but `pub use` re-exports, where reordering would be painful.
2024-07-17Merge some `core::iter` entries.Nicholas Nethercote-4/+1
2024-06-11replace version placeholderPietro Albini-1/+1
2024-05-13Add `size_of`, `size_of_val`, `align_of`, and `align_of_val` to the preludeJosh Triplett-0/+3
Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it. Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar justification: widely useful, self-explanatory, unmistakeable for anything else, won't produce conflicts.
2024-05-01Step bootstrap cfgsMark Rousskov-1/+0
2024-03-22Remove RustcEncodable/Decodable from 2024 preludeJacob Pratt-17/+31
2024-03-22Soft-destabilize `RustcEncodable`/`RustcDecodable`Jacob Pratt-1/+6
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-0/+8
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.
2024-02-18Add `Future` and `IntoFuture` to the 2024 preludeNilstrieb-2/+6
Implements RFC 3509.
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-1/+3
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-3/+1
2022-12-30Replace libstd, libcore, liballoc in docs.jonathanCogan-4/+4
2022-12-28Update bootstrap cfgPietro Albini-6/+3
2022-12-01Gate macros behind `#[cfg(not(bootstrap))]`nils-0/+1
Co-authored-by: Takayuki Maeda <takoyaki0316@gmail.com>
2022-11-19Add unstable `type_ascribe` macroNilstrieb-0/+7
This macro serves as a placeholder for future type ascription syntax to make sure that the semantic implementation keeps working.
2022-11-12Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obkDylan DPC-0/+4
Add the `#[derive_const]` attribute Closes #102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? `````@oli-obk`````
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-0/+3
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-09-20Add the `#[derive_const]` attributeDeadbeef-0/+4
2022-04-02Create 2024 editionJacob Pratt-0/+10
2022-01-28update cfg(bootstrap)sPietro Albini-1/+0
2022-01-12Remove deprecated LLVM-style inline assemblyTomasz Miąsko-2/+2
2022-01-03Make the documentation of builtin macro attributes accessibleDaniel Henry-Mantilla-9/+6
- Do not `#[doc(hidden)]` the `#[derive]` macro attribute - Add a link to the reference section to `derive`'s inherent docs - Do the same for `#[test]` and `#[global_allocator]` - Fix `GlobalAlloc` link (why is it on `core` and not `alloc`?) - Try `no_inline`-ing the `std` reexports from `core` - Revert "Try `no_inline`-ing the `std` reexports from `core`" - Address PR review - Also document the unstable macros
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-16/+0
They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
2021-12-06Implement concat_bytes!Smitty-0/+9
The tracking issue for this is #87555.
2021-07-18Move asm! and global_asm! to core::archbstrie-3/+19
2021-06-14Stabilize {std, core}::prelude::rust_*.Mara Bos-8/+8
2021-05-25Add new traits to 2021 prelude.Mara Bos-1/+7
2021-05-25Add tracking issue for edition-specific preludes.Mara Bos-6/+6
2021-04-04Bump cfgsMark Rousskov-2/+0
2021-03-15Deprecate RustcEncodable and RustcDecodable.Mara Bos-1/+1
2021-03-10Rollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakisDylan DPC-4/+38
Edition-specific preludes This changes `{std,core}::prelude` to export edition-specific preludes under `rust_2015`, `rust_2018` and `rust_2021`. (As suggested in https://github.com/rust-lang/rust/issues/51418#issuecomment-395630382.) For now they all just re-export `v1::*`, but this allows us to add things to the 2021edition prelude soon. This also changes the compiler to make the automatically injected prelude import dependent on the selected edition. cc `@rust-lang/libs` `@djc`
2021-03-06Implement built-in attribute macro `#[cfg_eval]`Vadim Petrochenkov-0/+9
2021-02-25Use intra-doc links.Mara-4/+4
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-25Add {core,std}::prelude::{rust_2015,rust_2018,rust_2021}.Mara Bos-4/+38
rust_2015 and rust_2018 are just re-exports of v1. rust_2021 is a module that for now just re-exports everything from v1, such that we can add more things later.