about summary refs log tree commit diff
path: root/library/std/src/prelude
AgeCommit message (Collapse)AuthorLines
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
2021-03-10Rollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakisDylan DPC-1/+35
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-0/+34
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.
2021-02-07expand/resolve: Turn `#[derive]` into a regular macro attributeVadim Petrochenkov-0/+5
2021-01-21Make documentation of which items the prelude exports more readably.Frank Steffahn-33/+33
2021-01-21Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnikYuki Okushi-14/+14
Use consistent punctuation for 'Prelude contents' docs
2021-01-06Style nit: replace `for_each` & `return` with `for` & `continue`Daniel Henry-Mantilla-4/+4
Co-Authored-By: Joshua Nelson <jyn514@gmail.com>
2021-01-05Use heading for `std::prelude` and not `io::prelude`Camelid-1/+1
The heading style for `std::prelude` is to be consistent with the headings for `std` and `core`: `# The Rust Standard Library` and `# The Rust Core Library`, respectively.
2021-01-05Use lowercase for prelude itemsCamelid-12/+12