You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Cases that allow a backend to encounter tuple-structs/tuple-variants
struct "MyTupleStruct" {
_ "bool"
_ "i32"
_ "u64"
}
tagged "MyTagged" {
TupleVariant {
_ "bool"
_ "i32"
_ "u64"
}
HybridVariant {
x "bool"
_ "u32"
}
StructVariant {
x "u8"
z "i64"
}
EmptyVariant {
}
NoneLike
}
fn "anons" {
inputs {
_ "u32"
_ "MyTupleStruct"
z "i8"
}
outputs {
_ "MyTagged"
}
}
While this is partially just a convenience for not writing stuff you don't care about, it is intended that the rust backend could lower these to tuple-structs/variants when applicable. The kdl-script compiler already caches/computes whether this is applicable to a struct/variant with all_fields_were_blank:
In kdl-script you can choose to omit the names of fields, as demonstrated by
anons.kdl
:abi-cafe/include/tests/normal/anons.kdl
Lines 1 to 36 in 6ba6865
While this is partially just a convenience for not writing stuff you don't care about, it is intended that the rust backend could lower these to tuple-structs/variants when applicable. The kdl-script compiler already caches/computes whether this is applicable to a struct/variant with all_fields_were_blank:
abi-cafe/kdl-script/src/types.rs
Line 238 in 6ba6865
abi-cafe/kdl-script/src/types.rs
Line 284 in 6ba6865
The main reason I didn't follow through on this is that:
on struct definition:
abi-cafe/src/abis/rust/declare.rs
Lines 167 to 180 in 6ba6865
on struct field access:
abi-cafe/src/abis/rust/write.rs
Lines 101 to 106 in 6ba6865
on struct init:
abi-cafe/src/abis/rust/init.rs
Lines 120 to 130 in 6ba6865
The text was updated successfully, but these errors were encountered: