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