@@ -1024,3 +1024,49 @@ pub trait FnPtr: Copy + Clone { |
|
|
1024 |
1024 |
pub macro SmartPointer($item:item) { |
1025 |
1025 |
/* compiler built-in */ |
1026 |
1026 |
} |
|
1027 |
+ |
|
1028 |
+// Support traits and types for the desugaring of const traits and |
|
1029 |
+// `~const` bounds. Not supposed to be used by anything other than |
|
1030 |
+// the compiler. |
|
1031 |
+#[doc(hidden)] |
|
1032 |
+#[unstable( |
|
1033 |
+ feature = "effect_types", |
|
1034 |
+ issue = "none", |
|
1035 |
+ reason = "internal module for implementing effects" |
|
1036 |
+)] |
|
1037 |
+#[allow(missing_debug_implementations)] // these unit structs don't need `Debug` impls. |
|
1038 |
+#[cfg(not(bootstrap))] |
|
1039 |
+pub mod effects { |
|
1040 |
+#[lang = "EffectsNoRuntime"] |
|
1041 |
+pub struct NoRuntime; |
|
1042 |
+#[lang = "EffectsMaybe"] |
|
1043 |
+pub struct Maybe; |
|
1044 |
+#[lang = "EffectsRuntime"] |
|
1045 |
+pub struct Runtime; |
|
1046 |
+ |
|
1047 |
+#[lang = "EffectsCompat"] |
|
1048 |
+pub trait Compat<#[rustc_runtime] const RUNTIME: bool> {} |
|
1049 |
+ |
|
1050 |
+impl Compat<false> for NoRuntime {} |
|
1051 |
+impl Compat<true> for Runtime {} |
|
1052 |
+impl<#[rustc_runtime] const RUNTIME: bool> Compat<RUNTIME> for Maybe {} |
|
1053 |
+ |
|
1054 |
+#[lang = "EffectsTyCompat"] |
|
1055 |
+#[marker] |
|
1056 |
+pub trait TyCompat<T: ?Sized> {} |
|
1057 |
+ |
|
1058 |
+impl<T: ?Sized> TyCompat<T> for T {} |
|
1059 |
+impl<T: ?Sized> TyCompat<T> for Maybe {} |
|
1060 |
+impl<T: ?Sized> TyCompat<Maybe> for T {} |
|
1061 |
+ |
|
1062 |
+#[lang = "EffectsIntersection"] |
|
1063 |
+pub trait Intersection { |
|
1064 |
+#[lang = "EffectsIntersectionOutput"] |
|
1065 |
+type Output: ?Sized; |
|
1066 |
+} |
|
1067 |
+ |
|
1068 |
+// FIXME(effects): remove this after next trait solver lands |
|
1069 |
+impl Intersection for () { |
|
1070 |
+type Output = Maybe; |
|
1071 |
+} |
|
1072 |
+} |