From 53cd09c1fbdbb0ef7dd2a7b7144a99f29f9ee03c Mon Sep 17 00:00:00 2001 From: dkorpel Date: Mon, 9 Aug 2021 12:09:18 +0200 Subject: [PATCH] mark RBNode.left and RBNode.right `@trusted` --- std/container/rbtree.d | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/std/container/rbtree.d b/std/container/rbtree.d index 46371dd5e..f8e70fc08 100644 --- a/std/container/rbtree.d +++ b/std/container/rbtree.d @@ -136,9 +136,12 @@ struct RBNode(V) * Set the left child. Also updates the new child's parent node. This * does not update the previous child. * + * $(RED Warning: If the node this is called on is a local variable, a stack pointer can be + * escaped through `newNode.parent`. It's marked `@trusted` only for backwards compatibility.) + * * Returns newNode */ - @property Node left(Node newNode) + @property Node left(return scope Node newNode) @trusted { _left = newNode; if (newNode !is null) @@ -150,9 +153,12 @@ struct RBNode(V) * Set the right child. Also updates the new child's parent node. This * does not update the previous child. * + * $(RED Warning: If the node this is called on is a local variable, a stack pointer can be + * escaped through `newNode.parent`. It's marked `@trusted` only for backwards compatibility.) + * * Returns newNode */ - @property Node right(Node newNode) + @property Node right(return scope Node newNode) @trusted { _right = newNode; if (newNode !is null)