Skip to content

Commit

Permalink
implement new effects desugaring
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Jun 28, 2024
1 parent 8c3c7dc commit cc4a029
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
#![feature(let_chains)]
#![feature(link_llvm_intrinsics)]
#![feature(macro_metavar_expr)]
#![feature(marker_trait_attr)]
#![feature(min_exhaustive_patterns)]
#![feature(min_specialization)]
#![feature(multiple_supertrait_upcastable)]
Expand Down
38 changes: 38 additions & 0 deletions core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,3 +1027,41 @@ pub trait FnPtr: Copy + Clone {
pub macro SmartPointer($item:item) {
/* compiler built-in */
}

#[doc(hidden)]
#[unstable(
feature = "effect_types",
issue = "none",
reason = "internal module for implementing effects"
)]
#[allow(missing_debug_implementations)] // these unit structs don't need `Debug` impls.
#[cfg(not(bootstrap))]
// TODO docs
pub mod effects {
#[lang = "EffectsNoRuntime"]
pub struct NoRuntime;
#[lang = "EffectsMaybe"]
pub struct Maybe;
#[lang = "EffectsRuntime"]
pub struct Runtime;

#[lang = "EffectsCompat"]
pub trait Compat<#[rustc_runtime] const RUNTIME: bool> {}

impl Compat<false> for NoRuntime {}
impl Compat<true> for Runtime {}
impl<#[rustc_runtime] const RUNTIME: bool> Compat<RUNTIME> for Maybe {}

#[lang = "EffectsTyCompat"]
#[marker]
pub trait TyCompat<T> {}

impl<T> TyCompat<T> for T {}
impl<T> TyCompat<T> for Maybe {}

#[lang = "EffectsMin"]
pub trait Min {
#[lang = "EffectsMinOutput"]
type Output;
}
}

0 comments on commit cc4a029

Please sign in to comment.