async haxx (public Priority)

This commit is contained in:
Per Lindgren 2020-10-19 21:00:18 +02:00
parent 6de4f1a797
commit 41472032dc
3 changed files with 7 additions and 2 deletions

View file

@ -56,7 +56,8 @@ pub fn codegen(
#[allow(non_camel_case_types)]
#(#cfgs)*
pub struct #name<'a> {
priority: &'a Priority,
// PER: this is unsound
pub priority: &'a Priority,
}
#(#cfgs)*

View file

@ -165,6 +165,7 @@ pub fn codegen(
let constructor = quote!(
impl<#lt> #ident<#lt> {
#[inline(always)]
// pub const unsafe fn new(#arg) -> Self {
pub unsafe fn new(#arg) -> Self {
#ident {
#(#values,)*

View file

@ -78,7 +78,7 @@ impl Priority {
///
/// Will overwrite the current Priority
#[inline(always)]
pub unsafe fn new(value: u8) -> Self {
pub const unsafe fn new(value: u8) -> Self {
Priority {
inner: Cell::new(value),
}
@ -98,6 +98,9 @@ impl Priority {
}
}
// PER: not sure if this is a problem
unsafe impl Sync for Priority {}
#[inline(always)]
pub fn assert_send<T>()
where