docs(tests): correct ownership and reader failure explanations

This commit is contained in:
2026-11-15 19:51:02 +08:00
parent f70924b4a7
commit 4f6d2eec7f
3 changed files with 18 additions and 18 deletions
+3 -3
View File
@@ -16,7 +16,7 @@ impl ObjectPayload for Proxy {
fn kind_name(&self) -> &'static str {
"proxy"
}
/// Heap 分配/替换时记录一条拥有边,确保被代理存储或自引用 Cell 存活。
/// Heap 分配/替换 Proxy 时记录后端存储边,释放门面或改指后端时归还该边。
fn trace(&self, visit: &mut dyn FnMut(ObjectRef)) {
visit(self.0);
}
@@ -107,7 +107,7 @@ fn cyclic_and_foreign_attribute_storage_fail_without_mutating_fields() {
// 异堆即使槽号相同也必须报 ForeignHandle,不当成普通缺字段。
let other = ObjectStore::new().unwrap();
assert_eq!(other.attribute_path(proxy), Err(VmError::ForeignHandle));
// 归还后端外部根后仍由 Proxy 的载荷边维持存活。
// Proxy 已改为自引用,不再持有 storage;归还其唯一外部根即可回收后端。
store.release(storage).unwrap();
store.release(proxy).unwrap();
// 外部根释放后只有 Proxy 自环残留,显式回收恰好一个对象。
@@ -130,7 +130,7 @@ impl ObjectPayload for ReflectiveType {
fn allows_attributes(&self) -> bool {
true
}
/// Heap 分配/替换时记录一条拥有边,确保被代理存储或自引用 Cell 存活。
/// Heap 分配反射载荷时记录 self_cell 强边,与稍后 Cell 反向持边构成测试环。
fn trace(&self, visit: &mut dyn FnMut(ObjectRef)) {
visit(self.0);
}