Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions crates/component-macro/tests/expanded/dead-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,56 @@ pub mod a {
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::{anyhow, Box};
pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType;
const _: () = {
assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < LiveType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(record)]
#[derive(Clone, Copy)]
pub struct DeadType {
#[component(name = "a")]
pub a: u32,
}
impl core::fmt::Debug for DeadType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("DeadType").field("a", &self.a).finish()
}
}
const _: () = {
assert!(4 == < DeadType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < DeadType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(variant)]
#[derive(Clone, Copy)]
pub enum V {
#[component(name = "a")]
A(LiveType),
#[component(name = "b")]
B(DeadType),
}
impl core::fmt::Debug for V {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
V::A(e) => f.debug_tuple("V::A").field(e).finish(),
V::B(e) => f.debug_tuple("V::B").field(e).finish(),
}
}
}
const _: () = {
assert!(8 == < V as wasmtime::component::ComponentType >::SIZE32);
assert!(4 == < V as wasmtime::component::ComponentType >::ALIGN32);
};
pub trait Host {}
pub trait GetHost<
T,
Expand Down
50 changes: 50 additions & 0 deletions crates/component-macro/tests/expanded/dead-code_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,56 @@ pub mod a {
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::{anyhow, Box};
pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType;
const _: () = {
assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < LiveType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(record)]
#[derive(Clone, Copy)]
pub struct DeadType {
#[component(name = "a")]
pub a: u32,
}
impl core::fmt::Debug for DeadType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("DeadType").field("a", &self.a).finish()
}
}
const _: () = {
assert!(4 == < DeadType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < DeadType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(variant)]
#[derive(Clone, Copy)]
pub enum V {
#[component(name = "a")]
A(LiveType),
#[component(name = "b")]
B(DeadType),
}
impl core::fmt::Debug for V {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
V::A(e) => f.debug_tuple("V::A").field(e).finish(),
V::B(e) => f.debug_tuple("V::B").field(e).finish(),
}
}
}
const _: () = {
assert!(8 == < V as wasmtime::component::ComponentType >::SIZE32);
assert!(4 == < V as wasmtime::component::ComponentType >::ALIGN32);
};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {}
pub trait GetHost<
Expand Down
50 changes: 50 additions & 0 deletions crates/component-macro/tests/expanded/dead-code_concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,56 @@ pub mod a {
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::{anyhow, Box};
pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType;
const _: () = {
assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < LiveType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(record)]
#[derive(Clone, Copy)]
pub struct DeadType {
#[component(name = "a")]
pub a: u32,
}
impl core::fmt::Debug for DeadType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("DeadType").field("a", &self.a).finish()
}
}
const _: () = {
assert!(4 == < DeadType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < DeadType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(variant)]
#[derive(Clone, Copy)]
pub enum V {
#[component(name = "a")]
A(LiveType),
#[component(name = "b")]
B(DeadType),
}
impl core::fmt::Debug for V {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
V::A(e) => f.debug_tuple("V::A").field(e).finish(),
V::B(e) => f.debug_tuple("V::B").field(e).finish(),
}
}
}
const _: () = {
assert!(8 == < V as wasmtime::component::ComponentType >::SIZE32);
assert!(4 == < V as wasmtime::component::ComponentType >::ALIGN32);
};
pub trait Host {}
pub trait GetHost<
T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,56 @@ pub mod a {
pub mod interface_with_dead_type {
#[allow(unused_imports)]
use wasmtime::component::__internal::{anyhow, Box};
pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType;
const _: () = {
assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < LiveType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(record)]
#[derive(Clone, Copy)]
pub struct DeadType {
#[component(name = "a")]
pub a: u32,
}
impl core::fmt::Debug for DeadType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("DeadType").field("a", &self.a).finish()
}
}
const _: () = {
assert!(4 == < DeadType as wasmtime::component::ComponentType >::SIZE32);
assert!(
4 == < DeadType as wasmtime::component::ComponentType >::ALIGN32
);
};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(variant)]
#[derive(Clone, Copy)]
pub enum V {
#[component(name = "a")]
A(LiveType),
#[component(name = "b")]
B(DeadType),
}
impl core::fmt::Debug for V {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
V::A(e) => f.debug_tuple("V::A").field(e).finish(),
V::B(e) => f.debug_tuple("V::B").field(e).finish(),
}
}
}
const _: () = {
assert!(8 == < V as wasmtime::component::ComponentType >::SIZE32);
assert!(4 == < V as wasmtime::component::ComponentType >::ALIGN32);
};
#[wasmtime::component::__internal::trait_variant_make(::core::marker::Send)]
pub trait Host: Send {}
pub trait GetHost<
Expand Down
20 changes: 20 additions & 0 deletions crates/component-macro/tests/expanded/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ pub mod foo {
4 == < Aggregates as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down Expand Up @@ -680,6 +689,17 @@ pub mod exports {
>::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down
20 changes: 20 additions & 0 deletions crates/component-macro/tests/expanded/records_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ pub mod foo {
4 == < Aggregates as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down Expand Up @@ -714,6 +723,17 @@ pub mod exports {
>::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down
20 changes: 20 additions & 0 deletions crates/component-macro/tests/expanded/records_concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ pub mod foo {
4 == < Aggregates as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down Expand Up @@ -1134,6 +1143,17 @@ pub mod exports {
>::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down
20 changes: 20 additions & 0 deletions crates/component-macro/tests/expanded/records_tracing_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ pub mod foo {
4 == < Aggregates as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType >::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down Expand Up @@ -875,6 +884,17 @@ pub mod exports {
>::ALIGN32
);
};
pub type TupleTypedef = (i32,);
const _: () = {
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::SIZE32
);
assert!(
4 == < TupleTypedef as wasmtime::component::ComponentType
>::ALIGN32
);
};
pub type IntTypedef = i32;
const _: () = {
assert!(
Expand Down
19 changes: 19 additions & 0 deletions crates/component-macro/tests/expanded/simple-wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,25 @@ pub mod foo {
pub mod wall_clock {
#[allow(unused_imports)]
use wasmtime::component::__internal::{anyhow, Box};
#[derive(wasmtime::component::ComponentType)]
#[derive(wasmtime::component::Lift)]
#[derive(wasmtime::component::Lower)]
#[component(record)]
#[derive(Clone, Copy)]
pub struct WallClock {}
impl core::fmt::Debug for WallClock {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("WallClock").finish()
}
}
const _: () = {
assert!(
0 == < WallClock as wasmtime::component::ComponentType >::SIZE32
);
assert!(
1 == < WallClock as wasmtime::component::ComponentType >::ALIGN32
);
};
pub trait Host {}
pub trait GetHost<
T,
Expand Down
Loading