diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-03-27 00:19:52 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-04-10 22:05:06 +0200 |
| commit | 02f10d9bfe41c6c6650f72965d74f27e92dc3986 (patch) | |
| tree | dde75be2aae5eb5edec3ad6f8a59f1311fcca2ae /compiler/rustc_data_structures/src/marker.rs | |
| parent | 69b3959afec9b5468d5de15133b199553f6e55d2 (diff) | |
| download | rust-02f10d9bfe41c6c6650f72965d74f27e92dc3986.tar.gz rust-02f10d9bfe41c6c6650f72965d74f27e92dc3986.zip | |
Remove the use of Rayon iterators
Diffstat (limited to 'compiler/rustc_data_structures/src/marker.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/marker.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/marker.rs b/compiler/rustc_data_structures/src/marker.rs index 64c64bfa3c2..744ae9b6fe2 100644 --- a/compiler/rustc_data_structures/src/marker.rs +++ b/compiler/rustc_data_structures/src/marker.rs @@ -180,6 +180,12 @@ impl<T> FromDyn<T> { } #[inline(always)] + pub fn derive<O>(&self, val: O) -> FromDyn<O> { + // We already did the check for `sync::is_dyn_thread_safe()` when creating `Self` + FromDyn(val) + } + + #[inline(always)] pub fn into_inner(self) -> T { self.0 } @@ -200,6 +206,13 @@ impl<T> std::ops::Deref for FromDyn<T> { } } +impl<T> std::ops::DerefMut for FromDyn<T> { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + // A wrapper to convert a struct that is already a `Send` or `Sync` into // an instance of `DynSend` and `DynSync`, since the compiler cannot infer // it automatically in some cases. (e.g. Box<dyn Send / Sync>) |
