Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6ef2033
Fix FFI-unwind unsoundness with mixed panic mode
nbdd0121 May 18, 2022
77fd0cc
Handle panic runtime specially
nbdd0121 May 19, 2022
bc5afd9
Ensure ffi_unwind_calls lint is gated behind c_unwind
nbdd0121 May 19, 2022
1750a2f
Add tests for mixed panic mode restriction and lints
nbdd0121 May 20, 2022
9e6c044
Use is_fn_like instead of matching on DefKind
nbdd0121 May 23, 2022
14d155a
Rename `panic_strategy` query to `required_panic_strategy`
nbdd0121 Jun 8, 2022
ce774e3
Add a explanation about required panic strategy computation
nbdd0121 Jun 8, 2022
4c4152b
remove `span_lint_and_sugg_for_edges` from clippy utils
WaffleLapkin Jun 19, 2022
e251247
remove last use of MAX_SUGGESTION_HIGHLIGHT_LINES
WaffleLapkin Jun 19, 2022
ffb593b
remove MAX_SUGGESTION_HIGHLIGHT_LINES
WaffleLapkin Jun 19, 2022
a0eba66
[RFC 2011] Optimize non-consuming operators
c410-f3r Jun 21, 2022
c416307
Fixed RSS reporting on macOS
rdzhaafar Jun 22, 2022
f954f7b
Hermit: Fix initializing lazy locks
mkroening Jun 26, 2022
0c88602
Hermit: Make Mutex::init a no-op
mkroening Jun 26, 2022
871c879
lint: fix condition in diagnostic lints
davidtwco Jun 22, 2022
ae61224
various: add `rustc_lint_diagnostics` to diag fns
davidtwco Jun 22, 2022
be9ebfd
privacy: port "field is private" diag
davidtwco Jun 22, 2022
cb90a4f
privacy: port "item is private" diag
davidtwco Jun 22, 2022
0557d02
privacy: port unnamed "item is private" diag
davidtwco Jun 22, 2022
74f3a96
privacy: port "in public interface" diag
davidtwco Jun 22, 2022
15d61d7
privacy: deny diagnostic migration lints
davidtwco Jun 22, 2022
c24f063
Remove a back-compat hack on lazy TAIT
JohnTitor May 24, 2022
6400736
Implement `Send` and `Sync` for `ThinBox<T>`
cuviper Jun 27, 2022
f5a38d1
Remove unstable CStr/CString change from 1.62 release note
wwylele Jun 27, 2022
87a3821
Rollup merge of #97235 - nbdd0121:unwind, r=Amanieu
Dylan-DPC Jun 28, 2022
86eb0e5
Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk
Dylan-DPC Jun 28, 2022
da898bf
Rollup merge of #98261 - WaffleLapkin:attempt_to_remove_max_suggestio…
Dylan-DPC Jun 28, 2022
9ed32b1
Rollup merge of #98337 - c410-f3r:assert-compiler, r=oli-obk
Dylan-DPC Jun 28, 2022
cfda49b
Rollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtw…
Dylan-DPC Jun 28, 2022
a0a5cff
Rollup merge of #98420 - davidtwco:translation-lint-fixes-and-more-mi…
Dylan-DPC Jun 28, 2022
6de107a
Rollup merge of #98555 - mkroening:hermit-lock-init, r=m-ou-se
Dylan-DPC Jun 28, 2022
674c1fc
Rollup merge of #98595 - cuviper:send-sync-thinbox, r=m-ou-se
Dylan-DPC Jun 28, 2022
18c086f
Rollup merge of #98597 - wwylele:patch-1, r=Mark-Simulacrum
Dylan-DPC Jun 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions library/std/src/sys/hermit/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::ptr;
use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst};
use crate::sys::hermit::abi;
use crate::sys::locks::Mutex;
use crate::sys_common::lazy_box::{LazyBox, LazyInit};
use crate::time::Duration;

// The implementation is inspired by Andrew D. Birrell's paper
Expand All @@ -14,14 +15,26 @@ pub struct Condvar {
sem2: *const c_void,
}

pub type MovableCondvar = Condvar;
pub(crate) type MovableCondvar = LazyBox<Condvar>;

impl LazyInit for Condvar {
fn init() -> Box<Self> {
Box::new(Self::new())
}
}

unsafe impl Send for Condvar {}
unsafe impl Sync for Condvar {}

impl Condvar {
pub const fn new() -> Condvar {
Condvar { counter: AtomicUsize::new(0), sem1: ptr::null(), sem2: ptr::null() }
pub fn new() -> Self {
let mut condvar =
Self { counter: AtomicUsize::new(0), sem1: ptr::null(), sem2: ptr::null() };
unsafe {
let _ = abi::sem_init(&mut condvar.sem1, 0);
let _ = abi::sem_init(&mut condvar.sem2, 0);
}
condvar
}

pub unsafe fn notify_one(&self) {
Expand Down
4 changes: 1 addition & 3 deletions library/std/src/sys/hermit/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ impl Mutex {
}

#[inline]
pub unsafe fn init(&mut self) {
self.inner = Spinlock::new(MutexInner::new());
}
pub unsafe fn init(&mut self) {}

#[inline]
pub unsafe fn lock(&self) {
Expand Down
11 changes: 8 additions & 3 deletions library/std/src/sys/hermit/rwlock.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::cell::UnsafeCell;
use crate::sys::locks::{Condvar, Mutex};
use crate::sys::locks::{MovableCondvar, Mutex};
use crate::sys_common::lazy_box::{LazyBox, LazyInit};

pub struct RwLock {
lock: Mutex,
cond: Condvar,
cond: MovableCondvar,
state: UnsafeCell<State>,
}

Expand All @@ -28,7 +29,11 @@ unsafe impl Sync for RwLock {}

impl RwLock {
pub const fn new() -> RwLock {
RwLock { lock: Mutex::new(), cond: Condvar::new(), state: UnsafeCell::new(State::Unlocked) }
RwLock {
lock: Mutex::new(),
cond: MovableCondvar::new(),
state: UnsafeCell::new(State::Unlocked),
}
}

#[inline]
Expand Down