@@ -71,6 +71,8 @@ pub struct Environment<I: Interner> {
71
71
pub clauses : ProgramClauses < I > ,
72
72
}
73
73
74
+ impl < I : Interner > Copy for Environment < I > where I :: InternedProgramClauses : Copy { }
75
+
74
76
impl < I : Interner > Environment < I > {
75
77
/// Creates a new environment.
76
78
pub fn new ( interner : & I ) -> Self {
@@ -99,6 +101,11 @@ pub struct InEnvironment<G: HasInterner> {
99
101
pub goal : G ,
100
102
}
101
103
104
+ impl < G : HasInterner < Interner = I > + Copy , I : Interner > Copy for InEnvironment < G > where
105
+ I :: InternedProgramClauses : Copy
106
+ {
107
+ }
108
+
102
109
impl < G : HasInterner > InEnvironment < G > {
103
110
/// Creates a new environment/goal pair.
104
111
pub fn new ( environment : & Environment < G :: Interner > , goal : G ) -> Self {
@@ -482,6 +489,15 @@ pub enum TyData<I: Interner> {
482
489
InferenceVar ( InferenceVar , TyKind ) ,
483
490
}
484
491
492
+ impl < I : Interner > Copy for TyData < I >
493
+ where
494
+ I :: InternedLifetime : Copy ,
495
+ I :: InternedSubstitution : Copy ,
496
+ I :: InternedVariableKinds : Copy ,
497
+ I :: InternedQuantifiedWhereClauses : Copy ,
498
+ {
499
+ }
500
+
485
501
impl < I : Interner > TyData < I > {
486
502
/// Casts the type data to a type.
487
503
pub fn intern ( self , interner : & I ) -> Ty < I > {
@@ -770,6 +786,14 @@ pub struct DynTy<I: Interner> {
770
786
pub lifetime : Lifetime < I > ,
771
787
}
772
788
789
+ impl < I : Interner > Copy for DynTy < I >
790
+ where
791
+ I :: InternedLifetime : Copy ,
792
+ I :: InternedQuantifiedWhereClauses : Copy ,
793
+ I :: InternedVariableKinds : Copy ,
794
+ {
795
+ }
796
+
773
797
/// A type, lifetime or constant whose value is being inferred.
774
798
#[ derive( Copy , Clone , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
775
799
pub struct InferenceVar {
@@ -817,8 +841,10 @@ pub struct Fn<I: Interner> {
817
841
pub substitution : Substitution < I > ,
818
842
}
819
843
844
+ impl < I : Interner > Copy for Fn < I > where I :: InternedSubstitution : Copy { }
845
+
820
846
/// Constants.
821
- #[ derive( Clone , PartialEq , Eq , Hash , PartialOrd , Ord , HasInterner ) ]
847
+ #[ derive( Copy , Clone , PartialEq , Eq , Hash , PartialOrd , Ord , HasInterner ) ]
822
848
pub struct Const < I : Interner > {
823
849
interned : I :: InternedConst ,
824
850
}
@@ -893,6 +919,8 @@ pub enum ConstValue<I: Interner> {
893
919
Concrete ( ConcreteConst < I > ) ,
894
920
}
895
921
922
+ impl < I : Interner > Copy for ConstValue < I > where I :: InternedConcreteConst : Copy { }
923
+
896
924
impl < I : Interner > ConstData < I > {
897
925
/// Wraps the constant data in a `Const`.
898
926
pub fn intern ( self , interner : & I ) -> Const < I > {
@@ -902,7 +930,7 @@ impl<I: Interner> ConstData<I> {
902
930
903
931
/// Concrete constant, whose value is known (as opposed to
904
932
/// inferred constants and placeholders).
905
- #[ derive( Clone , PartialEq , Eq , Hash , PartialOrd , Ord , HasInterner ) ]
933
+ #[ derive( Copy , Clone , PartialEq , Eq , Hash , PartialOrd , Ord , HasInterner ) ]
906
934
pub struct ConcreteConst < I : Interner > {
907
935
/// The interned constant.
908
936
pub interned : I :: InternedConcreteConst ,
@@ -1032,6 +1060,8 @@ pub struct ApplicationTy<I: Interner> {
1032
1060
pub substitution : Substitution < I > ,
1033
1061
}
1034
1062
1063
+ impl < I : Interner > Copy for ApplicationTy < I > where I :: InternedSubstitution : Copy { }
1064
+
1035
1065
impl < I : Interner > ApplicationTy < I > {
1036
1066
/// Create an interned type from this application type.
1037
1067
pub fn intern ( self , interner : & I ) -> Ty < I > {
@@ -1084,6 +1114,8 @@ pub enum VariableKind<I: Interner> {
1084
1114
Const ( Ty < I > ) ,
1085
1115
}
1086
1116
1117
+ impl < I : Interner > Copy for VariableKind < I > where I :: InternedType : Copy { }
1118
+
1087
1119
impl < I : Interner > VariableKind < I > {
1088
1120
fn to_bound_variable ( & self , interner : & I , bound_var : BoundVar ) -> GenericArg < I > {
1089
1121
match self {
@@ -1189,6 +1221,14 @@ pub enum GenericArgData<I: Interner> {
1189
1221
Const ( Const < I > ) ,
1190
1222
}
1191
1223
1224
+ impl < I : Interner > Copy for GenericArgData < I >
1225
+ where
1226
+ I :: InternedType : Copy ,
1227
+ I :: InternedLifetime : Copy ,
1228
+ I :: InternedConst : Copy ,
1229
+ {
1230
+ }
1231
+
1192
1232
impl < I : Interner > GenericArgData < I > {
1193
1233
/// Create an interned type.
1194
1234
pub fn intern ( self , interner : & I ) -> GenericArg < I > {
@@ -1205,6 +1245,8 @@ pub struct WithKind<I: Interner, T> {
1205
1245
value : T ,
1206
1246
}
1207
1247
1248
+ impl < I : Interner , T : Copy > Copy for WithKind < I , T > where I :: InternedType : Copy { }
1249
+
1208
1250
impl < I : Interner , T > HasInterner for WithKind < I , T > {
1209
1251
type Interner = I ;
1210
1252
}
@@ -1262,6 +1304,8 @@ pub enum AliasTy<I: Interner> {
1262
1304
Opaque ( OpaqueTy < I > ) ,
1263
1305
}
1264
1306
1307
+ impl < I : Interner > Copy for AliasTy < I > where I :: InternedSubstitution : Copy { }
1308
+
1265
1309
impl < I : Interner > AliasTy < I > {
1266
1310
/// Create an interned type for this alias.
1267
1311
pub fn intern ( self , interner : & I ) -> Ty < I > {
@@ -1291,6 +1335,8 @@ pub struct ProjectionTy<I: Interner> {
1291
1335
pub substitution : Substitution < I > ,
1292
1336
}
1293
1337
1338
+ impl < I : Interner > Copy for ProjectionTy < I > where I :: InternedSubstitution : Copy { }
1339
+
1294
1340
/// An opaque type `opaque type T<..>: Trait = HiddenTy`.
1295
1341
#[ derive( Clone , PartialEq , Eq , Hash , Fold , Visit , HasInterner , Zip ) ]
1296
1342
pub struct OpaqueTy < I : Interner > {
@@ -1300,6 +1346,8 @@ pub struct OpaqueTy<I: Interner> {
1300
1346
pub substitution : Substitution < I > ,
1301
1347
}
1302
1348
1349
+ impl < I : Interner > Copy for OpaqueTy < I > where I :: InternedSubstitution : Copy { }
1350
+
1303
1351
/// A trait reference describes the relationship between a type and a trait.
1304
1352
/// This can be used in two forms:
1305
1353
/// - `P0: Trait<P1..Pn>` (e.g. `i32: Copy`), which mentions that the type
@@ -1314,6 +1362,8 @@ pub struct TraitRef<I: Interner> {
1314
1362
pub substitution : Substitution < I > ,
1315
1363
}
1316
1364
1365
+ impl < I : Interner > Copy for TraitRef < I > where I :: InternedSubstitution : Copy { }
1366
+
1317
1367
impl < I : Interner > TraitRef < I > {
1318
1368
/// Gets all type parameters in this trait ref, including `Self`.
1319
1369
pub fn type_parameters < ' a > ( & ' a self , interner : & ' a I ) -> impl Iterator < Item = Ty < I > > + ' a {
@@ -1347,6 +1397,9 @@ pub struct LifetimeOutlives<I: Interner> {
1347
1397
pub a : Lifetime < I > ,
1348
1398
pub b : Lifetime < I > ,
1349
1399
}
1400
+
1401
+ impl < I : Interner > Copy for LifetimeOutlives < I > where I :: InternedLifetime : Copy { }
1402
+
1350
1403
/// Where clauses that can be written by a Rust programmer.
1351
1404
#[ derive( Clone , PartialEq , Eq , Hash , Fold , SuperVisit , HasInterner , Zip ) ]
1352
1405
pub enum WhereClause < I : Interner > {
@@ -1358,6 +1411,14 @@ pub enum WhereClause<I: Interner> {
1358
1411
LifetimeOutlives ( LifetimeOutlives < I > ) ,
1359
1412
}
1360
1413
1414
+ impl < I : Interner > Copy for WhereClause < I >
1415
+ where
1416
+ I :: InternedSubstitution : Copy ,
1417
+ I :: InternedLifetime : Copy ,
1418
+ I :: InternedType : Copy ,
1419
+ {
1420
+ }
1421
+
1361
1422
/// Checks whether a type or trait ref is well-formed.
1362
1423
#[ derive( Clone , PartialEq , Eq , Hash , Fold , Visit , HasInterner , Zip ) ]
1363
1424
pub enum WellFormed < I : Interner > {
@@ -1389,6 +1450,13 @@ pub enum WellFormed<I: Interner> {
1389
1450
Ty ( Ty < I > ) ,
1390
1451
}
1391
1452
1453
+ impl < I : Interner > Copy for WellFormed < I >
1454
+ where
1455
+ I :: InternedType : Copy ,
1456
+ I :: InternedSubstitution : Copy ,
1457
+ {
1458
+ }
1459
+
1392
1460
/// Checks whether a type or trait ref can be derived from the contents of the environment.
1393
1461
#[ derive( Clone , PartialEq , Eq , Hash , Fold , Visit , HasInterner , Zip ) ]
1394
1462
pub enum FromEnv < I : Interner > {
@@ -1419,6 +1487,13 @@ pub enum FromEnv<I: Interner> {
1419
1487
Ty ( Ty < I > ) ,
1420
1488
}
1421
1489
1490
+ impl < I : Interner > Copy for FromEnv < I >
1491
+ where
1492
+ I :: InternedType : Copy ,
1493
+ I :: InternedSubstitution : Copy ,
1494
+ {
1495
+ }
1496
+
1422
1497
/// A "domain goal" is a goal that is directly about Rust, rather than a pure
1423
1498
/// logical statement. As much as possible, the Chalk solver should avoid
1424
1499
/// decomposing this enum, and instead treat its values opaquely.
@@ -1496,6 +1571,14 @@ pub enum DomainGoal<I: Interner> {
1496
1571
ObjectSafe ( TraitId < I > ) ,
1497
1572
}
1498
1573
1574
+ impl < I : Interner > Copy for DomainGoal < I >
1575
+ where
1576
+ I :: InternedSubstitution : Copy ,
1577
+ I :: InternedLifetime : Copy ,
1578
+ I :: InternedType : Copy ,
1579
+ {
1580
+ }
1581
+
1499
1582
/// A where clause that can contain `forall<>` or `exists<>` quantifiers.
1500
1583
pub type QuantifiedWhereClause < I > = Binders < WhereClause < I > > ;
1501
1584
@@ -1647,6 +1730,8 @@ pub struct EqGoal<I: Interner> {
1647
1730
pub b : GenericArg < I > ,
1648
1731
}
1649
1732
1733
+ impl < I : Interner > Copy for EqGoal < I > where I :: InternedGenericArg : Copy { }
1734
+
1650
1735
/// Proves that the given type alias **normalizes** to the given
1651
1736
/// type. A projection `T::Foo` normalizes to the type `U` if we can
1652
1737
/// **match it to an impl** and that impl has a `type Foo = V` where
@@ -1658,6 +1743,13 @@ pub struct Normalize<I: Interner> {
1658
1743
pub ty : Ty < I > ,
1659
1744
}
1660
1745
1746
+ impl < I : Interner > Copy for Normalize < I >
1747
+ where
1748
+ I :: InternedSubstitution : Copy ,
1749
+ I :: InternedType : Copy ,
1750
+ {
1751
+ }
1752
+
1661
1753
/// Proves **equality** between an alias and a type.
1662
1754
#[ derive( Clone , PartialEq , Eq , Hash , Fold , Visit , Zip ) ]
1663
1755
#[ allow( missing_docs) ]
@@ -1666,6 +1758,13 @@ pub struct AliasEq<I: Interner> {
1666
1758
pub ty : Ty < I > ,
1667
1759
}
1668
1760
1761
+ impl < I : Interner > Copy for AliasEq < I >
1762
+ where
1763
+ I :: InternedSubstitution : Copy ,
1764
+ I :: InternedType : Copy ,
1765
+ {
1766
+ }
1767
+
1669
1768
impl < I : Interner > HasInterner for AliasEq < I > {
1670
1769
type Interner = I ;
1671
1770
}
@@ -1686,6 +1785,11 @@ pub struct Binders<T: HasInterner> {
1686
1785
value : T ,
1687
1786
}
1688
1787
1788
+ impl < T : HasInterner + Copy > Copy for Binders < T > where
1789
+ <T :: Interner as Interner >:: InternedVariableKinds : Copy
1790
+ {
1791
+ }
1792
+
1689
1793
impl < T : HasInterner > HasInterner for Binders < T > {
1690
1794
type Interner = T :: Interner ;
1691
1795
}
@@ -2460,6 +2564,19 @@ pub enum GoalData<I: Interner> {
2460
2564
CannotProve ( ( ) ) ,
2461
2565
}
2462
2566
2567
+ impl < I : Interner > Copy for GoalData < I >
2568
+ where
2569
+ I :: InternedType : Copy ,
2570
+ I :: InternedLifetime : Copy ,
2571
+ I :: InternedGenericArg : Copy ,
2572
+ I :: InternedSubstitution : Copy ,
2573
+ I :: InternedGoal : Copy ,
2574
+ I :: InternedGoals : Copy ,
2575
+ I :: InternedProgramClauses : Copy ,
2576
+ I :: InternedVariableKinds : Copy ,
2577
+ {
2578
+ }
2579
+
2463
2580
impl < I : Interner > GoalData < I > {
2464
2581
/// Create an interned goal.
2465
2582
pub fn intern ( self , interner : & I ) -> Goal < I > {
@@ -2501,6 +2618,8 @@ pub enum Constraint<I: Interner> {
2501
2618
Outlives ( Lifetime < I > , Lifetime < I > ) ,
2502
2619
}
2503
2620
2621
+ impl < I : Interner > Copy for Constraint < I > where I :: InternedLifetime : Copy { }
2622
+
2504
2623
/// A mapping of inference variables to instantiations thereof.
2505
2624
#[ derive( Copy , Clone , PartialEq , Eq , Hash , HasInterner ) ]
2506
2625
pub struct Substitution < I : Interner > {
0 commit comments