From c7b610fc3ed1283326e0365e8fc39f957201a546 Mon Sep 17 00:00:00 2001 From: odersky Date: Tue, 7 Apr 2026 11:14:23 +0200 Subject: [PATCH] Go back to explicit @retains instead of uses_init in stdlib This prepares for a change in syntax for uses_init since stdlib has to be compilable in non-bootstrapped as well as bootstrapped settings. --- library/src/scala/collection/Map.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/scala/collection/Map.scala b/library/src/scala/collection/Map.scala index d9822a277c57..77b2b5e45411 100644 --- a/library/src/scala/collection/Map.scala +++ b/library/src/scala/collection/Map.scala @@ -217,7 +217,7 @@ transparent trait MapOps[K, +V, +CC[_, _] <: IterableOps[?, AnyConstr, ?], +C] * See [[MapOps.LazyKeySet]] for a version that lazily captures the map. */ @deprecated("GenKeySet is not capture-safe, and so is deprecated and no longer used in .keySet implementations.", since = "3.8.0") - protected trait GenKeySet uses_init MapOps.this { + protected trait GenKeySet @retains[MapOps.this.type]() { this: Set[K] => import caps.unsafe.{unsafeDiscardUses, unsafeAssumePure} def iterator: Iterator[K] = unsafeDiscardUses(MapOps.this).keysIterator.unsafeAssumePure