-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code changes are: - `static mut` now warns, so we introduce `SyncUnsafeCell` and use that instead. - Rename of "object safe" to "dyn-compatible". - The rest is Clippy. UI test changes are: - Removal of "which is required by ...", the end result is generally more readable, and hides more implementation details. - Removal of "the token" in macro diagnostics. Sometimes use "keyword" instead. End result is cleaner. - `dyn T` shows up in diagnostics without `+ 'static`, which is nice. - A few more very minor changes. - Due to Clippy suggesting `'_` instead of an explicit lifetime, a few uses of `&` in diagnostics are now cleaner. There are no assembly test changes.
- Loading branch information
Showing
49 changed files
with
373 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use core::cell::UnsafeCell; | ||
|
||
#[repr(transparent)] | ||
#[derive(Debug)] | ||
pub struct SyncUnsafeCell<T: ?Sized> { | ||
value: UnsafeCell<T>, | ||
} | ||
|
||
// SAFETY: This type is used for making `static`s which contain `UnsafeCell`. | ||
// The user upholds that such usage is correct. | ||
unsafe impl<T: ?Sized + Sync> Sync for SyncUnsafeCell<T> {} | ||
|
||
impl<T> SyncUnsafeCell<T> { | ||
#[inline] | ||
pub const fn new(value: T) -> Self { | ||
Self { | ||
value: UnsafeCell::new(value), | ||
} | ||
} | ||
|
||
#[inline] | ||
pub fn into_inner(self) -> T { | ||
self.value.into_inner() | ||
} | ||
} | ||
|
||
impl<T: ?Sized> SyncUnsafeCell<T> { | ||
#[inline] | ||
pub const fn get(&self) -> *mut T { | ||
self.value.get() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.