Skip to content

Commit 4e9473a

Browse files
committed
Fixed stuff forgotten last commit and fixed typos
1 parent 7fa33ca commit 4e9473a

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

drivers/android/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ impl Process {
712712
self.clone(),
713713
cookie,
714714
))
715-
.map_err(|(i, _)| i)?,
715+
.unwrap_or_else(|(err, _)| match err {}),
716716
);
717717

718718
info.death = Some(death.clone());

rust/kernel/sync.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ impl<T> StaticInit<T> {
158158
/// # Safety
159159
///
160160
/// The caller calls this function exactly once and before any other function (even implicitly
161-
/// derefing) of `self` is called. `self` stays pinned indefinetly.
162-
pub unsafe fn init<E>(&self, init: impl PinInit<T, E>)
161+
/// derefing) of `self` is called. `self` stays pinned indefinitely.
162+
pub unsafe fn init<E>(&'static self, init: impl PinInit<T, E>)
163163
where
164164
E: Into<core::convert::Infallible>,
165165
{
166166
// SAFETY: This function has unique access to `self` because of the unsafety contract.
167-
// `self` is also pinned indefinetly and `inner` is structurally pinned.
167+
// `self` is also pinned indefinitely and `inner` is structurally pinned.
168168
unsafe {
169169
let ptr = UnsafeCell::raw_get(self.inner.as_ptr());
170170
match init.__pinned_init(ptr).map_err(|e| e.into()) {

rust/macros/pinned_drop.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ pub(crate) fn pinned_drop(_args: TokenStream, input: TokenStream) -> TokenStream
3232
}
3333
}
3434
let idx = pinned_drop_idx.unwrap();
35-
//inserting `::kernel::init::` in reverse order
36-
toks.insert(idx, TokenTree::Punct(Punct::new(':', Spacing::Alone)));
37-
toks.insert(idx, TokenTree::Punct(Punct::new(':', Spacing::Joint)));
38-
toks.insert(idx, TokenTree::Ident(Ident::new("init", Span::call_site())));
39-
toks.insert(idx, TokenTree::Punct(Punct::new(':', Spacing::Alone)));
40-
toks.insert(idx, TokenTree::Punct(Punct::new(':', Spacing::Joint)));
41-
toks.insert(
42-
idx,
43-
TokenTree::Ident(Ident::new("kernel", Span::call_site())),
35+
// fully qualify the `PinnedDrop`.
36+
toks.splice(
37+
idx..idx,
38+
vec![
39+
TokenTree::Punct(Punct::new(':', Spacing::Joint)),
40+
TokenTree::Punct(Punct::new(':', Spacing::Alone)),
41+
TokenTree::Ident(Ident::new("kernel", Span::call_site())),
42+
TokenTree::Punct(Punct::new(':', Spacing::Joint)),
43+
TokenTree::Punct(Punct::new(':', Spacing::Alone)),
44+
TokenTree::Ident(Ident::new("init", Span::call_site())),
45+
TokenTree::Punct(Punct::new(':', Spacing::Joint)),
46+
TokenTree::Punct(Punct::new(':', Spacing::Alone)),
47+
],
4448
);
45-
toks.insert(idx, TokenTree::Punct(Punct::new(':', Spacing::Alone)));
46-
toks.insert(idx, TokenTree::Punct(Punct::new(':', Spacing::Joint)));
47-
// take the {} body
49+
// take the {} body.
4850
if let Some(TokenTree::Group(last)) = toks.pop() {
4951
TokenStream::from_iter(vec![
5052
TokenTree::Punct(Punct::new(':', Spacing::Joint)),

0 commit comments

Comments
 (0)