rustc_type_ir: derivative -> derive-where

This commit is contained in:
Pavel Grigorenko 2024-06-27 14:55:44 +03:00
parent 70a11c7ba9
commit 168096f663
24 changed files with 140 additions and 425 deletions

View file

@ -1046,17 +1046,6 @@ dependencies = [
"powerfmt", "powerfmt",
] ]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "derive-where" name = "derive-where"
version = "1.2.7" version = "1.2.7"
@ -4878,7 +4867,7 @@ name = "rustc_type_ir"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"derivative", "derive-where",
"indexmap", "indexmap",
"rustc_ast_ir", "rustc_ast_ir",
"rustc_data_structures", "rustc_data_structures",

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"
indexmap = "2.0.0" indexmap = "2.0.0"
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 }

View file

@ -3,6 +3,7 @@ use std::hash::Hash;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::ops::{ControlFlow, Deref}; use std::ops::{ControlFlow, Deref};
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};
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
@ -25,15 +26,12 @@ use crate::{self as ty, Interner};
/// e.g., `liberate_late_bound_regions`). /// e.g., `liberate_late_bound_regions`).
/// ///
/// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro. /// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro.
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, T: Clone)]
#[derivative( #[derive_where(Copy; I: Interner, T: Copy)]
Clone(bound = "T: Clone"), #[derive_where(Hash; I: Interner, T: Hash)]
Copy(bound = "T: Copy"), #[derive_where(PartialEq; I: Interner, T: PartialEq)]
Hash(bound = "T: Hash"), #[derive_where(Eq; I: Interner, T: Eq)]
PartialEq(bound = "T: PartialEq"), #[derive_where(Debug; I: Interner, T: Debug)]
Eq(bound = "T: Eq"),
Debug(bound = "T: Debug")
)]
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
pub struct Binder<I: Interner, T> { pub struct Binder<I: Interner, T> {
value: T, value: T,
@ -351,21 +349,18 @@ impl<I: Interner> TypeVisitor<I> for ValidateBoundVars<I> {
/// ///
/// If you don't have anything to `instantiate`, you may be looking for /// If you don't have anything to `instantiate`, you may be looking for
/// [`instantiate_identity`](EarlyBinder::instantiate_identity) or [`skip_binder`](EarlyBinder::skip_binder). /// [`instantiate_identity`](EarlyBinder::instantiate_identity) or [`skip_binder`](EarlyBinder::skip_binder).
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, T: Clone)]
#[derivative( #[derive_where(Copy; I: Interner, T: Copy)]
Clone(bound = "T: Clone"), #[derive_where(PartialEq; I: Interner, T: PartialEq)]
Copy(bound = "T: Copy"), #[derive_where(Eq; I: Interner, T: Eq)]
PartialEq(bound = "T: PartialEq"), #[derive_where(Ord; I: Interner, T: Ord)]
Eq(bound = "T: Eq"), #[derive_where(PartialOrd; I: Interner, T: Ord)]
Ord(bound = "T: Ord"), #[derive_where(Hash; I: Interner, T: Hash)]
PartialOrd(bound = "T: Ord"), #[derive_where(Debug; I: Interner, T: Debug)]
Hash(bound = "T: Hash"),
Debug(bound = "T: Debug")
)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub struct EarlyBinder<I: Interner, T> { pub struct EarlyBinder<I: Interner, T> {
value: T, value: T,
#[derivative(Debug = "ignore")] #[derive_where(skip(Debug))]
_tcx: PhantomData<I>, _tcx: PhantomData<I>,
} }

View file

@ -1,3 +1,4 @@
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_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
@ -11,15 +12,12 @@ use crate::{self as ty, Interner, UniverseIndex};
/// A "canonicalized" type `V` is one where all free inference /// A "canonicalized" type `V` is one where all free inference
/// variables have been rewritten to "canonical vars". These are /// variables have been rewritten to "canonical vars". These are
/// numbered starting from 0 in order of first appearance. /// numbered starting from 0 in order of first appearance.
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, V: Clone)]
#[derivative( #[derive_where(Hash; I: Interner, V: Hash)]
Clone(bound = "V: Clone"), #[derive_where(PartialEq; I: Interner, V: PartialEq)]
Hash(bound = "V: Hash"), #[derive_where(Eq; I: Interner, V: Eq)]
PartialEq(bound = "V: PartialEq"), #[derive_where(Debug; I: Interner, V: fmt::Debug)]
Eq(bound = "V: Eq"), #[derive_where(Copy; I: Interner, V: Copy)]
Debug(bound = "V: fmt::Debug"),
Copy(bound = "V: Copy")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub struct Canonical<I: Interner, V> { pub struct Canonical<I: Interner, V> {
@ -84,15 +82,7 @@ impl<I: Interner, V: fmt::Display> fmt::Display for Canonical<I, V> {
/// canonical value. This is sufficient information for code to create /// canonical value. This is sufficient information for code to create
/// a copy of the canonical value in some other inference context, /// a copy of the canonical value in some other inference context,
/// with fresh inference variables replacing the canonical values. /// with fresh inference variables replacing the canonical values.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
Debug(bound = ""),
Eq(bound = ""),
PartialEq(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub struct CanonicalVarInfo<I: Interner> { pub struct CanonicalVarInfo<I: Interner> {
@ -149,8 +139,7 @@ impl<I: Interner> CanonicalVarInfo<I> {
/// Describes the "kind" of the canonical variable. This is a "kind" /// Describes the "kind" of the canonical variable. This is a "kind"
/// in the type-theory sense of the term -- i.e., a "meta" type system /// in the type-theory sense of the term -- i.e., a "meta" type system
/// that analyzes type-like values. /// that analyzes type-like values.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, Eq, Debug; I: Interner)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""), Debug(bound = ""))]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub enum CanonicalVarKind<I: Interner> { pub enum CanonicalVarKind<I: Interner> {
@ -266,15 +255,7 @@ pub enum CanonicalTyVarKind {
/// vectors with the original values that were replaced by canonical /// vectors with the original values that were replaced by canonical
/// variables. You will need to supply it later to instantiate the /// variables. You will need to supply it later to instantiate the
/// canonicalized query response. /// canonicalized query response.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Hash(bound = ""),
Debug(bound = "")
)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
pub struct CanonicalVarValues<I: Interner> { pub struct CanonicalVarValues<I: Interner> {

View file

@ -1,3 +1,4 @@
use derive_where::derive_where;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
@ -10,8 +11,7 @@ use crate::{self as ty, DebruijnIndex, Interner};
use self::ConstKind::*; use self::ConstKind::*;
/// Represents a constant in Rust. /// Represents a constant in Rust.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, Eq; I: Interner)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""), Eq(bound = ""))]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub enum ConstKind<I: Interner> { pub enum ConstKind<I: Interner> {
/// A const generic parameter. /// A const generic parameter.
@ -79,14 +79,7 @@ impl<I: Interner> fmt::Debug for ConstKind<I> {
} }
/// An unevaluated (potentially generic) constant used in the type-system. /// An unevaluated (potentially generic) constant used in the type-system.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct UnevaluatedConst<I: Interner> { pub struct UnevaluatedConst<I: Interner> {

View file

@ -1,3 +1,4 @@
use derive_where::derive_where;
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
use crate::solve::NoSolution; use crate::solve::NoSolution;
@ -21,14 +22,7 @@ impl<T> ExpectedFound<T> {
} }
// Data structures used in type unification // Data structures used in type unification
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic)] #[derive(TypeVisitable_Generic)]
#[cfg_attr(feature = "nightly", rustc_pass_by_value)] #[cfg_attr(feature = "nightly", rustc_pass_by_value)]
pub enum TypeError<I: Interner> { pub enum TypeError<I: Interner> {

View file

@ -1,16 +1,10 @@
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 crate::Interner; use crate::Interner;
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Debug(bound = ""),
Eq(bound = ""),
PartialEq(bound = "")
)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub enum GenericArgKind<I: Interner> { pub enum GenericArgKind<I: Interner> {
Lifetime(I::Region), Lifetime(I::Region),
@ -18,14 +12,7 @@ pub enum GenericArgKind<I: Interner> {
Const(I::Const), Const(I::Const),
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Debug(bound = ""),
Eq(bound = ""),
PartialEq(bound = "")
)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub enum TermKind<I: Interner> { pub enum TermKind<I: Interner> {
Ty(I::Ty), Ty(I::Ty),

View file

@ -1,3 +1,4 @@
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_macros::{TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
@ -5,15 +6,7 @@ use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
use crate::inherent::*; use crate::inherent::*;
use crate::{self as ty, Interner}; use crate::{self as ty, Interner};
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = ""),
Copy(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub struct OpaqueTypeKey<I: Interner> { pub struct OpaqueTypeKey<I: Interner> {

View file

@ -2,6 +2,7 @@
//! refers to rules defined in RFC 1214 (`OutlivesFooBar`), so see that //! refers to rules defined in RFC 1214 (`OutlivesFooBar`), so see that
//! RFC for reference. //! RFC for reference.
use derive_where::derive_where;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use crate::data_structures::SsoHashSet; use crate::data_structures::SsoHashSet;
@ -9,8 +10,7 @@ use crate::inherent::*;
use crate::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt as _, TypeVisitor}; use crate::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt as _, TypeVisitor};
use crate::{self as ty, Interner}; use crate::{self as ty, Interner};
#[derive(derivative::Derivative)] #[derive_where(Debug; I: Interner)]
#[derivative(Debug(bound = ""))]
pub enum Component<I: Interner> { pub enum Component<I: Interner> {
Region(I::Region), Region(I::Region),
Param(I::ParamTy), Param(I::ParamTy),

View file

@ -1,6 +1,7 @@
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
use derive_where::derive_where;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use rustc_macros::{Decodable, Encodable, HashStable_NoContext, TyDecodable, TyEncodable}; use rustc_macros::{Decodable, Encodable, HashStable_NoContext, TyDecodable, TyEncodable};
use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
@ -12,15 +13,12 @@ use crate::visit::TypeVisitableExt as _;
use crate::{self as ty, Interner}; use crate::{self as ty, Interner};
/// `A: 'region` /// `A: 'region`
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, A: Clone)]
#[derivative( #[derive_where(Copy; I: Interner, A: Copy)]
Clone(bound = "A: Clone"), #[derive_where(Hash; I: Interner, A: Hash)]
Copy(bound = "A: Copy"), #[derive_where(PartialEq; I: Interner, A: PartialEq)]
Hash(bound = "A: Hash"), #[derive_where(Eq; I: Interner, A: Eq)]
PartialEq(bound = "A: PartialEq"), #[derive_where(Debug; I: Interner, A: fmt::Debug)]
Eq(bound = "A: Eq"),
Debug(bound = "A: fmt::Debug")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub struct OutlivesPredicate<I: Interner, A>(pub A, pub I::Region); pub struct OutlivesPredicate<I: Interner, A>(pub A, pub I::Region);
@ -50,14 +48,7 @@ where
/// ///
/// Trait references also appear in object types like `Foo<U>`, but in /// Trait references also appear in object types like `Foo<U>`, but in
/// that case the `Self` parameter is absent from the generic parameters. /// that case the `Self` parameter is absent from the generic parameters.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct TraitRef<I: Interner> { pub struct TraitRef<I: Interner> {
@ -122,14 +113,7 @@ impl<I: Interner> ty::Binder<I, TraitRef<I>> {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct TraitPredicate<I: Interner> { pub struct TraitPredicate<I: Interner> {
@ -243,15 +227,7 @@ impl fmt::Display for PredicatePolarity {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(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))]
pub enum ExistentialPredicate<I: Interner> { pub enum ExistentialPredicate<I: Interner> {
@ -298,14 +274,7 @@ impl<I: Interner> ty::Binder<I, ExistentialPredicate<I>> {
/// ``` /// ```
/// The generic parameters don't include the erased `Self`, only trait /// The generic parameters don't include the erased `Self`, only trait
/// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above). /// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above).
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct ExistentialTraitRef<I: Interner> { pub struct ExistentialTraitRef<I: Interner> {
@ -351,14 +320,7 @@ impl<I: Interner> ty::Binder<I, ExistentialTraitRef<I>> {
} }
/// A `ProjectionPredicate` for an `ExistentialTraitRef`. /// A `ProjectionPredicate` for an `ExistentialTraitRef`.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct ExistentialProjection<I: Interner> { pub struct ExistentialProjection<I: Interner> {
@ -454,15 +416,7 @@ impl AliasTermKind {
/// * For a projection, this would be `<Ty as Trait<...>>::N<...>`. /// * For a projection, this would be `<Ty as Trait<...>>::N<...>`.
/// * For an inherent projection, this would be `Ty::N<...>`. /// * For an inherent projection, this would be `Ty::N<...>`.
/// * For an opaque type, there is no explicit syntax. /// * For an opaque type, there is no explicit syntax.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(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))]
pub struct AliasTerm<I: Interner> { pub struct AliasTerm<I: Interner> {
@ -491,7 +445,7 @@ pub struct AliasTerm<I: Interner> {
pub def_id: I::DefId, pub def_id: I::DefId,
/// This field exists to prevent the creation of `AliasTerm` without using [`AliasTerm::new_from_args`]. /// This field exists to prevent the creation of `AliasTerm` without using [`AliasTerm::new_from_args`].
#[derivative(Debug = "ignore")] #[derive_where(skip(Debug))]
_use_alias_term_new_instead: (), _use_alias_term_new_instead: (),
} }
@ -633,14 +587,7 @@ impl<I: Interner> From<ty::UnevaluatedConst<I>> for AliasTerm<I> {
/// equality between arbitrary types. Processing an instance of /// equality between arbitrary types. Processing an instance of
/// Form #2 eventually yields one of these `ProjectionPredicate` /// Form #2 eventually yields one of these `ProjectionPredicate`
/// instances to normalize the LHS. /// instances to normalize the LHS.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct ProjectionPredicate<I: Interner> { pub struct ProjectionPredicate<I: Interner> {
@ -708,14 +655,7 @@ impl<I: Interner> fmt::Debug for ProjectionPredicate<I> {
/// Used by the new solver. Unlike a `ProjectionPredicate` this can only be /// Used by the new solver. Unlike a `ProjectionPredicate` this can only be
/// proven by actually normalizing `alias`. /// proven by actually normalizing `alias`.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(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))]
pub struct NormalizesTo<I: Interner> { pub struct NormalizesTo<I: Interner> {
@ -750,15 +690,7 @@ impl<I: Interner> fmt::Debug for NormalizesTo<I> {
/// Encodes that `a` must be a subtype of `b`. The `a_is_expected` flag indicates /// Encodes that `a` must be a subtype of `b`. The `a_is_expected` flag indicates
/// whether the `a` type is the type that we should label as "expected" when /// whether the `a` type is the type that we should label as "expected" when
/// presenting user diagnostics. /// presenting user diagnostics.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(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))]
pub struct SubtypePredicate<I: Interner> { pub struct SubtypePredicate<I: Interner> {
@ -768,15 +700,7 @@ pub struct SubtypePredicate<I: Interner> {
} }
/// Encodes that we have to coerce *from* the `a` type to the `b` type. /// Encodes that we have to coerce *from* the `a` type to the `b` type.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(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))]
pub struct CoercePredicate<I: Interner> { pub struct CoercePredicate<I: Interner> {

View file

@ -1,3 +1,4 @@
use derive_where::derive_where;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use rustc_macros::{Decodable, Encodable, HashStable_NoContext, TyDecodable, TyEncodable}; use rustc_macros::{Decodable, Encodable, HashStable_NoContext, TyDecodable, TyEncodable};
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
@ -7,8 +8,7 @@ use crate::{self as ty, Interner};
/// A clause is something that can appear in where bounds or be inferred /// A clause is something that can appear in where bounds or be inferred
/// by implied bounds. /// by implied bounds.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, Eq; I: Interner)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""), Eq(bound = ""))]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub enum ClauseKind<I: Interner> { pub enum ClauseKind<I: Interner> {
@ -53,14 +53,7 @@ impl<I: Interner> PartialEq for ClauseKind<I> {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub enum PredicateKind<I: Interner> { pub enum PredicateKind<I: Interner> {

View file

@ -1,3 +1,4 @@
use derive_where::derive_where;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
@ -124,8 +125,7 @@ rustc_index::newtype_index! {
/// [1]: https://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ /// [1]: https://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
/// [2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ /// [2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, Eq; I: Interner)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""), Eq(bound = ""))]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable))]
pub enum RegionKind<I: Interner> { pub enum RegionKind<I: Interner> {
/// A region parameter; for example `'a` in `impl<'a> Trait for &'a ()`. /// A region parameter; for example `'a` in `impl<'a> Trait for &'a ()`.

View file

@ -1,5 +1,6 @@
use std::iter; use std::iter;
use derive_where::derive_where;
use rustc_ast_ir::Mutability; use rustc_ast_ir::Mutability;
use tracing::{debug, instrument}; use tracing::{debug, instrument};
@ -17,19 +18,11 @@ pub type RelateResult<I, T> = Result<T, TypeError<I>>;
/// a miscompilation or unsoundness. /// a miscompilation or unsoundness.
/// ///
/// When in doubt, use `VarianceDiagInfo::default()` /// When in doubt, use `VarianceDiagInfo::default()`
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Debug, Default; I: Interner)]
#[derivative(
Copy(bound = ""),
Clone(bound = ""),
Debug(bound = ""),
Default(bound = ""),
PartialEq(bound = ""),
Eq(bound = "")
)]
pub enum VarianceDiagInfo<I: Interner> { pub enum VarianceDiagInfo<I: Interner> {
/// 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.
#[derivative(Default)] #[derive_where(default)]
None, None,
/// We switched our variance because a generic argument occurs inside /// We switched our variance because a generic argument occurs inside
/// the invariant generic argument of another type. /// the invariant generic argument of another type.

View file

@ -1,10 +1,10 @@
use derive_where::derive_where;
use rustc_index::IndexVec; use rustc_index::IndexVec;
use super::{AvailableDepth, Cx, StackDepth, StackEntry}; use super::{AvailableDepth, Cx, StackDepth, StackEntry};
use crate::data_structures::{HashMap, HashSet}; use crate::data_structures::{HashMap, HashSet};
#[derive(derivative::Derivative)] #[derive_where(Debug, Clone, Copy; X: Cx)]
#[derivative(Debug(bound = ""), Clone(bound = ""), Copy(bound = ""))]
struct QueryData<X: Cx> { struct QueryData<X: Cx> {
result: X::Result, result: X::Result,
proof_tree: X::ProofTree, proof_tree: X::ProofTree,
@ -20,8 +20,7 @@ struct Success<X: Cx> {
/// This contains results whose computation never hit the /// This contains results whose computation never hit the
/// recursion limit in `success`, and all results which hit /// recursion limit in `success`, and all results which hit
/// the recursion limit in `with_overflow`. /// the recursion limit in `with_overflow`.
#[derive(derivative::Derivative)] #[derive_where(Default; X: Cx)]
#[derivative(Default(bound = ""))]
struct CacheEntry<X: Cx> { struct CacheEntry<X: Cx> {
success: Option<Success<X>>, success: Option<Success<X>>,
/// We have to be careful when caching roots of cycles. /// We have to be careful when caching roots of cycles.
@ -32,8 +31,7 @@ struct CacheEntry<X: Cx> {
with_overflow: HashMap<usize, X::Tracked<QueryData<X>>>, with_overflow: HashMap<usize, X::Tracked<QueryData<X>>>,
} }
#[derive(derivative::Derivative)] #[derive_where(Debug; X: Cx)]
#[derivative(Debug(bound = ""))]
pub(super) struct CacheData<'a, X: Cx> { pub(super) struct CacheData<'a, X: Cx> {
pub(super) result: X::Result, pub(super) result: X::Result,
pub(super) proof_tree: X::ProofTree, pub(super) proof_tree: X::ProofTree,
@ -41,11 +39,10 @@ pub(super) struct CacheData<'a, X: Cx> {
pub(super) encountered_overflow: bool, pub(super) encountered_overflow: bool,
// FIXME: This is currently unused, but impacts the design // FIXME: This is currently unused, but impacts the design
// by requiring a closure for `Cx::with_global_cache`. // by requiring a closure for `Cx::with_global_cache`.
#[allow(dead_code)]
pub(super) nested_goals: &'a HashSet<X::Input>, pub(super) nested_goals: &'a HashSet<X::Input>,
} }
#[derive_where(Default; X: Cx)]
#[derive(derivative::Derivative)]
#[derivative(Default(bound = ""))]
pub struct GlobalCache<X: Cx> { pub struct GlobalCache<X: Cx> {
map: HashMap<X::Input, CacheEntry<X>>, map: HashMap<X::Input, CacheEntry<X>>,
} }

View file

@ -3,6 +3,7 @@ use std::hash::Hash;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem; use std::mem;
use derive_where::derive_where;
use rustc_index::{Idx, IndexVec}; use rustc_index::{Idx, IndexVec};
use tracing::debug; use tracing::debug;
@ -153,8 +154,7 @@ rustc_index::newtype_index! {
pub struct StackDepth {} pub struct StackDepth {}
} }
#[derive(derivative::Derivative)] #[derive_where(Debug; X: Cx)]
#[derivative(Debug(bound = ""))]
struct StackEntry<X: Cx> { struct StackEntry<X: Cx> {
input: X::Input, input: X::Input,
@ -226,8 +226,7 @@ struct DetachedEntry<X: Cx> {
/// ///
/// The provisional cache can theoretically result in changes to the observable behavior, /// The provisional cache can theoretically result in changes to the observable behavior,
/// see tests/ui/traits/next-solver/cycles/provisional-cache-impacts-behavior.rs. /// see tests/ui/traits/next-solver/cycles/provisional-cache-impacts-behavior.rs.
#[derive(derivative::Derivative)] #[derive_where(Default; X: Cx)]
#[derivative(Default(bound = ""))]
struct ProvisionalCacheEntry<X: Cx> { struct ProvisionalCacheEntry<X: Cx> {
stack_depth: Option<StackDepth>, stack_depth: Option<StackDepth>,
with_inductive_stack: Option<DetachedEntry<X>>, with_inductive_stack: Option<DetachedEntry<X>>,

View file

@ -21,6 +21,7 @@ use crate::solve::{
CandidateSource, CanonicalInput, Certainty, Goal, GoalSource, QueryInput, QueryResult, CandidateSource, CanonicalInput, Certainty, Goal, GoalSource, QueryInput, QueryResult,
}; };
use crate::{Canonical, CanonicalVarValues, Interner}; use crate::{Canonical, CanonicalVarValues, Interner};
use derive_where::derive_where;
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
use std::fmt::Debug; use std::fmt::Debug;
use std::hash::Hash; use std::hash::Hash;
@ -31,15 +32,12 @@ use std::hash::Hash;
/// This is only ever used as [CanonicalState]. Any type information in proof /// This is only ever used as [CanonicalState]. Any type information in proof
/// trees used mechanically has to be canonicalized as we otherwise leak /// trees used mechanically has to be canonicalized as we otherwise leak
/// inference variables from a nested `InferCtxt`. /// inference variables from a nested `InferCtxt`.
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, T: Clone)]
#[derivative( #[derive_where(Copy; I: Interner, T: Copy)]
Clone(bound = "T: Clone"), #[derive_where(PartialEq; I: Interner, T: PartialEq)]
Copy(bound = "T: Copy"), #[derive_where(Eq; I: Interner, T: Eq)]
PartialEq(bound = "T: PartialEq"), #[derive_where(Hash; I: Interner, T: Hash)]
Eq(bound = "T: Eq"), #[derive_where(Debug; I: Interner, T: Debug)]
Hash(bound = "T: Hash"),
Debug(bound = "T: Debug")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
pub struct State<I: Interner, T> { pub struct State<I: Interner, T> {
pub var_values: CanonicalVarValues<I>, pub var_values: CanonicalVarValues<I>,
@ -52,24 +50,21 @@ pub type CanonicalState<I, T> = Canonical<I, State<I, T>>;
/// for the `CanonicalVarValues` of the canonicalized goal. /// for the `CanonicalVarValues` of the canonicalized goal.
/// We use this to map any [CanonicalState] from the local `InferCtxt` /// We use this to map any [CanonicalState] from the local `InferCtxt`
/// of the solver query to the `InferCtxt` of the caller. /// of the solver query to the `InferCtxt` of the caller.
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Hash; I: Interner)]
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Hash(bound = ""))]
pub struct GoalEvaluation<I: Interner> { pub struct GoalEvaluation<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>,
pub evaluation: CanonicalGoalEvaluation<I>, pub evaluation: CanonicalGoalEvaluation<I>,
} }
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Hash(bound = ""), Debug(bound = ""))]
pub struct CanonicalGoalEvaluation<I: Interner> { pub struct CanonicalGoalEvaluation<I: Interner> {
pub goal: CanonicalInput<I>, pub goal: CanonicalInput<I>,
pub kind: CanonicalGoalEvaluationKind<I>, pub kind: CanonicalGoalEvaluationKind<I>,
pub result: QueryResult<I>, pub result: QueryResult<I>,
} }
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Hash(bound = ""), Debug(bound = ""))]
pub enum CanonicalGoalEvaluationKind<I: Interner> { pub enum CanonicalGoalEvaluationKind<I: Interner> {
Overflow, Overflow,
CycleInStack, CycleInStack,
@ -77,8 +72,7 @@ pub enum CanonicalGoalEvaluationKind<I: Interner> {
Evaluation { final_revision: I::CanonicalGoalEvaluationStepRef }, Evaluation { final_revision: I::CanonicalGoalEvaluationStepRef },
} }
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Hash(bound = ""), Debug(bound = ""))]
pub struct CanonicalGoalEvaluationStep<I: Interner> { pub struct CanonicalGoalEvaluationStep<I: Interner> {
pub instantiated_goal: QueryInput<I, I::Predicate>, pub instantiated_goal: QueryInput<I, I::Predicate>,
@ -89,8 +83,7 @@ pub struct CanonicalGoalEvaluationStep<I: Interner> {
/// A self-contained computation during trait solving. This either /// A self-contained computation during trait solving. This either
/// corresponds to a `EvalCtxt::probe(_X)` call or the root evaluation /// corresponds to a `EvalCtxt::probe(_X)` call or the root evaluation
/// of a goal. /// of a goal.
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(Debug(bound = ""), PartialEq(bound = ""), Eq(bound = ""), Hash(bound = ""))]
pub struct Probe<I: Interner> { pub struct Probe<I: Interner> {
/// What happened inside of this probe in chronological order. /// What happened inside of this probe in chronological order.
pub steps: Vec<ProbeStep<I>>, pub steps: Vec<ProbeStep<I>>,
@ -98,8 +91,7 @@ pub struct Probe<I: Interner> {
pub final_state: CanonicalState<I, ()>, pub final_state: CanonicalState<I, ()>,
} }
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Hash(bound = ""), Debug(bound = ""))]
pub enum ProbeStep<I: Interner> { pub enum ProbeStep<I: Interner> {
/// We added a goal to the `EvalCtxt` which will get proven /// We added a goal to the `EvalCtxt` which will get proven
/// the next time `EvalCtxt::try_evaluate_added_goals` is called. /// the next time `EvalCtxt::try_evaluate_added_goals` is called.
@ -121,15 +113,7 @@ pub enum ProbeStep<I: Interner> {
/// What kind of probe we're in. In case the probe represents a candidate, or /// What kind of probe we're in. In case the probe represents a candidate, or
/// the final result of the current goal - via [ProbeKind::Root] - we also /// the final result of the current goal - via [ProbeKind::Root] - we also
/// store the [QueryResult]. /// store the [QueryResult].
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Hash(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
pub enum ProbeKind<I: Interner> { pub enum ProbeKind<I: Interner> {
/// The root inference context while proving a goal. /// The root inference context while proving a goal.

View file

@ -3,6 +3,7 @@ pub mod inspect;
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
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_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
@ -89,15 +90,12 @@ pub struct NoSolution;
/// ///
/// Most of the time the `param_env` contains the `where`-bounds of the function /// Most of the time the `param_env` contains the `where`-bounds of the function
/// we're currently typechecking while the `predicate` is some trait bound. /// we're currently typechecking while the `predicate` is some trait bound.
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, P: Clone)]
#[derivative( #[derive_where(Copy; I: Interner, P: Copy)]
Clone(bound = "P: Clone"), #[derive_where(Hash; I: Interner, P: Hash)]
Copy(bound = "P: Copy"), #[derive_where(PartialEq; I: Interner, P: PartialEq)]
Hash(bound = "P: Hash"), #[derive_where(Eq; I: Interner, P: Eq)]
PartialEq(bound = "P: PartialEq"), #[derive_where(Debug; I: Interner, P: fmt::Debug)]
Eq(bound = "P: Eq"),
Debug(bound = "P: fmt::Debug")
)]
#[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))]
pub struct Goal<I: Interner, P> { pub struct Goal<I: Interner, P> {
@ -140,15 +138,12 @@ pub enum GoalSource {
InstantiateHigherRanked, InstantiateHigherRanked,
} }
#[derive(derivative::Derivative)] #[derive_where(Clone; I: Interner, Goal<I, P>: Clone)]
#[derivative( #[derive_where(Copy; I: Interner, Goal<I, P>: Copy)]
Clone(bound = "Goal<I, P>: Clone"), #[derive_where(Hash; I: Interner, Goal<I, P>: Hash)]
Copy(bound = "Goal<I, P>: Copy"), #[derive_where(PartialEq; I: Interner, Goal<I, P>: PartialEq)]
Hash(bound = "Goal<I, P>: Hash"), #[derive_where(Eq; I: Interner, Goal<I, P>: Eq)]
PartialEq(bound = "Goal<I, P>: PartialEq"), #[derive_where(Debug; I: Interner, Goal<I, P>: fmt::Debug)]
Eq(bound = "Goal<I, P>: Eq"),
Debug(bound = "Goal<I, P>: fmt::Debug")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub struct QueryInput<I: Interner, P> { pub struct QueryInput<I: Interner, P> {
@ -157,15 +152,7 @@ pub struct QueryInput<I: Interner, P> {
} }
/// Opaques that are defined in the inference context before a query is called. /// Opaques that are defined in the inference context before a query is called.
#[derive(derivative::Derivative)] #[derive_where(Clone, Hash, PartialEq, Eq, Debug, Default; I: Interner)]
#[derivative(
Clone(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = ""),
Default(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
pub struct PredefinedOpaquesData<I: Interner> { pub struct PredefinedOpaquesData<I: Interner> {
@ -173,15 +160,7 @@ pub struct PredefinedOpaquesData<I: Interner> {
} }
/// Possible ways the given goal can be proven. /// Possible ways the given goal can be proven.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
pub enum CandidateSource<I: Interner> { pub enum CandidateSource<I: Interner> {
/// A user written impl. /// A user written impl.
/// ///
@ -265,15 +244,7 @@ pub enum BuiltinImplSource {
TupleUnsizing, TupleUnsizing,
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
pub struct Response<I: Interner> { pub struct Response<I: Interner> {
@ -284,15 +255,7 @@ pub struct Response<I: Interner> {
} }
/// Additional constraints returned on success. /// Additional constraints returned on success.
#[derive(derivative::Derivative)] #[derive_where(Clone, Hash, PartialEq, Eq, Debug, Default; I: Interner)]
#[derivative(
Clone(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = ""),
Default(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
pub struct ExternalConstraintsData<I: Interner> { pub struct ExternalConstraintsData<I: Interner> {
@ -301,15 +264,7 @@ pub struct ExternalConstraintsData<I: Interner> {
pub normalization_nested_goals: NestedNormalizationGoals<I>, pub normalization_nested_goals: NestedNormalizationGoals<I>,
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Hash, PartialEq, Eq, Debug, Default; I: Interner)]
#[derivative(
Clone(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = ""),
Default(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
pub struct NestedNormalizationGoals<I: Interner>(pub Vec<(GoalSource, Goal<I, I::Predicate>)>); pub struct NestedNormalizationGoals<I: Interner>(pub Vec<(GoalSource, Goal<I, I::Predicate>)>);
@ -386,8 +341,7 @@ impl MaybeCause {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(PartialEq, Eq, Debug; I: Interner)]
#[derivative(PartialEq(bound = ""), Eq(bound = ""), Debug(bound = ""))]
pub struct CacheData<I: Interner> { pub struct CacheData<I: Interner> {
pub result: QueryResult<I>, pub result: QueryResult<I>,
pub proof_tree: Option<I::CanonicalGoalEvaluationStepRef>, pub proof_tree: Option<I::CanonicalGoalEvaluationStepRef>,

View file

@ -1,3 +1,5 @@
use derive_where::derive_where;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
@ -64,8 +66,7 @@ impl AliasTyKind {
/// Types written by the user start out as `hir::TyKind` and get /// Types written by the user start out as `hir::TyKind` and get
/// converted to this representation using `<dyn HirTyLowerer>::lower_ty`. /// converted to this representation using `<dyn HirTyLowerer>::lower_ty`.
#[cfg_attr(feature = "nightly", rustc_diagnostic_item = "IrTyKind")] #[cfg_attr(feature = "nightly", rustc_diagnostic_item = "IrTyKind")]
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, Eq; I: Interner)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""), Eq(bound = ""))]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub enum TyKind<I: Interner> { pub enum TyKind<I: Interner> {
/// The primitive boolean type. Written as `bool`. /// The primitive boolean type. Written as `bool`.
@ -416,15 +417,7 @@ impl<I: Interner> fmt::Debug for TyKind<I> {
/// * For a projection, this would be `<Ty as Trait<...>>::N<...>`. /// * For a projection, this would be `<Ty as Trait<...>>::N<...>`.
/// * For an inherent projection, this would be `Ty::N<...>`. /// * For an inherent projection, this would be `Ty::N<...>`.
/// * For an opaque type, there is no explicit syntax. /// * For an opaque type, there is no explicit syntax.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(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))]
pub struct AliasTy<I: Interner> { pub struct AliasTy<I: Interner> {
@ -453,7 +446,7 @@ pub struct AliasTy<I: Interner> {
pub def_id: I::DefId, pub def_id: I::DefId,
/// This field exists to prevent the creation of `AliasTy` without using [`AliasTy::new_from_args`]. /// This field exists to prevent the creation of `AliasTy` without using [`AliasTy::new_from_args`].
#[derivative(Debug = "ignore")] #[derive_where(skip(Debug))]
pub(crate) _use_alias_ty_new_instead: (), pub(crate) _use_alias_ty_new_instead: (),
} }
@ -944,15 +937,7 @@ impl fmt::Debug for InferTy {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Hash(bound = ""),
Debug(bound = "")
)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
pub struct TypeAndMut<I: Interner> { pub struct TypeAndMut<I: Interner> {
@ -960,14 +945,7 @@ pub struct TypeAndMut<I: Interner> {
pub mutbl: Mutability, pub mutbl: Mutability,
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Hash(bound = "")
)]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))] #[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
pub struct FnSig<I: Interner> { pub struct FnSig<I: Interner> {

View file

@ -1,5 +1,6 @@
use std::ops::ControlFlow; use std::ops::ControlFlow;
use derive_where::derive_where;
use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic}; use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
use crate::fold::{shift_region, TypeFoldable, TypeFolder, TypeSuperFoldable}; use crate::fold::{shift_region, TypeFoldable, TypeFolder, TypeSuperFoldable};
@ -100,15 +101,7 @@ use crate::{self as ty, Interner};
/// * `GR`: The "return type", which is the type of value returned upon /// * `GR`: The "return type", which is the type of value returned upon
/// completion of the coroutine. /// completion of the coroutine.
/// * `GW`: The "coroutine witness". /// * `GW`: The "coroutine witness".
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
pub struct ClosureArgs<I: Interner> { pub struct ClosureArgs<I: Interner> {
/// Lifetime and type parameters from the enclosing function, /// Lifetime and type parameters from the enclosing function,
@ -210,15 +203,7 @@ impl<I: Interner> ClosureArgs<I> {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
pub struct CoroutineClosureArgs<I: Interner> { pub struct CoroutineClosureArgs<I: Interner> {
pub args: I::GenericArgs, pub args: I::GenericArgs,
@ -370,15 +355,7 @@ impl<I: Interner> TypeVisitor<I> for HasRegionsBoundAt {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
pub struct CoroutineClosureSignature<I: Interner> { pub struct CoroutineClosureSignature<I: Interner> {
pub interior: I::Ty, pub interior: I::Ty,
@ -552,15 +529,7 @@ impl<I: Interner> TypeFolder<I> for FoldEscapingRegions<I> {
} }
} }
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic)]
pub struct GenSig<I: Interner> { pub struct GenSig<I: Interner> {
pub resume_ty: I::Ty, pub resume_ty: I::Ty,
@ -569,15 +538,7 @@ pub struct GenSig<I: Interner> {
} }
/// Similar to `ClosureArgs`; see the above documentation for more. /// Similar to `ClosureArgs`; see the above documentation for more.
#[derive(derivative::Derivative)] #[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
Hash(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Debug(bound = "")
)]
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)] #[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
pub struct CoroutineArgs<I: Interner> { pub struct CoroutineArgs<I: Interner> {
pub args: I::GenericArgs, pub args: I::GenericArgs,

View file

@ -31,7 +31,7 @@ error: rustc_dump_item_bounds
LL | type Assoc<P: Eq>: std::ops::Deref<Target = ()> LL | type Assoc<P: Eq>: std::ops::Deref<Target = ()>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: Binder { value: ProjectionPredicate(AliasTerm { args: [Alias(Projection, AliasTy { args: [Self/#0, T/#1, P/#2], def_id: DefId(..) })], def_id: DefId(..) }, Term::Ty(())), bound_vars: [] } = note: Binder { value: ProjectionPredicate(AliasTerm { args: [Alias(Projection, AliasTy { args: [Self/#0, T/#1, P/#2], def_id: DefId(..), .. })], def_id: DefId(..), .. }, Term::Ty(())), bound_vars: [] }
= note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<P> as std::ops::Deref>, polarity:Positive), bound_vars: [] } = note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<P> as std::ops::Deref>, polarity:Positive), bound_vars: [] }
= note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<P> as std::marker::Sized>, polarity:Positive), bound_vars: [] } = note: Binder { value: TraitPredicate(<<Self as Trait<T>>::Assoc<P> as std::marker::Sized>, polarity:Positive), bound_vars: [] }

View file

@ -1,7 +1,7 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())` error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
--> $DIR/associated-type.rs:31:1 --> $DIR/associated-type.rs:31:1
| |

View file

@ -1,11 +1,11 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)` error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)`
--> $DIR/associated-type.rs:31:1 --> $DIR/associated-type.rs:31:1
| |

View file

@ -1,5 +1,5 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
--> $DIR/structually-relate-aliases.rs:13:36 --> $DIR/structually-relate-aliases.rs:13:36
| |

View file

@ -25,10 +25,10 @@ help: this trait has no implementations, consider adding one
LL | trait ToUnit<'a> { LL | trait ToUnit<'a> {
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)` error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)`
--> $DIR/issue-118950-root-region.rs:19:1 --> $DIR/issue-118950-root-region.rs:19:1
| |