mirror of https://github.com/rust-lang/rust.git
rustc_next_trait_solver: derivative -> derive-where
This commit is contained in:
parent
35ba700d5e
commit
70a11c7ba9
|
@ -4488,7 +4488,7 @@ name = "rustc_next_trait_solver"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"derivative",
|
"derive-where",
|
||||||
"rustc_ast_ir",
|
"rustc_ast_ir",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_index",
|
"rustc_index",
|
||||||
|
|
|
@ -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"
|
||||||
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
|
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||||
rustc_index = { path = "../rustc_index", default-features = false }
|
rustc_index = { path = "../rustc_index", default-features = false }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::ops::ControlFlow;
|
use std::ops::ControlFlow;
|
||||||
|
|
||||||
|
use derive_where::derive_where;
|
||||||
use rustc_type_ir::inherent::*;
|
use rustc_type_ir::inherent::*;
|
||||||
use rustc_type_ir::visit::{TypeVisitable, TypeVisitableExt, TypeVisitor};
|
use rustc_type_ir::visit::{TypeVisitable, TypeVisitableExt, TypeVisitor};
|
||||||
use rustc_type_ir::{self as ty, InferCtxtLike, Interner};
|
use rustc_type_ir::{self as ty, InferCtxtLike, Interner};
|
||||||
|
@ -108,15 +109,13 @@ impl From<bool> for IsFirstInputType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(Debug; I: Interner, T: Debug)]
|
||||||
#[derivative(Debug(bound = "T: Debug"))]
|
|
||||||
pub enum OrphanCheckErr<I: Interner, T> {
|
pub enum OrphanCheckErr<I: Interner, T> {
|
||||||
NonLocalInputType(Vec<(I::Ty, IsFirstInputType)>),
|
NonLocalInputType(Vec<(I::Ty, IsFirstInputType)>),
|
||||||
UncoveredTyParams(UncoveredTyParams<I, T>),
|
UncoveredTyParams(UncoveredTyParams<I, T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(Debug; I: Interner, T: Debug)]
|
||||||
#[derivative(Debug(bound = "T: Debug"))]
|
|
||||||
pub struct UncoveredTyParams<I: Interner, T> {
|
pub struct UncoveredTyParams<I: Interner, T> {
|
||||||
pub uncovered: T,
|
pub uncovered: T,
|
||||||
pub local_ty: Option<I::Ty>,
|
pub local_ty: Option<I::Ty>,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
pub(super) mod structural_traits;
|
pub(super) mod structural_traits;
|
||||||
|
|
||||||
|
use derive_where::derive_where;
|
||||||
use rustc_type_ir::elaborate;
|
use rustc_type_ir::elaborate;
|
||||||
use rustc_type_ir::fold::TypeFoldable;
|
use rustc_type_ir::fold::TypeFoldable;
|
||||||
use rustc_type_ir::inherent::*;
|
use rustc_type_ir::inherent::*;
|
||||||
|
@ -21,8 +22,7 @@ use crate::solve::{
|
||||||
///
|
///
|
||||||
/// It consists of both the `source`, which describes how that goal would be proven,
|
/// It consists of both the `source`, which describes how that goal would be proven,
|
||||||
/// and the `result` when using the given `source`.
|
/// and the `result` when using the given `source`.
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(Clone, Debug; I: Interner)]
|
||||||
#[derivative(Debug(bound = ""), Clone(bound = ""))]
|
|
||||||
pub(super) struct Candidate<I: Interner> {
|
pub(super) struct Candidate<I: Interner> {
|
||||||
pub(super) source: CandidateSource<I>,
|
pub(super) source: CandidateSource<I>,
|
||||||
pub(super) result: CanonicalResponse<I>,
|
pub(super) result: CanonicalResponse<I>,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! Code which is used by built-in goals that match "structurally", such a auto
|
//! Code which is used by built-in goals that match "structurally", such a auto
|
||||||
//! traits, `Copy`/`Clone`.
|
//! traits, `Copy`/`Clone`.
|
||||||
|
|
||||||
|
use derive_where::derive_where;
|
||||||
use rustc_ast_ir::{Movability, Mutability};
|
use rustc_ast_ir::{Movability, Mutability};
|
||||||
use rustc_type_ir::data_structures::HashMap;
|
use rustc_type_ir::data_structures::HashMap;
|
||||||
use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||||
|
@ -384,8 +385,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<I: Intern
|
||||||
|
|
||||||
/// Relevant types for an async callable, including its inputs, output,
|
/// Relevant types for an async callable, including its inputs, output,
|
||||||
/// and the return type you get from awaiting the output.
|
/// and the return type you get from awaiting the output.
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(Clone, Copy, Debug; I: Interner)]
|
||||||
#[derivative(Clone(bound = ""), Copy(bound = ""), Debug(bound = ""))]
|
|
||||||
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
|
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
|
||||||
pub(in crate::solve) struct AsyncCallableRelevantTypes<I: Interner> {
|
pub(in crate::solve) struct AsyncCallableRelevantTypes<I: Interner> {
|
||||||
pub tupled_inputs_ty: I::Ty,
|
pub tupled_inputs_ty: I::Ty,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use std::ops::ControlFlow;
|
use std::ops::ControlFlow;
|
||||||
|
|
||||||
|
use derive_where::derive_where;
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
||||||
use rustc_type_ir::data_structures::ensure_sufficient_stack;
|
use rustc_type_ir::data_structures::ensure_sufficient_stack;
|
||||||
|
@ -87,8 +88,7 @@ where
|
||||||
pub(super) inspect: ProofTreeBuilder<D>,
|
pub(super) inspect: ProofTreeBuilder<D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(Clone, Debug, Default; I: Interner)]
|
||||||
#[derivative(Clone(bound = ""), Debug(bound = ""), Default(bound = ""))]
|
|
||||||
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
|
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
|
||||||
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
|
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
|
||||||
// FIXME: This can be made crate-private once `EvalCtxt` also lives in this crate.
|
// FIXME: This can be made crate-private once `EvalCtxt` also lives in this crate.
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
use derive_where::derive_where;
|
||||||
use rustc_type_ir::inherent::*;
|
use rustc_type_ir::inherent::*;
|
||||||
use rustc_type_ir::{self as ty, search_graph, Interner};
|
use rustc_type_ir::{self as ty, search_graph, Interner};
|
||||||
|
|
||||||
|
@ -51,8 +52,7 @@ where
|
||||||
/// in the code, only one or two variants are actually possible.
|
/// in the code, only one or two variants are actually possible.
|
||||||
///
|
///
|
||||||
/// We simply ICE in case that assumption is broken.
|
/// We simply ICE in case that assumption is broken.
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(Debug; I: Interner)]
|
||||||
#[derivative(Debug(bound = ""))]
|
|
||||||
enum DebugSolver<I: Interner> {
|
enum DebugSolver<I: Interner> {
|
||||||
Root,
|
Root,
|
||||||
GoalEvaluation(WipGoalEvaluation<I>),
|
GoalEvaluation(WipGoalEvaluation<I>),
|
||||||
|
@ -78,8 +78,7 @@ impl<I: Interner> From<WipCanonicalGoalEvaluationStep<I>> for DebugSolver<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(PartialEq, Eq, Debug; I: Interner)]
|
||||||
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Debug(bound = ""))]
|
|
||||||
struct WipGoalEvaluation<I: Interner> {
|
struct WipGoalEvaluation<I: Interner> {
|
||||||
pub uncanonicalized_goal: Goal<I, I::Predicate>,
|
pub uncanonicalized_goal: Goal<I, I::Predicate>,
|
||||||
pub orig_values: Vec<I::GenericArg>,
|
pub orig_values: Vec<I::GenericArg>,
|
||||||
|
@ -96,8 +95,7 @@ impl<I: Interner> WipGoalEvaluation<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(PartialEq, Eq; I: Interner)]
|
||||||
#[derivative(PartialEq(bound = ""), Eq(bound = ""))]
|
|
||||||
pub(in crate::solve) enum WipCanonicalGoalEvaluationKind<I: Interner> {
|
pub(in crate::solve) enum WipCanonicalGoalEvaluationKind<I: Interner> {
|
||||||
Overflow,
|
Overflow,
|
||||||
CycleInStack,
|
CycleInStack,
|
||||||
|
@ -118,8 +116,7 @@ impl<I: Interner> std::fmt::Debug for WipCanonicalGoalEvaluationKind<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(PartialEq, Eq, Debug; I: Interner)]
|
||||||
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Debug(bound = ""))]
|
|
||||||
struct WipCanonicalGoalEvaluation<I: Interner> {
|
struct WipCanonicalGoalEvaluation<I: Interner> {
|
||||||
goal: CanonicalInput<I>,
|
goal: CanonicalInput<I>,
|
||||||
kind: Option<WipCanonicalGoalEvaluationKind<I>>,
|
kind: Option<WipCanonicalGoalEvaluationKind<I>>,
|
||||||
|
@ -153,8 +150,7 @@ impl<I: Interner> WipCanonicalGoalEvaluation<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(PartialEq, Eq, Debug; I: Interner)]
|
||||||
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Debug(bound = ""))]
|
|
||||||
struct WipCanonicalGoalEvaluationStep<I: Interner> {
|
struct WipCanonicalGoalEvaluationStep<I: Interner> {
|
||||||
/// Unlike `EvalCtxt::var_values`, we append a new
|
/// Unlike `EvalCtxt::var_values`, we append a new
|
||||||
/// generic arg here whenever we create a new inference
|
/// generic arg here whenever we create a new inference
|
||||||
|
@ -193,8 +189,7 @@ impl<I: Interner> WipCanonicalGoalEvaluationStep<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(PartialEq, Eq, Debug; I: Interner)]
|
||||||
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Debug(bound = ""))]
|
|
||||||
struct WipProbe<I: Interner> {
|
struct WipProbe<I: Interner> {
|
||||||
initial_num_var_values: usize,
|
initial_num_var_values: usize,
|
||||||
steps: Vec<WipProbeStep<I>>,
|
steps: Vec<WipProbeStep<I>>,
|
||||||
|
@ -212,8 +207,7 @@ impl<I: Interner> WipProbe<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive_where(PartialEq, Eq, Debug; I: Interner)]
|
||||||
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Debug(bound = ""))]
|
|
||||||
enum WipProbeStep<I: Interner> {
|
enum WipProbeStep<I: Interner> {
|
||||||
AddGoal(GoalSource, inspect::CanonicalState<I, Goal<I, I::Predicate>>),
|
AddGoal(GoalSource, inspect::CanonicalState<I, Goal<I, I::Predicate>>),
|
||||||
NestedProbe(WipProbe<I>),
|
NestedProbe(WipProbe<I>),
|
||||||
|
|
Loading…
Reference in New Issue