Use derive_default_enum
in the compiler
This commit is contained in:
parent
936f2600b6
commit
7b103e7dd2
9 changed files with 17 additions and 31 deletions
|
@ -95,9 +95,10 @@ pub(crate) type UnificationTable<'a, 'tcx, T> = ut::UnificationTable<
|
||||||
/// This is used so that the region values inferred by HIR region solving are
|
/// This is used so that the region values inferred by HIR region solving are
|
||||||
/// not exposed, and so that we can avoid doing work in HIR typeck that MIR
|
/// not exposed, and so that we can avoid doing work in HIR typeck that MIR
|
||||||
/// typeck will also do.
|
/// typeck will also do.
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug, Default)]
|
||||||
pub enum RegionckMode {
|
pub enum RegionckMode {
|
||||||
/// The default mode: report region errors, don't erase regions.
|
/// The default mode: report region errors, don't erase regions.
|
||||||
|
#[default]
|
||||||
Solve,
|
Solve,
|
||||||
/// Erase the results of region after solving.
|
/// Erase the results of region after solving.
|
||||||
Erase {
|
Erase {
|
||||||
|
@ -108,12 +109,6 @@ pub enum RegionckMode {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RegionckMode {
|
|
||||||
fn default() -> Self {
|
|
||||||
RegionckMode::Solve
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RegionckMode {
|
impl RegionckMode {
|
||||||
/// Indicates that the MIR borrowck will repeat these region
|
/// Indicates that the MIR borrowck will repeat these region
|
||||||
/// checks, so we should ignore errors if NLL is (unconditionally)
|
/// checks, so we should ignore errors if NLL is (unconditionally)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||||
#![feature(bool_to_option)]
|
#![feature(bool_to_option)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
|
#![feature(derive_default_enum)]
|
||||||
#![feature(extend_one)]
|
#![feature(extend_one)]
|
||||||
#![feature(iter_zip)]
|
#![feature(iter_zip)]
|
||||||
#![feature(let_else)]
|
#![feature(let_else)]
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#![feature(bool_to_option)]
|
#![feature(bool_to_option)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
#![feature(derive_default_enum)]
|
||||||
#![feature(discriminant_kind)]
|
#![feature(discriminant_kind)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
|
|
|
@ -2263,10 +2263,11 @@ impl<'tcx> TyS<'tcx> {
|
||||||
/// a miscompilation or unsoundness.
|
/// a miscompilation or unsoundness.
|
||||||
///
|
///
|
||||||
/// When in doubt, use `VarianceDiagInfo::default()`
|
/// When in doubt, use `VarianceDiagInfo::default()`
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub enum VarianceDiagInfo<'tcx> {
|
pub enum VarianceDiagInfo<'tcx> {
|
||||||
/// No additional information - this is the default.
|
/// No additional information - this is the default.
|
||||||
/// We will not add any additional information to error messages.
|
/// We will not add any additional information to error messages.
|
||||||
|
#[default]
|
||||||
None,
|
None,
|
||||||
/// We switched our variance because a type occurs inside
|
/// We switched our variance because a type occurs inside
|
||||||
/// the generic argument of a mutable reference or pointer
|
/// the generic argument of a mutable reference or pointer
|
||||||
|
@ -2301,9 +2302,3 @@ impl<'tcx> VarianceDiagInfo<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Default for VarianceDiagInfo<'tcx> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -335,9 +335,10 @@ impl Default for ErrorOutputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parameter to control path trimming.
|
/// Parameter to control path trimming.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
pub enum TrimmedDefPaths {
|
pub enum TrimmedDefPaths {
|
||||||
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive query
|
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive query
|
||||||
|
#[default]
|
||||||
Never,
|
Never,
|
||||||
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call `delay_good_path_bug`
|
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call `delay_good_path_bug`
|
||||||
Always,
|
Always,
|
||||||
|
@ -345,12 +346,6 @@ pub enum TrimmedDefPaths {
|
||||||
GoodPath,
|
GoodPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TrimmedDefPaths {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Never
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Use tree-based collections to cheaply get a deterministic `Hash` implementation.
|
/// Use tree-based collections to cheaply get a deterministic `Hash` implementation.
|
||||||
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
|
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
|
||||||
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
|
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![feature(crate_visibility_modifier)]
|
#![feature(crate_visibility_modifier)]
|
||||||
|
#![feature(derive_default_enum)]
|
||||||
#![feature(min_specialization)]
|
#![feature(min_specialization)]
|
||||||
#![feature(once_cell)]
|
#![feature(once_cell)]
|
||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#![feature(bool_to_option)]
|
#![feature(bool_to_option)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
|
#![feature(derive_default_enum)]
|
||||||
#![feature(hash_drain_filter)]
|
#![feature(hash_drain_filter)]
|
||||||
#![feature(in_band_lifetimes)]
|
#![feature(in_band_lifetimes)]
|
||||||
#![feature(iter_zip)]
|
#![feature(iter_zip)]
|
||||||
|
|
|
@ -82,9 +82,14 @@ pub use self::chalk_fulfill::FulfillmentContext as ChalkFulfillmentContext;
|
||||||
pub use rustc_infer::traits::*;
|
pub use rustc_infer::traits::*;
|
||||||
|
|
||||||
/// Whether to skip the leak check, as part of a future compatibility warning step.
|
/// Whether to skip the leak check, as part of a future compatibility warning step.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
///
|
||||||
|
/// The "default" for skip-leak-check corresponds to the current
|
||||||
|
/// behavior (do not skip the leak check) -- not the behavior we are
|
||||||
|
/// transitioning into.
|
||||||
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
|
||||||
pub enum SkipLeakCheck {
|
pub enum SkipLeakCheck {
|
||||||
Yes,
|
Yes,
|
||||||
|
#[default]
|
||||||
No,
|
No,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,15 +99,6 @@ impl SkipLeakCheck {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The "default" for skip-leak-check corresponds to the current
|
|
||||||
/// behavior (do not skip the leak check) -- not the behavior we are
|
|
||||||
/// transitioning into.
|
|
||||||
impl Default for SkipLeakCheck {
|
|
||||||
fn default() -> Self {
|
|
||||||
SkipLeakCheck::No
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The mode that trait queries run in.
|
/// The mode that trait queries run in.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum TraitQueryMode {
|
pub enum TraitQueryMode {
|
||||||
|
|
|
@ -163,6 +163,7 @@
|
||||||
#![cfg_attr(bootstrap, feature(const_raw_ptr_deref))]
|
#![cfg_attr(bootstrap, feature(const_raw_ptr_deref))]
|
||||||
#![feature(const_refs_to_cell)]
|
#![feature(const_refs_to_cell)]
|
||||||
#![feature(decl_macro)]
|
#![feature(decl_macro)]
|
||||||
|
#![feature(derive_default_enum)]
|
||||||
#![feature(doc_cfg)]
|
#![feature(doc_cfg)]
|
||||||
#![feature(doc_notable_trait)]
|
#![feature(doc_notable_trait)]
|
||||||
#![feature(doc_primitive)]
|
#![feature(doc_primitive)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue