aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Per Lindgren <per.lindgren@ltu.se> 2020-10-19 21:00:18 +0200
committerGravatar Per Lindgren <per.lindgren@ltu.se> 2020-10-19 21:00:18 +0200
commit41472032dcb83156b380dd5629898d33398e9604 (patch)
tree42db66dc4ae2b6b8078a1236137a617230be87ab
parent6de4f1a797c81aec6c24f47872e5d3968344684c (diff)
downloadrtic-async_experiment.tar.gz
rtic-async_experiment.tar.zst
rtic-async_experiment.zip
async haxx (public Priority)async_experiment
-rw-r--r--macros/src/codegen/resources.rs3
-rw-r--r--macros/src/codegen/resources_struct.rs1
-rw-r--r--src/export.rs5
3 files changed, 7 insertions, 2 deletions
diff --git a/macros/src/codegen/resources.rs b/macros/src/codegen/resources.rs
index 38ea5245..8d7a3a86 100644
--- a/macros/src/codegen/resources.rs
+++ b/macros/src/codegen/resources.rs
@@ -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)*
diff --git a/macros/src/codegen/resources_struct.rs b/macros/src/codegen/resources_struct.rs
index 92d5b666..69069449 100644
--- a/macros/src/codegen/resources_struct.rs
+++ b/macros/src/codegen/resources_struct.rs
@@ -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,)*
diff --git a/src/export.rs b/src/export.rs
index 72d954ab..29635d15 100644
--- a/src/export.rs
+++ b/src/export.rs
@@ -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