#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(dead_code)]
use const_struct_version::StructVersion;
struct NestedStruct {
a: u32,
b: f32,
c: NestedStruct2,
}
#[doc(hidden)]
const _: () = {
extern crate const_struct_version as _const_struct_version;
use _const_struct_version::__private::sha1::Digest as _;
#[automatically_derived]
impl _const_struct_version::StructVersion for NestedStruct {
fn version() -> String {
let mut hasher = _const_struct_version::__private::sha1::Sha1::new();
hasher.update("a");
hasher
.update(
<u32 as _const_struct_version::StructVersion>::version().as_bytes(),
);
hasher.update("b");
hasher
.update(
<f32 as _const_struct_version::StructVersion>::version().as_bytes(),
);
hasher.update("c");
hasher
.update(
<NestedStruct2 as _const_struct_version::StructVersion>::version()
.as_bytes(),
);
::alloc::__export::must_use({
let res = ::alloc::fmt::format(format_args!("{0:x}", hasher.finalize()));
res
})
}
}
};
impl NestedStruct {
fn version_cached() -> &'static str {
extern crate const_struct_version as _const_struct_version;
static VERSION: ::std::sync::OnceLock<String> = ::std::sync::OnceLock::new();
VERSION.get_or_init(|| <Self as _const_struct_version::StructVersion>::version())
}
}
struct NestedStruct2 {
a: u32,
b: f32,
}
#[doc(hidden)]
const _: () = {
extern crate const_struct_version as _const_struct_version;
use _const_struct_version::__private::sha1::Digest as _;
#[automatically_derived]
impl _const_struct_version::StructVersion for NestedStruct2 {
fn version() -> String {
let mut hasher = _const_struct_version::__private::sha1::Sha1::new();
hasher.update("a");
hasher
.update(
<u32 as _const_struct_version::StructVersion>::version().as_bytes(),
);
hasher.update("b");
hasher
.update(
<f32 as _const_struct_version::StructVersion>::version().as_bytes(),
);
::alloc::__export::must_use({
let res = ::alloc::fmt::format(format_args!("{0:x}", hasher.finalize()));
res
})
}
}
};
impl NestedStruct2 {
fn version_cached() -> &'static str {
extern crate const_struct_version as _const_struct_version;
static VERSION: ::std::sync::OnceLock<String> = ::std::sync::OnceLock::new();
VERSION.get_or_init(|| <Self as _const_struct_version::StructVersion>::version())
}
}
fn test_nested_structs_work() {
let version = <NestedStruct as StructVersion>::version();
}
#[rustc_main]
#[coverage(off)]
#[doc(hidden)]
pub fn main() -> () {
extern crate test;
test::test_main_static(&[])
}