rustc_middle: derivative -> derive-where

This commit is contained in:
Pavel Grigorenko 2024-06-27 01:29:49 +03:00
parent 5d76a13bbe
commit fd16a0efeb
3 changed files with 17 additions and 11 deletions

View File

@ -1057,6 +1057,17 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "derive-where"
version = "1.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
]
[[package]] [[package]]
name = "derive_builder" name = "derive_builder"
version = "0.20.0" version = "0.20.0"
@ -4348,7 +4359,7 @@ name = "rustc_middle"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"derivative", "derive-where",
"either", "either",
"field-offset", "field-offset",
"gsgdt", "gsgdt",

View File

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
# tidy-alphabetical-start # tidy-alphabetical-start
bitflags = "2.4.1" bitflags = "2.4.1"
derivative = "2.2.0" derive-where = "1.2.7"
either = "1.5.0" either = "1.5.0"
field-offset = "0.3.5" field-offset = "0.3.5"
gsgdt = "0.1.2" gsgdt = "0.1.2"

View File

@ -2,6 +2,7 @@
use crate::mir; use crate::mir;
use crate::ty::{self, CoroutineArgsExt, OpaqueHiddenType, Ty, TyCtxt}; use crate::ty::{self, CoroutineArgsExt, OpaqueHiddenType, Ty, TyCtxt};
use derive_where::derive_where;
use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::ErrorGuaranteed; use rustc_errors::ErrorGuaranteed;
use rustc_hir::def_id::LocalDefId; use rustc_hir::def_id::LocalDefId;
@ -224,13 +225,7 @@ rustc_data_structures::static_assert_size!(ConstraintCategory<'_>, 16);
/// See also `rustc_const_eval::borrow_check::constraints`. /// See also `rustc_const_eval::borrow_check::constraints`.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)] #[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
#[derive(derivative::Derivative)] #[derive_where(PartialOrd, Ord)]
#[derivative(
PartialOrd,
Ord,
PartialOrd = "feature_allow_slow_enum",
Ord = "feature_allow_slow_enum"
)]
pub enum ConstraintCategory<'tcx> { pub enum ConstraintCategory<'tcx> {
Return(ReturnConstraint), Return(ReturnConstraint),
Yield, Yield,
@ -240,7 +235,7 @@ pub enum ConstraintCategory<'tcx> {
Cast { Cast {
/// Whether this is an unsizing cast and if yes, this contains the target type. /// Whether this is an unsizing cast and if yes, this contains the target type.
/// Region variables are erased to ReErased. /// Region variables are erased to ReErased.
#[derivative(PartialOrd = "ignore", Ord = "ignore")] #[derive_where(skip)]
unsize_to: Option<Ty<'tcx>>, unsize_to: Option<Ty<'tcx>>,
}, },
@ -250,7 +245,7 @@ pub enum ConstraintCategory<'tcx> {
ClosureBounds, ClosureBounds,
/// Contains the function type if available. /// Contains the function type if available.
CallArgument(#[derivative(PartialOrd = "ignore", Ord = "ignore")] Option<Ty<'tcx>>), CallArgument(#[derive_where(skip)] Option<Ty<'tcx>>),
CopyBound, CopyBound,
SizedBound, SizedBound,
Assignment, Assignment,