From e41240e45b58ea1bcf42fe5503cafec4c9dca1a8 Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Tue, 22 Aug 2023 02:36:41 +0200 Subject: Fix races conditions with `SyntaxContext` decoding --- compiler/rustc_data_structures/src/sync/worker_local.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/rustc_data_structures/src/sync') diff --git a/compiler/rustc_data_structures/src/sync/worker_local.rs b/compiler/rustc_data_structures/src/sync/worker_local.rs index 8c84daf4f16..27d687c3cfe 100644 --- a/compiler/rustc_data_structures/src/sync/worker_local.rs +++ b/compiler/rustc_data_structures/src/sync/worker_local.rs @@ -171,3 +171,9 @@ impl Deref for WorkerLocal { unsafe { &self.locals.get_unchecked(self.registry.id().verify()).0 } } } + +impl Default for WorkerLocal { + fn default() -> Self { + WorkerLocal::new(|_| T::default()) + } +} -- cgit 1.4.1-3-g733a5