From 87d077134449ebf3257ec44cb4d0186b784bd78c Mon Sep 17 00:00:00 2001 From: Thomas van Doornmalen Date: Sat, 20 Sep 2025 18:49:39 +0200 Subject: [PATCH 1/2] Use weak types in generated bindings and bump version --- Project.toml | 2 +- src/Reflect.jl | 28 ++++++++++---------- test/AbstractTypes.jl | 4 +-- test/Mutable.jl | 8 +++--- test/WithBitsUnion.jl | 2 +- test/WithBuiltinFields.jl | 54 +++++++++++++++++++-------------------- test/WithGenericFields.jl | 6 ++--- test/WithNonBitsUnion.jl | 2 +- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Project.toml b/Project.toml index 30c84fd..e7f2851 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JlrsCore" uuid = "29be08bc-e5fd-4da2-bbc1-72011c6ea2c9" authors = ["Thomas van Doornmalen "] -version = "0.5.0" +version = "0.6.0" [deps] JlrsLedger_jll = "946c7259-7191-581b-9320-f4a77977c88e" diff --git a/src/Reflect.jl b/src/Reflect.jl index 1390994..ebd8c39 100644 --- a/src/Reflect.jl +++ b/src/Reflect.jl @@ -485,19 +485,19 @@ function insertbuiltins!(layouts::IdDict{DataType,Layout})::Nothing layouts[Char] = BuiltinLayout("::jlrs::data::layout::char::Char", [], false, false, false) layouts[typeof(Union{})] = BuiltinLayout("::jlrs::data::layout::union::EmptyUnion", [], false, false, false) - layouts[Any] = BuiltinLayout("::jlrs::data::managed::value::ValueRef", [], true, true, true) - layouts[basetype(Array)] = BuiltinLayout("::jlrs::data::managed::array::ArrayRef", [StructParameter(:T, true), StructParameter(:N, true)], true, true, true) - layouts[DataType] = BuiltinLayout("::jlrs::data::managed::datatype::DataTypeRef", [], true, false, true) - layouts[Module] = BuiltinLayout("::jlrs::data::managed::module::ModuleRef", [], true, false, true) - layouts[Core.SimpleVector] = BuiltinLayout("::jlrs::data::managed::simple_vector::SimpleVectorRef", [], true, false, true) - layouts[String] = BuiltinLayout("::jlrs::data::managed::string::StringRef", [], true, false, true) - layouts[Symbol] = BuiltinLayout("::jlrs::data::managed::symbol::SymbolRef", [], true, false, true) - layouts[Task] = BuiltinLayout("::jlrs::data::managed::task::TaskRef", [], true, false, true) - layouts[Core.TypeName] = BuiltinLayout("::jlrs::data::managed::type_name::TypeNameRef", [], true, false, true) - layouts[TypeVar] = BuiltinLayout("::jlrs::data::managed::type_var::TypeVarRef", [], true, false, true) - layouts[Union] = BuiltinLayout("::jlrs::data::managed::union::UnionRef", [], true, false, true) - layouts[UnionAll] = BuiltinLayout("::jlrs::data::managed::union_all::UnionAllRef", [], true, false, true) - layouts[Expr] = BuiltinLayout("::jlrs::data::managed::expr::ExprRef", [], true, false, true) + layouts[Any] = BuiltinLayout("::jlrs::data::managed::value::WeakValue", [], true, true, true) + layouts[basetype(Array)] = BuiltinLayout("::jlrs::data::managed::array::WeakArray", [StructParameter(:T, true), StructParameter(:N, true)], true, true, true) + layouts[DataType] = BuiltinLayout("::jlrs::data::managed::datatype::WeakDataType", [], true, false, true) + layouts[Module] = BuiltinLayout("::jlrs::data::managed::module::WeakModule", [], true, false, true) + layouts[Core.SimpleVector] = BuiltinLayout("::jlrs::data::managed::simple_vector::WeakSimpleVector", [], true, false, true) + layouts[String] = BuiltinLayout("::jlrs::data::managed::string::WeakString", [], true, false, true) + layouts[Symbol] = BuiltinLayout("::jlrs::data::managed::symbol::WeakSymbol", [], true, false, true) + layouts[Task] = BuiltinLayout("::jlrs::data::managed::task::WeakTask", [], true, false, true) + layouts[Core.TypeName] = BuiltinLayout("::jlrs::data::managed::type_name::WeakTypeName", [], true, false, true) + layouts[TypeVar] = BuiltinLayout("::jlrs::data::managed::type_var::WeakTypeVar", [], true, false, true) + layouts[Union] = BuiltinLayout("::jlrs::data::managed::union::WeakUnion", [], true, false, true) + layouts[UnionAll] = BuiltinLayout("::jlrs::data::managed::union_all::WeakUnionAll", [], true, false, true) + layouts[Expr] = BuiltinLayout("::jlrs::data::managed::expr::WeakExpr", [], true, false, true) layouts[Core.AbstractChar] = BuiltinAbstractLayout() layouts[Core.AbstractFloat] = BuiltinAbstractLayout() @@ -1079,7 +1079,7 @@ function strsignature(layout::StructLayout, field::Union{StructField,TupleField} wrap_opt = false if field isa StructField && field.fieldtype isa StructLayout && ismutabletype(field.fieldtype.type) - return "::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>" + return "::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>" end if field.fieldtype isa GenericLayout diff --git a/test/AbstractTypes.jl b/test/AbstractTypes.jl index e4f7c27..f73277a 100644 --- a/test/AbstractTypes.jl +++ b/test/AbstractTypes.jl @@ -49,7 +49,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.HasAbstractField")] pub struct HasAbstractField<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -61,7 +61,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.HasAbstractUnionAllField")] pub struct HasAbstractUnionAllField<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end end diff --git a/test/Mutable.jl b/test/Mutable.jl index de45b2e..f6a8119 100644 --- a/test/Mutable.jl +++ b/test/Mutable.jl @@ -51,7 +51,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ConstructType)] #[jlrs(julia_type = "Main.MutNested")] pub struct MutNested<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -68,7 +68,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.Immut")] pub struct Immut<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -116,7 +116,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField)] #[jlrs(julia_type = "Main.HasGenericImmut")] pub struct HasGenericImmut<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, } #[derive(ConstructType, HasLayout)] @@ -134,7 +134,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck)] #[jlrs(julia_type = "Main.DoubleHasGeneric")] pub struct DoubleHasGeneric<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, } #[derive(ConstructType, HasLayout)] diff --git a/test/WithBitsUnion.jl b/test/WithBitsUnion.jl index 197ee47..7bb46a9 100644 --- a/test/WithBitsUnion.jl +++ b/test/WithBitsUnion.jl @@ -81,7 +81,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.UnionInTuple")] pub struct UnionInTuple<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end diff --git a/test/WithBuiltinFields.jl b/test/WithBuiltinFields.jl index a54cb21..83fbf3e 100644 --- a/test/WithBuiltinFields.jl +++ b/test/WithBuiltinFields.jl @@ -79,7 +79,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithArray")] pub struct WithArray<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::array::ArrayRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::array::WeakArray<'scope, 'data>>, }""" end @@ -91,7 +91,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithCodeInstance")] pub struct WithCodeInstance<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -103,7 +103,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithDataType")] pub struct WithDataType<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::datatype::DataTypeRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::datatype::WeakDataType<'scope>>, }""" end @@ -115,7 +115,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithExpr")] pub struct WithExpr<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::expr::ExprRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::expr::WeakExpr<'scope>>, }""" end @@ -127,7 +127,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithString")] pub struct WithString<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::string::StringRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::string::WeakString<'scope>>, }""" end @@ -139,7 +139,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithMethod")] pub struct WithMethod<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -151,7 +151,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithMethodInstance")] pub struct WithMethodInstance<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -163,7 +163,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithMethodTable")] pub struct WithMethodTable<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -175,7 +175,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithModule")] pub struct WithModule<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::module::ModuleRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::module::WeakModule<'scope>>, }""" end @@ -187,7 +187,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithSimpleVector")] pub struct WithSimpleVector<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::simple_vector::SimpleVectorRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::simple_vector::WeakSimpleVector<'scope>>, }""" end @@ -199,7 +199,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithSymbol")] pub struct WithSymbol<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::symbol::SymbolRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::symbol::WeakSymbol<'scope>>, }""" end @@ -211,7 +211,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTask")] pub struct WithTask<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::task::TaskRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::task::WeakTask<'scope>>, }""" end @@ -223,7 +223,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTypeMapEntry")] pub struct WithTypeMapEntry<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -235,7 +235,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTypeMapLevel")] pub struct WithTypeMapLevel<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -247,7 +247,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTypeName")] pub struct WithTypeName<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::type_name::TypeNameRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::type_name::WeakTypeName<'scope>>, }""" end @@ -259,7 +259,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTypeVar")] pub struct WithTypeVar<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::type_var::TypeVarRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::type_var::WeakTypeVar<'scope>>, }""" end @@ -271,7 +271,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithUnion")] pub struct WithUnion<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::union::UnionRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::union::WeakUnion<'scope>>, }""" end @@ -283,7 +283,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithUnionAll")] pub struct WithUnionAll<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::union_all::UnionAllRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::union_all::WeakUnionAll<'scope>>, }""" end @@ -295,7 +295,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithCodeInstance")] pub struct WithCodeInstance<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -307,7 +307,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithArray")] pub struct WithArray<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::array::ArrayRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::array::WeakArray<'scope, 'data>>, }""" end @@ -321,7 +321,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithDataType")] pub struct WithDataType<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::datatype::DataTypeRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::datatype::WeakDataType<'scope>>, }""" end @@ -333,7 +333,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithExpr")] pub struct WithExpr<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::expr::ExprRef<'scope>>, + pub a: ::std::option::Option<::jlrs::data::managed::expr::WeakExpr<'scope>>, }""" end @@ -345,7 +345,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithMethod")] pub struct WithMethod<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -357,7 +357,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithMethodInstance")] pub struct WithMethodInstance<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -369,7 +369,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithMethodTable")] pub struct WithMethodTable<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -381,7 +381,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTypeMapEntry")] pub struct WithTypeMapEntry<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -393,7 +393,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithTypeMapLevel")] pub struct WithTypeMapLevel<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end end diff --git a/test/WithGenericFields.jl b/test/WithGenericFields.jl index 668a548..d8b6840 100644 --- a/test/WithGenericFields.jl +++ b/test/WithGenericFields.jl @@ -97,7 +97,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithGenericUnionAll")] pub struct WithGenericUnionAll<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end @@ -125,7 +125,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithPropagatedLifetime")] pub struct WithPropagatedLifetime<'scope> { - pub a: WithGenericT<::std::option::Option<::jlrs::data::managed::module::ModuleRef<'scope>>>, + pub a: WithGenericT<::std::option::Option<::jlrs::data::managed::module::WeakModule<'scope>>>, }""" end @@ -137,7 +137,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.WithPropagatedLifetimes")] pub struct WithPropagatedLifetimes<'scope, 'data> { - pub a: WithGenericT<::jlrs::data::layout::tuple::Tuple2>>>>, + pub a: WithGenericT<::jlrs::data::layout::tuple::Tuple2>>>>, }""" end end \ No newline at end of file diff --git a/test/WithNonBitsUnion.jl b/test/WithNonBitsUnion.jl index aab9997..0db2a52 100644 --- a/test/WithNonBitsUnion.jl +++ b/test/WithNonBitsUnion.jl @@ -11,7 +11,7 @@ end #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] #[jlrs(julia_type = "Main.NonBitsUnion")] pub struct NonBitsUnion<'scope, 'data> { - pub a: ::std::option::Option<::jlrs::data::managed::value::ValueRef<'scope, 'data>>, + pub a: ::std::option::Option<::jlrs::data::managed::value::WeakValue<'scope, 'data>>, }""" end end From c077245b9cf28f454b53314769324017be9be6a6 Mon Sep 17 00:00:00 2001 From: Thomas van Doornmalen Date: Sat, 20 Sep 2025 18:51:45 +0200 Subject: [PATCH 2/2] Remove WithTask --- src/Reflect.jl | 1 - test/WithBuiltinFields.jl | 16 ---------------- test/types.jl | 5 ----- 3 files changed, 22 deletions(-) diff --git a/src/Reflect.jl b/src/Reflect.jl index ebd8c39..5ecb2ee 100644 --- a/src/Reflect.jl +++ b/src/Reflect.jl @@ -492,7 +492,6 @@ function insertbuiltins!(layouts::IdDict{DataType,Layout})::Nothing layouts[Core.SimpleVector] = BuiltinLayout("::jlrs::data::managed::simple_vector::WeakSimpleVector", [], true, false, true) layouts[String] = BuiltinLayout("::jlrs::data::managed::string::WeakString", [], true, false, true) layouts[Symbol] = BuiltinLayout("::jlrs::data::managed::symbol::WeakSymbol", [], true, false, true) - layouts[Task] = BuiltinLayout("::jlrs::data::managed::task::WeakTask", [], true, false, true) layouts[Core.TypeName] = BuiltinLayout("::jlrs::data::managed::type_name::WeakTypeName", [], true, false, true) layouts[TypeVar] = BuiltinLayout("::jlrs::data::managed::type_var::WeakTypeVar", [], true, false, true) layouts[Union] = BuiltinLayout("::jlrs::data::managed::union::WeakUnion", [], true, false, true) diff --git a/test/WithBuiltinFields.jl b/test/WithBuiltinFields.jl index 83fbf3e..1623563 100644 --- a/test/WithBuiltinFields.jl +++ b/test/WithBuiltinFields.jl @@ -42,10 +42,6 @@ struct WithSymbol a::Symbol end -struct WithTask - a::Task -end - struct WithTypeName a::Core.TypeName end @@ -203,18 +199,6 @@ end }""" end - @test begin - b = Reflect.reflect([WithTask]) - sb = Reflect.StringLayouts(b) - - sb[WithTask] === """#[repr(C)] - #[derive(Clone, Debug, Unbox, ValidLayout, Typecheck, ValidField, ConstructType, CCallArg)] - #[jlrs(julia_type = "Main.WithTask")] - pub struct WithTask<'scope> { - pub a: ::std::option::Option<::jlrs::data::managed::task::WeakTask<'scope>>, - }""" - end - @test begin b = Reflect.reflect([WithTypeMapEntry]) sb = Reflect.StringLayouts(b) diff --git a/test/types.jl b/test/types.jl index 4854913..4ac0fa2 100644 --- a/test/types.jl +++ b/test/types.jl @@ -179,10 +179,6 @@ struct WithSymbol a::Symbol end -struct WithTask - a::Task -end - struct WithTypeName a::Core.TypeName end @@ -332,7 +328,6 @@ reflect([ WithSimpleVector, WithString, WithSymbol, - WithTask, WithTypeMapEntry, WithTypeMapLevel, WithTypeName,