about summary refs log tree commit diff
path: root/library/std/src/prelude
AgeCommit message (Collapse)AuthorLines
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/+9
2025-02-24span: add a "future" editionDavid Wood-0/+15
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-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 cfg(bootstrap)Pietro Albini-2/+1
2025-01-08update version placeholdersPietro Albini-3/+3
2024-12-13Reword prelude for AsyncFn stabilizationMichael Goulet-2/+3
2024-12-13Stabilize async closuresMichael Goulet-1/+2
2024-12-11Stabilize the Rust 2024 preludeEric Huss-3/+13
2024-11-04Add AsyncFn* to to the prelude in all editionsMichael Goulet-0/+3
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-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/+7
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/+23
2024-03-22Soft-destabilize `RustcEncodable`/`RustcDecodable`Jacob Pratt-1/+6
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-0/+9
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-3/+3
Implements RFC 3509.
2023-04-27correct `std::prelude` commentKaDiWa-4/+4
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
2023-04-12remove some unneeded importsKaDiWa-5/+1
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/+8
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-05-27Finish bumping stage0Mark Rousskov-4/+0
It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though.
2022-04-15Rollup merge of #94461 - jhpratt:2024-edition, r=pnkfelixDylan DPC-0/+14
Create (unstable) 2024 edition [On Zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Deprecating.20macro.20scoping.20shenanigans/near/272860652), there was a small aside regarding creating the 2024 edition now as opposed to later. There was a reasonable amount of support and no stated opposition. This change creates the 2024 edition in the compiler and creates a prelude for the 2024 edition. There is no current difference between the 2021 and 2024 editions. Cargo and other tools will need to be updated separately, as it's not in the same repository. This change permits the vast majority of work towards the next edition to proceed _now_ instead of waiting until 2024. For sanity purposes, I've merged the "hello" UI tests into a single file with multiple revisions. Otherwise we'd end up with a file per edition, despite them being essentially identical. ````@rustbot```` label +T-lang +S-waiting-on-review Not sure on the relevant team, to be honest.
2022-04-14library: Move `CStr` to libcore, and `CString` to liballocVadim Petrochenkov-0/+4
2022-04-02Create 2024 editionJacob Pratt-0/+14
2022-01-28update cfg(bootstrap)sPietro Albini-1/+0
2022-01-12Remove deprecated LLVM-style inline assemblyTomasz Miąsko-3/+2
2022-01-03Make the documentation of builtin macro attributes accessibleDaniel Henry-Mantilla-11/+8
- 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-4/+20
2021-06-14Stabilize {std, core}::prelude::rust_*.Mara Bos-9/+23
2021-05-25Add tracking issue for edition-specific preludes.Mara Bos-7/+7
2021-04-04Bump cfgsMark Rousskov-2/+0
2021-03-31Rollup merge of #80720 - steffahn:prettify_prelude_imports, r=camelid,jyn514Dylan DPC-32/+32
Make documentation of which items the prelude exports more readable. I recently figured out that rustdoc allows link inside of inline code blocks as long as they’re delimited with `<code> </code>` instead of `` ` ` ``. I think this applies nicely in the listing of prelude exports [in the docs](https://doc.rust-lang.org/std/prelude/index.html). There, currently unformatted `::` and `{ , }` is used in order to mimick import syntax while attatching links to individual identifiers. ## Rendered Comparison ### Currently (light) ![Screenshot_20210105_155801](https://user-images.githubusercontent.com/3986214/103661510-1a87be80-4f6f-11eb-8360-1dfb23f732e8.png) ### After this PR (light) ![Screenshot_20210105_155811](https://user-images.githubusercontent.com/3986214/103661533-1f4c7280-4f6f-11eb-89d4-874793937824.png) ### Currently (dark) ![Screenshot_20210105_155824](https://user-images.githubusercontent.com/3986214/103661571-2a9f9e00-4f6f-11eb-95f9-e291b5570b41.png) ### After this PR (dark) ![Screenshot_20210105_155836](https://user-images.githubusercontent.com/3986214/103661592-2ffce880-4f6f-11eb-977a-82afcb07d331.png) ### Currently (ayu) ![Screenshot_20210105_155917](https://user-images.githubusercontent.com/3986214/103661619-39865080-4f6f-11eb-9ca1-9045a107cddd.png) ### After this PR (ayu) ![Screenshot_20210105_155923](https://user-images.githubusercontent.com/3986214/103661652-3db26e00-4f6f-11eb-82b7-378e38f0c41f.png) _Edit:_ I just noticed, the “current” screenshots are from stable, so there are a few more differences in the pictures than the ones from just this PR.
2021-03-29Change back prelude headlineFrank Steffahn-1/+1
2021-03-15Deprecate RustcEncodable and RustcDecodable.Mara Bos-1/+1