Struct rustc_feature::active::Features
source · [−]pub struct Features {Show 185 fields
pub declared_lang_features: Vec<(Symbol, Span, Option<Symbol>)>,
pub declared_lib_features: Vec<(Symbol, Span)>,
pub active_features: FxHashSet<Symbol>,
pub abi_thiscall: bool,
pub abi_unadjusted: bool,
pub abi_vectorcall: bool,
pub allocator_internals: bool,
pub allow_internal_unsafe: bool,
pub allow_internal_unstable: bool,
pub anonymous_lifetime_in_impl_trait: bool,
pub compiler_builtins: bool,
pub generic_assert: bool,
pub intrinsics: bool,
pub lang_items: bool,
pub omit_gdb_pretty_printer_section: bool,
pub prelude_import: bool,
pub profiler_runtime: bool,
pub rustc_attrs: bool,
pub staged_api: bool,
pub test_2018_feature: bool,
pub test_unstable_lint: bool,
pub unsafe_pin_internals: bool,
pub with_negative_coherence: bool,
pub auto_traits: bool,
pub box_patterns: bool,
pub box_syntax: bool,
pub doc_notable_trait: bool,
pub dropck_eyepatch: bool,
pub fundamental: bool,
pub link_llvm_intrinsics: bool,
pub linkage: bool,
pub needs_panic_runtime: bool,
pub panic_runtime: bool,
pub rustc_allow_const_fn_unstable: bool,
pub rustc_private: bool,
pub rustdoc_internals: bool,
pub rustdoc_missing_doc_code_examples: bool,
pub start: bool,
pub structural_match: bool,
pub unboxed_closures: bool,
pub aarch64_ver_target_feature: bool,
pub arm_target_feature: bool,
pub avx512_target_feature: bool,
pub bpf_target_feature: bool,
pub cmpxchg16b_target_feature: bool,
pub ermsb_target_feature: bool,
pub f16c_target_feature: bool,
pub hexagon_target_feature: bool,
pub mips_target_feature: bool,
pub movbe_target_feature: bool,
pub powerpc_target_feature: bool,
pub riscv_target_feature: bool,
pub rtm_target_feature: bool,
pub sse4a_target_feature: bool,
pub tbm_target_feature: bool,
pub wasm_target_feature: bool,
pub abi_amdgpu_kernel: bool,
pub abi_avr_interrupt: bool,
pub abi_c_cmse_nonsecure_call: bool,
pub abi_efiapi: bool,
pub abi_msp430_interrupt: bool,
pub abi_ptx: bool,
pub abi_x86_interrupt: bool,
pub adt_const_params: bool,
pub alloc_error_handler: bool,
pub arbitrary_enum_discriminant: bool,
pub arbitrary_self_types: bool,
pub asm_const: bool,
pub asm_experimental_arch: bool,
pub asm_sym: bool,
pub asm_unwind: bool,
pub associated_const_equality: bool,
pub associated_type_bounds: bool,
pub associated_type_defaults: bool,
pub async_closure: bool,
pub c_unwind: bool,
pub c_variadic: bool,
pub capture_disjoint_fields: bool,
pub cfg_sanitize: bool,
pub cfg_target_abi: bool,
pub cfg_target_compact: bool,
pub cfg_target_has_atomic: bool,
pub cfg_target_has_atomic_equal_alignment: bool,
pub cfg_target_thread_local: bool,
pub cfg_version: bool,
pub closure_lifetime_binder: bool,
pub closure_track_caller: bool,
pub cmse_nonsecure_entry: bool,
pub collapse_debuginfo: bool,
pub const_async_blocks: bool,
pub const_eval_limit: bool,
pub const_extern_fn: bool,
pub const_fn_floating_point_arithmetic: bool,
pub const_for: bool,
pub const_mut_refs: bool,
pub const_precise_live_drops: bool,
pub const_refs_to_cell: bool,
pub const_trait_impl: bool,
pub const_try: bool,
pub custom_inner_attributes: bool,
pub custom_test_frameworks: bool,
pub debugger_visualizer: bool,
pub decl_macro: bool,
pub default_alloc_error_handler: bool,
pub default_type_parameter_fallback: bool,
pub deprecated_safe: bool,
pub deprecated_suggestion: bool,
pub doc_auto_cfg: bool,
pub doc_cfg: bool,
pub doc_cfg_hide: bool,
pub doc_masked: bool,
pub dyn_star: bool,
pub exclusive_range_pattern: bool,
pub exhaustive_patterns: bool,
pub extern_types: bool,
pub ffi_const: bool,
pub ffi_pure: bool,
pub ffi_returns_twice: bool,
pub fn_align: bool,
pub generator_clone: bool,
pub generators: bool,
pub generic_arg_infer: bool,
pub generic_associated_types_extended: bool,
pub generic_const_exprs: bool,
pub half_open_range_patterns: bool,
pub if_let_guard: bool,
pub imported_main: bool,
pub inherent_associated_types: bool,
pub inline_const: bool,
pub inline_const_pat: bool,
pub intra_doc_pointers: bool,
pub isa_attribute: bool,
pub large_assignments: bool,
pub let_chains: bool,
pub link_cfg: bool,
pub lint_reasons: bool,
pub macro_metavar_expr: bool,
pub marker_trait_attr: bool,
pub min_specialization: bool,
pub more_qualified_paths: bool,
pub must_not_suspend: bool,
pub naked_functions: bool,
pub native_link_modifiers_as_needed: bool,
pub native_link_modifiers_verbatim: bool,
pub negative_impls: bool,
pub never_type: bool,
pub never_type_fallback: bool,
pub no_core: bool,
pub no_coverage: bool,
pub no_sanitize: bool,
pub non_exhaustive_omitted_patterns_lint: bool,
pub object_safe_for_dispatch: bool,
pub optimize_attribute: bool,
pub platform_intrinsics: bool,
pub plugin: bool,
pub precise_pointer_size_matching: bool,
pub proc_macro_hygiene: bool,
pub raw_dylib: bool,
pub raw_ref_op: bool,
pub register_tool: bool,
pub repr128: bool,
pub repr_simd: bool,
pub return_position_impl_trait_in_trait: bool,
pub rust_cold_cc: bool,
pub simd_ffi: bool,
pub specialization: bool,
pub stmt_expr_attributes: bool,
pub strict_provenance: bool,
pub target_feature_11: bool,
pub thread_local: bool,
pub trait_alias: bool,
pub trait_upcasting: bool,
pub transparent_unions: bool,
pub trivial_bounds: bool,
pub try_blocks: bool,
pub type_alias_impl_trait: bool,
pub type_ascription: bool,
pub type_changing_struct_update: bool,
pub unix_sigpipe: bool,
pub unsized_fn_params: bool,
pub unsized_locals: bool,
pub unsized_tuple_coercion: bool,
pub used_with_arg: bool,
pub wasm_abi: bool,
pub yeet_expr: bool,
}Expand description
A set of features to be used by later passes.
Fields
declared_lang_features: Vec<(Symbol, Span, Option<Symbol>)>#![feature] attrs for language features, for error reporting.
declared_lib_features: Vec<(Symbol, Span)>#![feature] attrs for non-language (library) features.
active_features: FxHashSet<Symbol>Features enabled for this crate.
abi_thiscall: boolAllows using the thiscall ABI.
abi_unadjusted: boolAllows using the unadjusted ABI; perma-unstable.
abi_vectorcall: boolAllows using the vectorcall ABI.
allocator_internals: boolAllows using #![needs_allocator], an implementation detail of #[global_allocator].
allow_internal_unsafe: boolAllows using #[allow_internal_unsafe]. This is an
attribute on macro_rules! and can’t use the attribute handling
below (it has to be checked before expansion possibly makes
macros disappear).
allow_internal_unstable: boolAllows using #[allow_internal_unstable]. This is an
attribute on macro_rules! and can’t use the attribute handling
below (it has to be checked before expansion possibly makes
macros disappear).
anonymous_lifetime_in_impl_trait: boolAllows using anonymous lifetimes in argument-position impl-trait.
compiler_builtins: boolAllows identifying the compiler_builtins crate.
generic_assert: boolOutputs useful assert! messages
intrinsics: boolAllows using the rust-intrinsic’s “ABI”.
lang_items: boolAllows using #[lang = ".."] attribute for linking items to special compiler logic.
omit_gdb_pretty_printer_section: boolAllows using #[omit_gdb_pretty_printer_section].
prelude_import: boolAllows using #[prelude_import] on glob use items.
profiler_runtime: boolUsed to identify crates that contain the profiler runtime.
rustc_attrs: boolAllows using rustc_* attributes (RFC 572).
staged_api: boolAllows using the #[stable] and #[unstable] attributes.
test_2018_feature: boolAdded for testing E0705; perma-unstable.
test_unstable_lint: boolAdded for testing unstable lints; perma-unstable.
unsafe_pin_internals: boolAllows non-unsafe —and thus, unsound— access to Pin constructions.
Marked incomplete since perma-unstable and unsound.
with_negative_coherence: boolUse for stable + negative coherence and strict coherence depending on trait’s rustc_strict_coherence value.
auto_traits: boolAllows features specific to auto traits.
Renamed from optin_builtin_traits.
box_patterns: boolAllows using box in patterns (RFC 469).
box_syntax: boolAllows using the box $expr syntax.
doc_notable_trait: boolAllows #[doc(notable_trait)].
Renamed from doc_spotlight.
dropck_eyepatch: boolAllows using the may_dangle attribute (RFC 1327).
fundamental: boolAllows using the #[fundamental] attribute.
link_llvm_intrinsics: boolAllows using #[link_name="llvm.*"].
linkage: boolAllows using the #[linkage = ".."] attribute.
needs_panic_runtime: boolAllows declaring with #![needs_panic_runtime] that a panic runtime is needed.
panic_runtime: boolAllows using the #![panic_runtime] attribute.
rustc_allow_const_fn_unstable: boolAllows using #[rustc_allow_const_fn_unstable].
This is an attribute on const fn for the same
purpose as #[allow_internal_unstable].
rustc_private: boolAllows using compiler’s own crates.
rustdoc_internals: boolAllows using internal rustdoc features like doc(primitive) or doc(keyword).
rustdoc_missing_doc_code_examples: boolAllows using the rustdoc::missing_doc_code_examples lint
start: boolAllows using #[start] on a function indicating that it is the program entrypoint.
structural_match: boolAllows using #[structural_match] which indicates that a type is structurally matchable.
FIXME: Subsumed by trait StructuralPartialEq, cannot move to removed until a library
feature with the same name exists.
unboxed_closures: boolAllows using the rust-call ABI.
aarch64_ver_target_feature: boolarm_target_feature: boolavx512_target_feature: boolbpf_target_feature: boolcmpxchg16b_target_feature: boolermsb_target_feature: boolf16c_target_feature: boolhexagon_target_feature: boolmips_target_feature: boolmovbe_target_feature: boolpowerpc_target_feature: boolriscv_target_feature: boolrtm_target_feature: boolsse4a_target_feature: booltbm_target_feature: boolwasm_target_feature: boolabi_amdgpu_kernel: boolAllows using the amdgpu-kernel ABI.
abi_avr_interrupt: boolAllows extern "avr-interrupt" fn() and extern "avr-non-blocking-interrupt" fn().
abi_c_cmse_nonsecure_call: boolAllows extern "C-cmse-nonsecure-call" fn().
abi_efiapi: boolAllows using the efiapi ABI.
abi_msp430_interrupt: boolAllows extern "msp430-interrupt" fn().
abi_ptx: boolAllows extern "ptx-*" fn().
abi_x86_interrupt: boolAllows extern "x86-interrupt" fn().
adt_const_params: boolAllows additional const parameter types, such as &'static str or user defined types
alloc_error_handler: boolAllows defining an #[alloc_error_handler].
arbitrary_enum_discriminant: boolAllows explicit discriminants on non-unit enum variants.
arbitrary_self_types: boolAllows trait methods with arbitrary self types.
asm_const: boolAllows using const operands in inline assembly.
asm_experimental_arch: boolEnables experimental inline assembly support for additional architectures.
asm_sym: boolAllows using sym operands in inline assembly.
asm_unwind: boolAllows the may_unwind option in inline assembly.
associated_const_equality: boolAllows users to enforce equality of associated constants TraitImpl<AssocConst=3>.
associated_type_bounds: boolAllows the user of associated type bounds.
associated_type_defaults: boolAllows associated type defaults.
async_closure: boolAllows async || body closures.
c_unwind: boolAllows extern "C-unwind" fn to enable unwinding across ABI boundaries.
c_variadic: boolAllows using C-variadics.
capture_disjoint_fields: boolAllows capturing disjoint fields in a closure/generator (RFC 2229).
cfg_sanitize: boolAllows the use of #[cfg(sanitize = "option")]; set when -Zsanitizer is used.
cfg_target_abi: boolAllows cfg(target_abi = "...").
cfg_target_compact: boolAllows cfg(target(abi = "...")).
cfg_target_has_atomic: boolAllows cfg(target_has_atomic_load_store = "...").
cfg_target_has_atomic_equal_alignment: boolAllows cfg(target_has_atomic_equal_alignment = "...").
cfg_target_thread_local: boolAllows cfg(target_thread_local).
cfg_version: boolAllow conditional compilation depending on rust version
closure_lifetime_binder: boolAllows for<...> on closures and generators.
closure_track_caller: boolAllows #[track_caller] on closures and generators.
cmse_nonsecure_entry: boolAllows to use the #[cmse_nonsecure_entry] attribute.
collapse_debuginfo: boolAllows use of the #[collapse_debuginfo] attribute.
const_async_blocks: boolAllows async {} expressions in const contexts.
const_eval_limit: boolconst_extern_fn: boolAllows the definition of const extern fn and const unsafe extern fn.
const_fn_floating_point_arithmetic: boolAllows basic arithmetic on floating point types in a const fn.
const_for: boolAllows for _ in _ loops in const contexts.
const_mut_refs: boolAllows using &mut in constant functions.
const_precise_live_drops: boolBe more precise when looking for live drops in a const context.
const_refs_to_cell: boolAllows references to types with interior mutability within constants
const_trait_impl: boolAllows impl const Trait for T syntax.
const_try: boolAllows the ? operator in const contexts.
custom_inner_attributes: boolAllows non-builtin attributes in inner attribute position.
custom_test_frameworks: boolAllows custom test frameworks with #![test_runner] and #[test_case].
debugger_visualizer: boolAllows using #[debugger_visualizer].
decl_macro: boolAllows declarative macros 2.0 (macro).
default_alloc_error_handler: boolAllows rustc to inject a default alloc_error_handler
default_type_parameter_fallback: boolAllows default type parameters to influence type inference.
deprecated_safe: boolAllows using #[deprecated_safe] to deprecate the safeness of a function or trait
deprecated_suggestion: boolAllows having using suggestion in the #[deprecated] attribute.
doc_auto_cfg: boolTells rustdoc to automatically generate #[doc(cfg(...))].
doc_cfg: boolAllows #[doc(cfg(...))].
doc_cfg_hide: boolAllows #[doc(cfg_hide(...))].
doc_masked: boolAllows #[doc(masked)].
dyn_star: boolAllows dyn* Trait objects.
exclusive_range_pattern: boolAllows X..Y patterns.
exhaustive_patterns: boolAllows exhaustive pattern matching on types that contain uninhabited types.
extern_types: boolAllows defining extern types.
ffi_const: boolAllows the use of #[ffi_const] on foreign functions.
ffi_pure: boolAllows the use of #[ffi_pure] on foreign functions.
ffi_returns_twice: boolAllows using #[ffi_returns_twice] on foreign functions.
fn_align: boolAllows using #[repr(align(...))] on function items
generator_clone: boolAllows generators to be cloned.
generators: boolAllows defining generators.
generic_arg_infer: boolInfer generic args for both consts and types.
generic_associated_types_extended: boolAn extension to the generic_associated_types feature, allowing incomplete features.
generic_const_exprs: boolAllows non-trivial generic constants which have to have wfness manually propagated to callers
half_open_range_patterns: boolAllows using ..X, ..=X, ...X, and X.. as a pattern.
if_let_guard: boolAllows if let guard in match arms.
imported_main: boolAllows using imported main function
inherent_associated_types: boolAllows associated types in inherent impls.
inline_const: boolAllow anonymous constants from an inline const block
inline_const_pat: boolAllow anonymous constants from an inline const block in pattern position
intra_doc_pointers: boolAllows using pointer and reference in intra-doc links
isa_attribute: boolAllows #[instruction_set(_)] attribute
large_assignments: boollet_chains: boolAllows if/while p && let q = r && ... chains.
link_cfg: boolAllows #[link(..., cfg(..))].
lint_reasons: boolAllows using reason in lint attributes and the #[expect(lint)] lint check.
macro_metavar_expr: boolGive access to additional metadata about declarative macro meta-variables.
marker_trait_attr: boolAllows #[marker] on certain traits allowing overlapping implementations.
min_specialization: boolA minimal, sound subset of specialization intended to be used by the standard library until the soundness issues with specialization are fixed.
more_qualified_paths: boolAllows qualified paths in struct expressions, struct patterns and tuple struct patterns.
must_not_suspend: boolAllows the #[must_not_suspend] attribute.
naked_functions: boolAllows using #[naked] on functions.
native_link_modifiers_as_needed: boolAllows specifying the as-needed link modifier
native_link_modifiers_verbatim: boolAllows specifying the verbatim link modifier
negative_impls: boolAllow negative trait implementations.
never_type: boolAllows the ! type. Does not imply ‘exhaustive_patterns’ (below) any more.
never_type_fallback: boolAllows diverging expressions to fall back to ! rather than ().
no_core: boolAllows #![no_core].
no_coverage: boolAllows function attribute #[no_coverage], to bypass coverage
instrumentation of that function.
no_sanitize: boolAllows the use of no_sanitize attribute.
non_exhaustive_omitted_patterns_lint: boolAllows using the non_exhaustive_omitted_patterns lint.
object_safe_for_dispatch: boolAllows making dyn Trait well-formed even if Trait is not object safe.
In that case, dyn Trait: Trait does not hold. Moreover, coercions and
casts in safe Rust to dyn Trait for such a Trait is also forbidden.
optimize_attribute: boolAllows using #[optimize(X)].
platform_intrinsics: boolAllows extern "platform-intrinsic" { ... }.
plugin: boolAllows using #![plugin(myplugin)].
precise_pointer_size_matching: boolAllows exhaustive integer pattern matching on usize and isize.
proc_macro_hygiene: boolAllows macro attributes on expressions, statements and non-inline modules.
raw_dylib: boolAllows the use of raw-dylibs (RFC 2627).
raw_ref_op: boolAllows &raw const $place_expr and &raw mut $place_expr expressions.
register_tool: boolAllows using the #[register_tool] attribute.
repr128: boolAllows the #[repr(i128)] attribute for enums.
repr_simd: boolAllows repr(simd) and importing the various simd intrinsics.
return_position_impl_trait_in_trait: boolAllows return-position impl Trait in traits.
rust_cold_cc: boolAllows extern "rust-cold".
simd_ffi: boolAllows the use of SIMD types in functions declared in extern blocks.
specialization: boolAllows specialization of implementations (RFC 1210).
stmt_expr_attributes: boolAllows attributes on expressions and non-item statements.
strict_provenance: boolAllows lints part of the strict provenance effort.
target_feature_11: boolAllows the use of #[target_feature] on safe functions.
thread_local: boolAllows using #[thread_local] on static items.
trait_alias: boolAllows defining trait X = A + B; alias items.
trait_upcasting: boolAllows upcasting trait objects via supertraits.
Trait upcasting is casting, e.g., dyn Foo -> dyn Bar where Foo: Bar.
transparent_unions: boolAllows #[repr(transparent)] on unions (RFC 2645).
trivial_bounds: boolAllows inconsistent bounds in where clauses.
try_blocks: boolAllows using try {...} expressions.
type_alias_impl_trait: boolAllows impl Trait to be used inside type aliases (RFC 2515).
type_ascription: boolAllows the use of type ascription in expressions.
type_changing_struct_update: boolAllows creation of instances of a struct by moving fields that have not changed from prior instances of the same struct (RFC #2528)
unix_sigpipe: boolEnables rustc to generate code that instructs libstd to NOT ignore SIGPIPE.
unsized_fn_params: boolAllows unsized fn parameters.
unsized_locals: boolAllows unsized rvalues at arguments and parameters.
unsized_tuple_coercion: boolAllows unsized tuple coercion.
used_with_arg: boolAllows using the #[used(linker)] (or #[used(compiler)]) attribute.
wasm_abi: boolAllows extern "wasm" fn
yeet_expr: boolAllows do yeet expressions
Implementations
sourceimpl Features
impl Features
pub fn walk_feature_fields(&self, f: impl FnMut(&str, bool))
sourcepub fn enabled(&self, feature: Symbol) -> bool
pub fn enabled(&self, feature: Symbol) -> bool
Is the given feature enabled?
Panics if the symbol doesn’t correspond to a declared feature.
sourcepub fn incomplete(&self, feature: Symbol) -> bool
pub fn incomplete(&self, feature: Symbol) -> bool
Some features are known to be incomplete and using them is likely to have unanticipated results, such as compiler crashes. We warn the user about these to alert them.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Features
impl !Send for Features
impl !Sync for Features
impl Unpin for Features
impl UnwindSafe for Features
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 264 bytes