rustc_feature

Struct Features

Source
pub struct Features {
    enabled_lang_features: Vec<EnabledLangFeature>,
    enabled_lib_features: Vec<EnabledLibFeature>,
    enabled_features: FxHashSet<Symbol>,
}
Expand description

A set of features to be used by later passes.

There are two ways to check if a language feature foo is enabled:

  • Directly with the foo method, e.g. if tcx.features().foo() { ... }.
  • With the enabled method, e.g. if tcx.features.enabled(sym::foo) { ... }.

The former is preferred. enabled should only be used when the feature symbol is not a constant, e.g. a parameter, or when the feature is a library feature.

Fields§

§enabled_lang_features: Vec<EnabledLangFeature>

#![feature] attrs for language features, for error reporting.

§enabled_lib_features: Vec<EnabledLibFeature>

#![feature] attrs for non-language (library) features.

§enabled_features: FxHashSet<Symbol>

enabled_lang_features + enabled_lib_features.

Implementations§

Source§

impl Features

Source

pub fn set_enabled_lang_feature(&mut self, lang_feat: EnabledLangFeature)

since should be set for stable features that are nevertheless enabled with a #[feature] attribute, indicating since when they are stable.

Source

pub fn set_enabled_lib_feature(&mut self, lib_feat: EnabledLibFeature)

Source

pub fn enabled_lang_features(&self) -> &Vec<EnabledLangFeature>

Returns a list of EnabledLangFeature with info about:

  • Feature gate name.
  • The span of the #[feature] attribute.
  • For stable language features, version info for when it was stabilized.
Source

pub fn enabled_lib_features(&self) -> &Vec<EnabledLibFeature>

Source

pub fn enabled_features(&self) -> &FxHashSet<Symbol>

Source

pub fn enabled(&self, feature: Symbol) -> bool

Is the given feature enabled (via #[feature(...)])?

Source§

impl Features

Source

pub fn abi_unadjusted(&self) -> bool

Source

pub fn allocator_internals(&self) -> bool

Source

pub fn allow_internal_unsafe(&self) -> bool

Source

pub fn allow_internal_unstable(&self) -> bool

Source

pub fn anonymous_lifetime_in_impl_trait(&self) -> bool

Source

pub fn compiler_builtins(&self) -> bool

Source

pub fn custom_mir(&self) -> bool

Source

pub fn generic_assert(&self) -> bool

Source

pub fn intrinsics(&self) -> bool

Source

pub fn lang_items(&self) -> bool

Source

pub fn lifetime_capture_rules_2024(&self) -> bool

Source

pub fn more_maybe_bounds(&self) -> bool

Source

pub fn multiple_supertrait_upcastable(&self) -> bool

Source

pub fn negative_bounds(&self) -> bool

Source

pub fn omit_gdb_pretty_printer_section(&self) -> bool

Source

pub fn pattern_complexity(&self) -> bool

Source

pub fn pattern_types(&self) -> bool

Source

pub fn prelude_import(&self) -> bool

Source

pub fn profiler_runtime(&self) -> bool

Source

pub fn rustc_attrs(&self) -> bool

Source

pub fn staged_api(&self) -> bool

Source

pub fn test_unstable_lint(&self) -> bool

Source

pub fn unqualified_local_imports(&self) -> bool

Source

pub fn with_negative_coherence(&self) -> bool

Source

pub fn abi_vectorcall(&self) -> bool

Source

pub fn auto_traits(&self) -> bool

Source

pub fn box_patterns(&self) -> bool

Source

pub fn builtin_syntax(&self) -> bool

Source

pub fn doc_notable_trait(&self) -> bool

Source

pub fn dropck_eyepatch(&self) -> bool

Source

pub fn dyn_compatible_for_dispatch(&self) -> bool

Source

pub fn fundamental(&self) -> bool

Source

pub fn linkage(&self) -> bool

Source

pub fn needs_panic_runtime(&self) -> bool

Source

pub fn panic_runtime(&self) -> bool

Source

pub fn rustc_allow_const_fn_unstable(&self) -> bool

Source

pub fn rustc_private(&self) -> bool

Source

pub fn rustdoc_internals(&self) -> bool

Source

pub fn rustdoc_missing_doc_code_examples(&self) -> bool

Source

pub fn start(&self) -> bool

Source

pub fn structural_match(&self) -> bool

Source

pub fn unboxed_closures(&self) -> bool

Source

pub fn aarch64_unstable_target_feature(&self) -> bool

Source

pub fn aarch64_ver_target_feature(&self) -> bool

Source

pub fn arm_target_feature(&self) -> bool

Source

pub fn avx512_target_feature(&self) -> bool

Source

pub fn bpf_target_feature(&self) -> bool

Source

pub fn csky_target_feature(&self) -> bool

Source

pub fn ermsb_target_feature(&self) -> bool

Source

pub fn hexagon_target_feature(&self) -> bool

Source

pub fn lahfsahf_target_feature(&self) -> bool

Source

pub fn loongarch_target_feature(&self) -> bool

Source

pub fn mips_target_feature(&self) -> bool

Source

pub fn powerpc_target_feature(&self) -> bool

Source

pub fn prfchw_target_feature(&self) -> bool

Source

pub fn riscv_target_feature(&self) -> bool

Source

pub fn rtm_target_feature(&self) -> bool

Source

pub fn s390x_target_feature(&self) -> bool

Source

pub fn sparc_target_feature(&self) -> bool

Source

pub fn sse4a_target_feature(&self) -> bool

Source

pub fn tbm_target_feature(&self) -> bool

Source

pub fn wasm_target_feature(&self) -> bool

Source

pub fn abi_avr_interrupt(&self) -> bool

Source

pub fn abi_c_cmse_nonsecure_call(&self) -> bool

Source

pub fn abi_msp430_interrupt(&self) -> bool

Source

pub fn abi_ptx(&self) -> bool

Source

pub fn abi_riscv_interrupt(&self) -> bool

Source

pub fn abi_x86_interrupt(&self) -> bool

Source

pub fn adt_const_params(&self) -> bool

Source

pub fn alloc_error_handler(&self) -> bool

Source

pub fn arbitrary_self_types(&self) -> bool

Source

pub fn arbitrary_self_types_pointers(&self) -> bool

Source

pub fn asm_experimental_arch(&self) -> bool

Source

pub fn asm_goto(&self) -> bool

Source

pub fn asm_unwind(&self) -> bool

Source

pub fn associated_const_equality(&self) -> bool

Source

pub fn associated_type_defaults(&self) -> bool

Source

pub fn async_closure(&self) -> bool

Source

pub fn async_fn_track_caller(&self) -> bool

Source

pub fn async_for_loop(&self) -> bool

Source

pub fn c_variadic(&self) -> bool

Source

pub fn cfg_boolean_literals(&self) -> bool

Source

pub fn cfg_overflow_checks(&self) -> bool

Source

pub fn cfg_relocation_model(&self) -> bool

Source

pub fn cfg_sanitize(&self) -> bool

Source

pub fn cfg_sanitizer_cfi(&self) -> bool

Source

pub fn cfg_target_compact(&self) -> bool

Source

pub fn cfg_target_has_atomic(&self) -> bool

Source

pub fn cfg_target_has_atomic_equal_alignment(&self) -> bool

Source

pub fn cfg_target_thread_local(&self) -> bool

Source

pub fn cfg_ub_checks(&self) -> bool

Source

pub fn cfg_version(&self) -> bool

Source

pub fn cfi_encoding(&self) -> bool

Source

pub fn closure_lifetime_binder(&self) -> bool

Source

pub fn closure_track_caller(&self) -> bool

Source

pub fn cmse_nonsecure_entry(&self) -> bool

Source

pub fn const_async_blocks(&self) -> bool

Source

pub fn const_closures(&self) -> bool

Source

pub fn const_for(&self) -> bool

Source

pub fn const_precise_live_drops(&self) -> bool

Source

pub fn const_trait_impl(&self) -> bool

Source

pub fn const_try(&self) -> bool

Source

pub fn coroutine_clone(&self) -> bool

Source

pub fn coroutines(&self) -> bool

Source

pub fn coverage_attribute(&self) -> bool

Source

pub fn custom_inner_attributes(&self) -> bool

Source

pub fn custom_test_frameworks(&self) -> bool

Source

pub fn decl_macro(&self) -> bool

Source

pub fn deprecated_safe(&self) -> bool

Source

pub fn deprecated_suggestion(&self) -> bool

Source

pub fn deref_patterns(&self) -> bool

Source

pub fn do_not_recommend(&self) -> bool

Source

pub fn doc_auto_cfg(&self) -> bool

Source

pub fn doc_cfg(&self) -> bool

Source

pub fn doc_cfg_hide(&self) -> bool

Source

pub fn doc_masked(&self) -> bool

Source

pub fn dyn_star(&self) -> bool

Source

pub fn exhaustive_patterns(&self) -> bool

Source

pub fn explicit_tail_calls(&self) -> bool

Source

pub fn extended_varargs_abi_support(&self) -> bool

Source

pub fn extern_types(&self) -> bool

Source

pub fn f128(&self) -> bool

Source

pub fn f16(&self) -> bool

Source

pub fn ffi_const(&self) -> bool

Source

pub fn ffi_pure(&self) -> bool

Source

pub fn fmt_debug(&self) -> bool

Source

pub fn fn_align(&self) -> bool

Source

pub fn fn_delegation(&self) -> bool

Source

pub fn freeze_impls(&self) -> bool

Source

pub fn gen_blocks(&self) -> bool

Source

pub fn generic_arg_infer(&self) -> bool

Source

pub fn generic_associated_types_extended(&self) -> bool

Source

pub fn generic_const_exprs(&self) -> bool

Source

pub fn generic_const_items(&self) -> bool

Source

pub fn global_registration(&self) -> bool

Source

pub fn half_open_range_patterns_in_slices(&self) -> bool

Source

pub fn if_let_guard(&self) -> bool

Source

pub fn impl_trait_in_assoc_type(&self) -> bool

Source

pub fn impl_trait_in_fn_trait_return(&self) -> bool

Source

pub fn inherent_associated_types(&self) -> bool

Source

pub fn inline_const_pat(&self) -> bool

Source

pub fn intra_doc_pointers(&self) -> bool

Source

pub fn large_assignments(&self) -> bool

Source

pub fn lazy_type_alias(&self) -> bool

Source

pub fn let_chains(&self) -> bool

Source

pub fn macro_metavar_expr(&self) -> bool

Source

pub fn macro_metavar_expr_concat(&self) -> bool

Source

pub fn marker_trait_attr(&self) -> bool

Source

pub fn min_specialization(&self) -> bool

Source

pub fn more_qualified_paths(&self) -> bool

Source

pub fn must_not_suspend(&self) -> bool

Source

pub fn mut_ref(&self) -> bool

Source

pub fn naked_functions(&self) -> bool

Source

pub fn negative_impls(&self) -> bool

Source

pub fn never_patterns(&self) -> bool

Source

pub fn never_type(&self) -> bool

Source

pub fn never_type_fallback(&self) -> bool

Source

pub fn no_core(&self) -> bool

Source

pub fn no_sanitize(&self) -> bool

Source

pub fn non_exhaustive_omitted_patterns_lint(&self) -> bool

Source

pub fn non_lifetime_binders(&self) -> bool

Source

pub fn offset_of_enum(&self) -> bool

Source

pub fn offset_of_slice(&self) -> bool

Source

pub fn optimize_attribute(&self) -> bool

Source

pub fn patchable_function_entry(&self) -> bool

Source

pub fn pin_ergonomics(&self) -> bool

Source

pub fn postfix_match(&self) -> bool

Source

pub fn precise_capturing_in_traits(&self) -> bool

Source

pub fn proc_macro_hygiene(&self) -> bool

Source

pub fn ref_pat_eat_one_layer_2024(&self) -> bool

Source

pub fn ref_pat_eat_one_layer_2024_structural(&self) -> bool

Source

pub fn register_tool(&self) -> bool

Source

pub fn repr128(&self) -> bool

Source

pub fn repr_simd(&self) -> bool

Source

pub fn return_type_notation(&self) -> bool

Source

pub fn rust_cold_cc(&self) -> bool

Source

pub fn sha512_sm_x86(&self) -> bool

Source

pub fn simd_ffi(&self) -> bool

Source

pub fn specialization(&self) -> bool

Source

pub fn stmt_expr_attributes(&self) -> bool

Source

pub fn strict_provenance_lints(&self) -> bool

Source

pub fn string_deref_patterns(&self) -> bool

Source

pub fn target_feature_11(&self) -> bool

Source

pub fn thread_local(&self) -> bool

Source

pub fn trait_alias(&self) -> bool

Source

pub fn trait_upcasting(&self) -> bool

Source

pub fn transmute_generic_consts(&self) -> bool

Source

pub fn transparent_unions(&self) -> bool

Source

pub fn trivial_bounds(&self) -> bool

Source

pub fn try_blocks(&self) -> bool

Source

pub fn type_alias_impl_trait(&self) -> bool

Source

pub fn type_changing_struct_update(&self) -> bool

Source

pub fn unsized_const_params(&self) -> bool

Source

pub fn unsized_fn_params(&self) -> bool

Source

pub fn unsized_locals(&self) -> bool

Source

pub fn unsized_tuple_coercion(&self) -> bool

Source

pub fn used_with_arg(&self) -> bool

Source

pub fn x86_amx_intrinsics(&self) -> bool

Source

pub fn xop_target_feature(&self) -> bool

Source

pub fn yeet_expr(&self) -> bool

Source

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.

Source

pub fn internal(&self, feature: Symbol) -> bool

Some features are internal to the compiler and standard library and should not be used in normal projects. We warn the user about these to alert them.

Trait Implementations§

Source§

impl Clone for Features

Source§

fn clone(&self) -> Features

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Features

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Features

Source§

fn default() -> Features

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Aligned for T

Source§

const ALIGN: Alignment = _

Alignment of Self.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

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: 80 bytes