-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tried fixing prefix_type::WithMetadata_ declaration for future fix of…
… MSVC abi fix. Tried fixing marker type declarations to be zero sized after MSVC abi. This commit assumes that this issue will get resolved to "#[repr(C)] structs can't be zero-sized": rust-lang/rust#81996
- Loading branch information
1 parent
5fc89e5
commit ef99da4
Showing
5 changed files
with
177 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Delete this once the abi_stable version number isn't 0.9 | ||
// | ||
macro_rules! monomorphic_marker_type { | ||
($name:ident, $field:ty) => { | ||
#[allow(non_upper_case_globals)] | ||
const _: () = {monomorphic_marker_type!{@inner $name, $field}}; | ||
}; | ||
(@inner $name:ident, $field:ty) => { | ||
const _item_info_const_: abi_stable::type_layout::ItemInfo = | ||
abi_stable::make_item_info!(); | ||
const _SHARED_VARS_STRINGS_: ::abi_stable::std_types::RStr<'static> = | ||
abi_stable::std_types::RStr::from_str("_marker;"); | ||
|
||
use ::abi_stable::derive_macro_reexports::{self as __sabi_re, renamed::*}; | ||
pub struct _static_(extern "C" fn()); | ||
unsafe impl __GetStaticEquivalent_ for $name { | ||
type StaticEquivalent = _static_; | ||
} | ||
#[doc(hidden)] | ||
pub(super) const _MONO_LAYOUT_: &'static __sabi_re::MonoTypeLayout = | ||
&__sabi_re::MonoTypeLayout::from_derive(__sabi_re::_private_MonoTypeLayoutDerive { | ||
name: abi_stable::std_types::RStr::from_str(stringify!($name)), | ||
item_info: _item_info_const_, | ||
data: __sabi_re::MonoTLData::derive_struct(__CompTLFields::new( | ||
abi_stable::std_types::RSlice::from_slice(&[562949953880064u64]), | ||
None, | ||
)), | ||
generics: abi_stable :: | ||
tl_genparams ! | ||
(; __StartLen :: new(0u16, 0u16) ; __StartLen :: | ||
new(0u16, 0u16)), | ||
mod_refl_mode: __ModReflMode::Opaque, | ||
repr_attr: __ReprAttr::C, | ||
phantom_fields: abi_stable::std_types::RSlice::from_slice(&[]), | ||
shared_vars: abi_stable::type_layout::MonoSharedVars::new( | ||
_SHARED_VARS_STRINGS_, | ||
abi_stable::std_types::RSlice::from_slice(&[]), | ||
), | ||
}); | ||
impl $name { | ||
const __SABI_CONST_PARAMS_A: &'static [&'static __sabi_re::ConstGenericErasureHack< | ||
dyn ::std::marker::Send, | ||
>] = &[]; | ||
const __SABI_CONST_PARAMS_B: &'static [__ConstGeneric] = &[]; | ||
const __SABI_SHARED_VARS: &'static __sabi_re::SharedVars = | ||
&abi_stable::type_layout::SharedVars::new( | ||
_MONO_LAYOUT_.shared_vars_static(), | ||
abi_stable::_sabi_type_layouts!($field,), | ||
__sabi_re::RSlice::from_slice(Self::__SABI_CONST_PARAMS_B), | ||
); | ||
} | ||
unsafe impl __sabi_re::StableAbi for $name { | ||
type IsNonZeroType = __sabi_re::False; | ||
const LAYOUT: &'static __sabi_re::TypeLayout = { | ||
["Expected this to be Zero-sized"][(std::mem::size_of::<Self>() != 0) as usize]; | ||
["Expected this to be 1 aligned"][(std::mem::align_of::<Self>() != 1) as usize]; | ||
|
||
&__sabi_re::TypeLayout::from_derive::<Self>(__sabi_re::_private_TypeLayoutDerive { | ||
shared_vars: Self::__SABI_SHARED_VARS, | ||
mono: _MONO_LAYOUT_, | ||
abi_consts: Self::ABI_CONSTS, | ||
data: __sabi_re::GenericTLData::Struct, | ||
tag: None, | ||
extra_checks: None, | ||
}) | ||
}; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters