diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2021-11-22 20:17:53 -0500 |
|---|---|---|
| committer | Jacob Pratt <jacob@jhpratt.dev> | 2021-11-22 20:17:53 -0500 |
| commit | 7b103e7dd2df75e4e8dbb333bc79ffc7e9304f65 (patch) | |
| tree | f6a0f083c46b82bea3ba0395c1c108c2b7c30d62 /compiler/rustc_middle | |
| parent | 936f2600b6c903b04387f74ed5cbce88bb06d243 (diff) | |
Use `derive_default_enum` in the compiler
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/lib.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 9 |
2 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 0894b805075..9ce9f65a490 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -30,6 +30,7 @@ #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(core_intrinsics)] +#![feature(derive_default_enum)] #![feature(discriminant_kind)] #![feature(exhaustive_patterns)] #![feature(if_let_guard)] diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index c79e25f4781..7e054d1e17f 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -2263,10 +2263,11 @@ impl<'tcx> TyS<'tcx> { /// a miscompilation or unsoundness. /// /// 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> { /// No additional information - this is the default. /// We will not add any additional information to error messages. + #[default] None, /// We switched our variance because a type occurs inside /// 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 - } -} |
