diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-08-22 02:36:41 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-08-22 02:36:41 +0200 |
| commit | e41240e45b58ea1bcf42fe5503cafec4c9dca1a8 (patch) | |
| tree | 815719e8c418e8714182863ab55fa53a51f54de6 /compiler/rustc_data_structures/src | |
| parent | ef85656a10657ba5e4f7fe2931a4ca6293138d51 (diff) | |
| download | rust-e41240e45b58ea1bcf42fe5503cafec4c9dca1a8.tar.gz rust-e41240e45b58ea1bcf42fe5503cafec4c9dca1a8.zip | |
Fix races conditions with `SyntaxContext` decoding
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sync/worker_local.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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<T> Deref for WorkerLocal<T> { unsafe { &self.locals.get_unchecked(self.registry.id().verify()).0 } } } + +impl<T: Default> Default for WorkerLocal<T> { + fn default() -> Self { + WorkerLocal::new(|_| T::default()) + } +} |
