brson
November 11, 2016, 2:34am
1
Here’s a list of the most used unstable Rust features on the 6794 crates on crates.io . Here’s the raw data if you want to do your own thing.
398 test
239 plugin
140 rustc_private
135 plugin_registrar
123 core
87 collections
73 custom_derive
72 box_syntax
68 quote
59 alloc
58 phase
55 libc
54 std_misc
47 unboxed_closures
41 macro_rules
41 io
40 const_fn
35 asm
33 slice_patterns
33 custom_attribute
32 convert
30 heap_api
29 question_mark
29 globs
29 core_intrinsics
28 unsafe_destructor
22 proc_macro
22 old_io
21 box_patterns
20 unique
20 slicing_syntax
19 unicode
19 associated_type_defaults
18 associated_consts
17 step_by
16 no_std
15 zero_one
15 path
13 filling_drop
12 trace_macros
12 stmt_expr_attributes
12 proc_macro_lib
12 optin_builtin_traits
12 oom
12 fnbox
11 unsafe_no_drop_flag
11 specialization
11 path_ext
11 fs
11 alloc_system
10 type_ascription
10 if_let
10 hash
10 env
10 collections_bound
9 raw
8 rand
8 os
8 concat_idents
7 type_macros
7 lang_items
7 iter_arith
7 fn_traits
7 coerce_unsized
7 allocator
6 unsize
6 simd
6 reflect_marker
6 prelude_import
6 placement_in_syntax
6 old_path
6 hashmap_hasher
6 drain
6 btree_range
6 associated_types
5 vec_push_all
5 str_char
5 start
5 shared
5 scoped
5 repr_simd
5 non_ascii_idents
5 macro_reexport
5 inclusive_range_syntax
5 default_type_params
5 core_slice_ext
5 conservative_impl_trait
5 cfg_target_feature
5 append
4 tuple_indexing
4 staged_api
4 simd_ffi
4 platform_intrinsics
4 op_assign_traits
4 nonzero
4 mpsc_select
4 link_llvm_intrinsics
4 linkage
4 ip_addr
4 int_uint
4 get_type_id
4 fs_walk
4 exit_status
4 dropck_parametricity
4 catch_panic
4 box_raw
4 augmented_assignments
4 {}
3 try_from
3 tcp
3 str_escape
3 slice_bytes
3 rustc_macro
3 rt
3 result_expect
3 read_exact
3 rc_weak
3 pub_restricted
3 ptr_as_ref
3 process
3 placement_new_protocol
3 pattern
3 path_relative_from
3 old_orphan_check
3 num_bits_bytes
3 net
3 naked_functions
3 main
3 intrinsics
3 into_cow
3 fs_time
3 fixed_size_array
3 duration
3 core_prelude
3 core_float
3 braced_empty_structs
3 arc_counts
3 ...
3
2 unmarked_api
2 time2
2 thread_local
2 tempdir
2 std_panic
2 static_mutex
2 slice_concat_ext
2 set_recovery
2 scheme
2 rustdoc
2 rustc_attrs
2 recover
2 process_exec
2 on_unimplemented
2 lookup_host
2 link_args
2 iter_order
2 iter_cmp
2 ip
2 integer_atomics
2 float_extras
2 enumset
2 drop_types_in_const
2 compile
2 collections_range
2 clone_from_slice
2 bit_vec_append_split_off
2 binary_heap_extras
1 wrapping
1 while_let
1 wait_timeout
1 vecmap
1 unwind_attributes
1 untagged_unions
1 unboxed_closure_sugar
1 types]
1 thread_sleep
1 structural_match
1 step_trait
1 static_in_const
1 split_off
1 slice_splits
1 sip_hash_13
1 scoped_tls
1 rustc_macro_lib
1 rustc_builtins
1 read_and_zero
1 rc_unique
1 rc_counts
1 range_inclusive
1 panic_propagate
1 page_size
1 negate_unsigned
1 map_values_mut
1 map_in_place
1 map_entry_recover_keys
1 managed_boxes
1 log_syntax
1 list
1 linked_list_extras
1 iter_idx
1 iter_arith_traits
1 io_take_into_inner
1 inclusive_range
1 import_shadowing
1 hasher_write
1 hash_default
1 fused
1 fs_ext
1 fs_canonicalize
1 forktable
1 float_from_str_radix
1 drop_in_place
1 dotdot_in_tuple_patterns
1 dir_entry_ext
1 dir_builder
1 deque_extras
1 deprecated
1 cstr_to_str
1 cstr_memory
1 copy_from_slice
1 collections_drain
1 cfg_target_vendor
1 cell_extras
1 btree_append
1 advanced_slice_patterns
3 Likes
Annotated with information from feature_gate.rs (source ):
count feature name status versn issue#
398 test - - -
239 plugin active 1.0.0 29597
140 rustc_private - - -
135 plugin_registrar active 1.0.0 29597
123 core - - -
87 collections - - -
73 custom_derive active 1.0.0 29644
72 box_syntax active 1.0.0 27779
68 quote active 1.0.0 29601
59 alloc - - -
58 phase - - -
55 libc - - -
54 std_misc - - -
47 unboxed_closures active 1.0.0 29625
41 macro_rules accepted 1.0.0 -
41 io - - -
40 const_fn active 1.2.0 24111
35 asm active 1.0.0 29722
33 slice_patterns active 1.0.0 23121
33 custom_attribute active 1.0.0 29642
32 convert - - -
30 heap_api - - -
29 question_mark accepted 1.13.0 31436
29 globs accepted 1.0.0 -
29 core_intrinsics - - -
28 unsafe_destructor - - -
22 proc_macro active 1.13.0 35900
22 old_io - - -
21 box_patterns active 1.0.0 29641
20 unique - - -
20 slicing_syntax accepted 1.0.0 -
19 unicode - - -
19 associated_type_defaults active 1.2.0 29661
18 associated_consts active 1.0.0 29646
17 step_by - - -
16 no_std accepted 1.6.0 -
15 zero_one - - -
15 path - - -
13 filling_drop - - -
12 trace_macros active 1.0.0 29598
12 stmt_expr_attributes active 1.6.0 15701
12 proc_macro_lib - - -
12 optin_builtin_traits active 1.0.0 13231
12 oom - - -
12 fnbox - - -
11 unsafe_no_drop_flag removed 1.0.0 -
11 specialization active 1.7.0 31844
11 path_ext - - -
11 fs - - -
11 alloc_system - - -
10 type_ascription active 1.6.0 23416
10 if_let accepted 1.0.0 -
10 hash - - -
10 env - - -
10 collections_bound - - -
9 raw - - -
8 rand - - -
8 os - - -
8 concat_idents active 1.0.0 29599
7 type_macros accepted 1.13.0 27245
7 lang_items active 1.0.0 -
7 iter_arith - - -
7 fn_traits - - -
7 coerce_unsized - - -
7 allocator active 1.0.0 27389
6 unsize - - -
6 simd active 1.0.0 27731
6 reflect_marker - - -
6 prelude_import active 1.2.0 -
6 placement_in_syntax active 1.0.0 27779
6 old_path - - -
6 hashmap_hasher - - -
6 drain - - -
6 btree_range - - -
6 associated_types accepted 1.0.0 -
5 vec_push_all - - -
5 str_char - - -
5 start active 1.0.0 29633
5 shared - - -
5 scoped - - -
5 repr_simd active 1.4.0 27731
5 non_ascii_idents active 1.0.0 28979
5 macro_reexport active 1.0.0 29638
5 inclusive_range_syntax active 1.7.0 28237
5 default_type_params accepted 1.0.0 -
5 core_slice_ext - - -
5 conservative_impl_trait active 1.12.0 34511
5 cfg_target_feature active 1.4.0 29717
5 append - - -
4 tuple_indexing accepted 1.0.0 -
4 staged_api active 1.0.0 -
4 simd_ffi active 1.0.0 27731
4 platform_intrinsics active 1.4.0 27731
4 op_assign_traits - - -
4 nonzero - - -
4 mpsc_select - - -
4 link_llvm_intrinsics active 1.0.0 29602
4 linkage active 1.0.0 29603
4 ip_addr - - -
4 int_uint - - -
4 get_type_id - - -
4 fs_walk - - -
4 exit_status - - -
4 dropck_parametricity active 1.3.0 28498
4 catch_panic - - -
4 box_raw - - -
4 augmented_assignments accepted 1.8.0 28235
3 try_from - - -
3 tcp - - -
3 str_escape - - -
3 slice_bytes - - -
3 rustc_macro - - -
3 rt - - -
3 result_expect - - -
3 read_exact - - -
3 rc_weak - - -
3 pub_restricted active 1.9.0 32409
3 ptr_as_ref - - -
3 process - - -
3 placement_new_protocol - - -
3 pattern - - -
3 path_relative_from - - -
3 old_orphan_check - - -
3 num_bits_bytes - - -
3 net - - -
3 naked_functions active 1.9.0 32408
3 main active 1.0.0 29634
3 intrinsics active 1.0.0 -
3 into_cow - - -
3 fs_time - - -
3 fixed_size_array - - -
3 duration - - -
3 core_prelude - - -
3 core_float - - -
3 braced_empty_structs accepted 1.8.0 29720
3 arc_counts - - -
2 unmarked_api active 1.0.0 -
2 time2 - - -
2 thread_local active 1.0.0 29594
2 tempdir - - -
2 std_panic - - -
2 static_mutex - - -
2 slice_concat_ext - - -
2 set_recovery - - -
2 scheme - - -
2 rustdoc - - -
2 rustc_attrs active 1.0.0 29642
2 recover - - -
2 process_exec - - -
2 on_unimplemented active 1.0.0 29628
2 lookup_host - - -
2 link_args active 1.0.0 29596
2 iter_order - - -
2 iter_cmp - - -
2 ip - - -
2 integer_atomics - - -
2 float_extras - - -
2 enumset - - -
2 drop_types_in_const active 1.9.0 33156
2 compile - - -
2 collections_range - - -
2 clone_from_slice - - -
2 bit_vec_append_split_off - - -
2 binary_heap_extras - - -
1 wrapping - - -
1 while_let accepted 1.0.0 -
1 wait_timeout - - -
1 vecmap - - -
1 unwind_attributes active 1.4.0 -
1 untagged_unions active 1.13.0 32836
1 unboxed_closure_sugar - - -
1 types] - - -
1 thread_sleep - - -
1 structural_match active 1.8.0 31434
1 step_trait - - -
1 static_in_const active 1.13.0 35897
1 split_off - - -
1 slice_splits - - -
1 sip_hash_13 - - -
1 scoped_tls - - -
1 rustc_macro_lib - - -
1 rustc_builtins - - -
1 read_and_zero - - -
1 rc_unique - - -
1 rc_counts - - -
1 range_inclusive - - -
1 panic_propagate - - -
1 page_size - - -
1 negate_unsigned removed 1.0.0 29645
1 map_values_mut - - -
1 map_in_place - - -
1 map_entry_recover_keys - - -
1 managed_boxes removed 1.0.0 -
1 log_syntax active 1.0.0 29598
1 list - - -
1 linked_list_extras - - -
1 iter_idx - - -
1 iter_arith_traits - - -
1 io_take_into_inner - - -
1 inclusive_range - - -
1 import_shadowing removed 1.0.0 -
1 hasher_write - - -
1 hash_default - - -
1 fused - - -
1 fs_ext - - -
1 fs_canonicalize - - -
1 forktable - - -
1 float_from_str_radix - - -
1 drop_in_place - - -
1 dotdot_in_tuple_patterns accepted 1.14.0 33627
1 dir_entry_ext - - -
1 dir_builder - - -
1 deque_extras - - -
1 deprecated accepted 1.9.0 29935
1 cstr_to_str - - -
1 cstr_memory - - -
1 copy_from_slice - - -
1 collections_drain - - -
1 cfg_target_vendor active 1.5.0 29718
1 cell_extras - - -
1 btree_append - - -
1 advanced_slice_patterns active 1.0.0 23121
4 Likes
There are a few odd ones in the list:
4 {}
3 ...
3
Are those real or artifacts of how you collected the data?
It’s interesting that so many highly-used features do not have information about them in feature_gate.rs
. What is the difference between the ones in that file and the ones from the tidy script ?
feature_gate.rs doesn't contain library features.
The list certainly needs to be filtered using data from tidy script, I see a lot of features that are stabilized and/or don't exist anymore.
Amanieu
November 11, 2016, 1:17pm
5
It seems that this does not take “optional” features into account. For example, many crates (such as parking_lot
) only use nightly features (asm
, etc) if the nightly
Cargo feature is enabled.
1 Like
kennytm
November 12, 2016, 2:38pm
6
Actually even worse, it seems to be just a literal fgrep '#![feature'
.
As an example, the mbox
crate uses 7 features in the nightly channel *, but the raw data only lists placement_in_syntax
because there is a #![feature(placement_in_syntax)]
in the doc comment .
I guess this also explains @jethrogb ’s odd findings, maybe the script hint a literal #![feature(...)]
in the comments.
(The 7 features are: specialization, unique, unsize, coerce_unsized, placement_new_protocol, placement_in_syntax, box_syntax)
luser
December 12, 2016, 12:52pm
8
Also somewhat related: I was trying to figure out what the minimum version of Rust required to build my project was (not an easy exercise). I picked some arbitrary older version and hit an error because something was feature-gated in that version. However, I couldn’t find that there’s any easy way to determine when a feature hit stable. It seems like that would be a nice thing to have–a list of features and the version in which they shipped as stable.
futile
December 12, 2016, 4:49pm
9
This might help you: All the Rust features
josh
December 12, 2016, 4:50pm
10
If we put enough of this information into rustc itself, we could have a rustc option that says "tell me the oldest rustc version this code will work with". We could even let you declare the version you want to work with, and have rustc error out if you use a feature only found in a newer version. That would require someone doing some annotation of such features, though.
1 Like
luser
December 12, 2016, 4:58pm
11
josh:
If we put enough of this information into rustc itself, we could have a rustc option that says "tell me the oldest rustc version this code will work with". We could even let you declare the version you want to work with, and have rustc error out if you use a feature only found in a newer version. That would require someone doing some annotation of such features, though.
For library features we already have this information ! Presumably we'd need something similar for compiler features?
A user filed an issue on my sccache project because they were having trouble compiling it. First it turned out that their cargo was too old, but then when I tried to manually figure out what rustc version I required it was quite the process . In a perfect world yeah, I'd be able to say min-rust-version = 1.9
and have the compiler error if I use something from a newer release.
system
Closed
March 25, 2019, 8:27am
12
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.