use crate::vestibule::*;
pub
fn materialize_unchecked<T> (
_: Ghost<T>,
) -> T
{
#![allow(unconditional_recursion)]
struct OutsideOfAGhostBlockError(u8);
materialize_unchecked::<(T, OutsideOfAGhostBlockError)>(Ghost).0
}
pub use __::Ectoplasm;
#[allow(unreachable_code)]
mod __ {
#[allow(unused)]
use super::*;
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub
struct Ectoplasm(pub(super) ::never_say_never::Never);
}
impl Ectoplasm {
pub
fn materialize<T> (
self,
_: Ghost<T>,
) -> T
{
self.0
}
}
#[cfg(feature = "better-docs")]
#[doc(cfg(ghostǃ))]
#[macro_export]
macro_rules! materialize {( $ghost:expr $(,)? ) => (
$crate::ඞ::core::compile_error! {"\
Did you really enabled the `better-docs` internal feature just to try \
and call this fake macro??\
"}
)}
#[doc(hidden)]
#[cfg(feature = "better-docs")]
pub use docsrs_y_u_do_dis::*;
#[doc(hidden)]
#[cfg(feature = "better-docs")]
pub mod docsrs_y_u_do_dis {
pub use materialize;
}
#[macro_export]
macro_rules! ghost {
( $($_:tt)* ) => (
$crate::ඞ__ghost! {
[normal_attrs ]
[no_init false]
$($_)*
}
);
(
$( #[tag($meta:meta)] )?
$( #[no_init] )?
$( #[no_dropck] )?
$( |$ghost_ctx:pat| )?
$expr_or_block:expr
) => (
$crate::::core::compile_error! { "unreachable" }
);
}
#[doc(hidden)] #[macro_export]
macro_rules! ඞ__ghost {
(
$normal_attrs:tt
$no_init:tt
#[no_init]
$($rest:tt)*
) => (
$crate::ඞ__ghost! {
$normal_attrs
[no_init true]
$($rest)*
}
);
(
$normal_attrs:tt
$no_init:tt
#[no_dropck]
$($rest:tt)*
) => (
$crate::ඞ__ghost! {
$normal_attrs
[no_init no_dropck]
$($rest)*
}
);
(
$normal_attrs:tt
$no_init:tt
#[tag($attr:meta)]
$($rest:tt)*
) => (
$crate::ඞ__ghost! {
$normal_attrs
$no_init
$($rest)*
}
);
(
[normal_attrs
$($attrs:tt)*
]
$no_init:tt
#[$attr:meta]
$($rest:tt)*
) => (
$crate::ඞ__ghost! {
[normal_attrs
$($attrs:tt)*
#[$attr]
]
$no_init
$($rest)*
}
);
(
[normal_attrs
$($attrs:tt)*
]
[no_init
$(false)?
$(true $(if $no_init:tt)?)?
$(no_dropck $(if $no_dropck:tt)?)?
]
|$ghost_ctx:pat_param| $expr_or_block:expr
) => ({
let it = $crate::Ghost;
#[allow(unreachable_code)]
if false {
#[allow(unused_macros)]
macro_rules! materialize {
( $e:expr , ) => ( materialize!($e) );
( $e:expr ) => (
$crate::materialize_unchecked(
$($attrs)*
$e
)
);
}
let $ghost_ctx = $crate::ectoplasm!();
$($(if $no_dropck)?
loop {}
)?
#[warn(unreachable_code)]
it.__set($expr_or_block);
$($(if $no_init)?
loop {}
)?
}
$crate::ඞ::Flatten::__flatten(it)
});
(
[normal_attrs
$($attrs:tt)*
]
[no_init
$(false)?
$(true $(if $no_init:tt)?)?
$(no_dropck $(if $no_dropck:tt)?)?
]
$expr_or_block:expr
) => ({
let it = $crate::Ghost;
#[allow(unreachable_code)]
if false {
#[allow(unused_macros)]
macro_rules! materialize {
( $e:expr , ) => ( materialize!($e) );
( $e:expr ) => (
$crate::materialize_unchecked(
$($attrs)*
$e
)
);
}
$($(if $no_dropck)?
loop {}
)?
#[warn(unreachable_code)]
it.__set($expr_or_block);
$($(if $no_init)?
loop {}
)?
$($(if $no_init)?
loop {}
)?
}
$crate::ඞ::Flatten::__flatten(it)
});
}
#[macro_export]
macro_rules! materialize_return {() => ({
let ret = materialize!($crate::Ghost);
if false {
return ret;
} else {
ret
}
})}
#[macro_export]
macro_rules! ectoplasm {() => (
materialize!(
$crate::Ghost::<$crate::ඞ::core::marker::PhantomData<$crate::Ectoplasm>>
)
)}
pub(in crate)
mod flatten {
use crate::vestibule::*;
#[doc(hidden)]
pub trait Flatten<T : ?Sized, CoherenceDisambiguator = ()> : Sized {
fn __flatten (_: Self)
-> Ghost<T>
;
}
impl<T : ?Sized> Flatten<T> for Ghost<T> {
#[inline]
fn __flatten (_: Ghost<T>)
-> Ghost<T>
{
Ghost
}
}
impl<T : ?Sized, G> Flatten<T, G> for Ghost<G>
where
G : Flatten<T>,
{
#[inline]
fn __flatten (_: Ghost<G>)
-> Ghost<T>
{
Ghost
}
}
}