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",
]
[[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]]
name = "derive_builder"
version = "0.20.0"
@ -4348,7 +4359,7 @@ name = "rustc_middle"
version = "0.0.0"
dependencies = [
"bitflags 2.5.0",
"derivative",
"derive-where",
"either",
"field-offset",
"gsgdt",

View file

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

View file

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