diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2021-06-24 04:16:11 -0400 |
|---|---|---|
| committer | Jacob Pratt <jacob@jhpratt.dev> | 2021-06-24 04:16:11 -0400 |
| commit | 3f14f4b3cec811017079564e16a92a1dc9870f41 (patch) | |
| tree | 6f8c9207dd0c8cefa35d69a7d15ce756772586ca /compiler | |
| parent | 6a758ea7e48416b968955535094479dc2e7cc9e1 (diff) | |
| download | rust-3f14f4b3cec811017079564e16a92a1dc9870f41.tar.gz rust-3f14f4b3cec811017079564e16a92a1dc9870f41.zip | |
Use `#[non_exhaustive]` where appropriate
Due to the std/alloc split, it is not possible to make `alloc::collections::TryReserveError::AllocError` non-exhaustive without having an unstable, doc-hidden method to construct (which negates the benefits from `#[non_exhaustive]`.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_metadata/src/dynamic_lib.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_metadata/src/dynamic_lib.rs b/compiler/rustc_metadata/src/dynamic_lib.rs index 1a900ccbf65..e8929cd5c02 100644 --- a/compiler/rustc_metadata/src/dynamic_lib.rs +++ b/compiler/rustc_metadata/src/dynamic_lib.rs @@ -70,13 +70,12 @@ mod dl { use std::sync::{Mutex, MutexGuard}; pub fn lock() -> MutexGuard<'static, Guard> { - static LOCK: SyncLazy<Mutex<Guard>> = SyncLazy::new(|| Mutex::new(Guard { _priv: () })); + static LOCK: SyncLazy<Mutex<Guard>> = SyncLazy::new(|| Mutex::new(Guard)); LOCK.lock().unwrap() } - pub struct Guard { - _priv: (), - } + #[non_exhaustive] + pub struct Guard; impl Guard { pub fn get(&mut self) -> Result<(), String> { |
