aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/collection/mock.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-21 19:16:10 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-21 19:16:31 +0800
commit1803dd427416ef19918c0ec7d50093b6d45f29af (patch)
tree4caef66649536886c27e83617066b25ad6c4ac3b /mingling_core/src/program/collection/mock.rs
parent02823638a9b9c954e13b8ae7d29bd0ae98deaf51 (diff)
feat(any): make `Grouped` trait unsafe and encapsulate `AnyOutput`
fields Declare `Grouped` as `unsafe trait` to make its soundness invariant visible. Make `AnyOutput.type_id` and `member_id` private; add public accessors and the `unsafe fn new_bare` constructor.
Diffstat (limited to 'mingling_core/src/program/collection/mock.rs')
-rw-r--r--mingling_core/src/program/collection/mock.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/mingling_core/src/program/collection/mock.rs b/mingling_core/src/program/collection/mock.rs
index 5847f10..dbe4789 100644
--- a/mingling_core/src/program/collection/mock.rs
+++ b/mingling_core/src/program/collection/mock.rs
@@ -23,9 +23,12 @@ pub enum MockProgramCollect {
Bar,
}
-impl Grouped<MockProgramCollect> for MockProgramCollect {
+/// SAFETY: This is a mock type used only for temporary testing.
+/// It will never actually enter the macro system.
+/// The internal `panic!` ensures that `member_id` will never be executed.
+unsafe impl Grouped<MockProgramCollect> for MockProgramCollect {
fn member_id() -> MockProgramCollect {
- MockProgramCollect::Foo
+ panic!("Attempting to read an unsafe enum type");
}
}