-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
T-langRelevant to the language teamRelevant to the language teamT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.metabugIssues about issues themselves ("bugs about bugs")Issues about issues themselves ("bugs about bugs")
Description
std
uses a lot of unstable language features. While core
will most likely always have to use language features because it defines things that are part of the core of the language, we can strive for std
to eventually be free of unstable language features.
Some of these we'll need to stabilize, but some others we might be able to simply remove with some small changes to the code.
(See also #94971 for the library features used by std
.)
These are the language features we currently use in std
: (This does not include core
or alloc
.)
- Macro related:
- allow_internal_unsafeallow_internal_unstable
concat_identsmacro_metavar_expr_concatdecl_macrorustc_attrs: rustc_macro_transparencyTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Const eval:
- const_mut_refsconst_trait_implTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Panic related:
- rustc_attrs: rustc_builtin_macro(std_panic)lang_items: begin_panicrustc_attrs: rustc_do_not_const_checkneeds_panic_runtimeTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Global allocator: (RFC 2492 might be of help here)
- alloc_error_handlerallocator_internalsTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Diagnostics:
- deprecated_suggestionmust_not_suspendrustc_attrs: rustc_conversion_suggestionrustc_attrs: rustc_diagnostic_itemrustc_attrs: rustc_insignificant_dtorrustc_attrs: rustc_lint_query_instabilityTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Rustdoc:
- doc_cfgdoc_cfg_hiderustdoc_internalsdoc_maskeddoc_notable_traitintra_doc_pointersTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- Other language features:
- lang_items: startlang_items: terminationlang_items: f32_runtime, f64_runtime
- Fixed if we move all f32 and f64 methods to core. Libm -> compiler_builtins?
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.associated_type_bounds: Remove need for associated_type_bounds in std. #95587box_syntaxtry_blocksc_unwind: Stabilisec_unwind
#116088dropck_eyepatchexhaustive_patternslinkagemin_specializationnegative_impls- We can remove this if we switch to just using
PhantomData
everywhere.
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.never_typenllplatform_intrinsics: remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics #121516prelude_importstaged_apithread_localcfg_target_thread_localrustc_attrs: rustc_std_internal_symbolrustc_attrs: rustc_specialization_traitrustc_attrs: rustc_layout_scalar_valid_range_start, rustc_layout_scalar_valid_range_endTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language teamRelevant to the language teamT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.metabugIssues about issues themselves ("bugs about bugs")Issues about issues themselves ("bugs about bugs")
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
m-ou-se commentedon Mar 15, 2022
@rust-lang/lang Can y'all please stabilize this entire list? :D Thaanks!
cc @rust-lang/libs
[-]Tracking issues for unstable language features in `std`[/-][+]Tracking issues for unstable language features used by `std`[/+]std
#94971DemiMarie commentedon Mar 16, 2022
@m-ou-se rightly corrected me, thanks.allow_internal_unstable
makes no sense to stabilize, so that one can be scratched off the list already.m-ou-se commentedon Mar 16, 2022
If we stabilize
staged_api
(to allow other crates to use#[stable]
and#[unstable]
for their own API), then we should also stabilizeallow_internal_unstable
.bjorn3 commentedon Mar 16, 2022
I don't think that is completely realistic. It contains several fallbacks for things that need to be explicitly defined when not using libstd, but call still be defined even when libstd is used. For example the global allocator used when no
#[global_allocator]
is used. Or the wrapper around themain
function. These fallbacks shouldn't stabilize I think as it would allow for multiple crates to define the same fallbacks. In addition the fallback mechanism may need to be changed in the future for various reasons. In addition the way the right panic runtime is selected is black magic that involves panic_abort and panic_unwind being part and not part of the crate graph at the same time. Still removing most such unstable features would be nice.Used by https://github.com/rust-lang/portable-simd/tree/master/crates/std_float
Removing probably won't change anything. It would reduce test coverage of full nll mode though as removing it switched libstd to the migration mode that is currently the default.
khuey commentedon May 16, 2022
Being able to use rustc_layout_scalar_valid_range_start/end would let me save a lot of memory space in Pernosco.
jhpratt commentedon Jun 7, 2022
If
staged_api
is intended to be stabilized at some point, there should be some way for stdlib to indicate that it is special to the compiler. I know I've used#![feature(staged_api)]
as a check to see if the crate being compiled is stdlib.chrysn commentedon Jul 26, 2022
Stabilizing the
scalar_valid_range
attributes would not only help save memory space, but also help in error handling across C FFI boundaries that is both idiomatic and zero-cost, because typicali32
results could be expressed as aResult<NonnegativeU32, SomeNewtypeAround(NegativeU32)>
whose conversion should become the identity function after optimization.bjorn3 commentedon Jul 26, 2022
I don't know if rustc optimizes
Result<NonnegativeI32, NegativeI32>
into an i32 right now. In any case even if it does, this is not guaranteed independent ofscalar_valid_range
being stable or not. The only niche filling optimization guaranteed right now is forOption
like enums where the wrapped type has a zero niche.9 remaining items