Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-rtfm-klee
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KLEE
cortex-m-rtfm-klee
Commits
9865a724
Commit
9865a724
authored
7 years ago
by
Jorge Aparicio
Browse files
Options
Downloads
Patches
Plain Diff
make resource proxies !Send
parent
0a0e0e2b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
macros/src/trans.rs
+6
-2
6 additions, 2 deletions
macros/src/trans.rs
tests/cfail/resource-not-send.rs
+52
-0
52 additions, 0 deletions
tests/cfail/resource-not-send.rs
with
58 additions
and
2 deletions
macros/src/trans.rs
+
6
−
2
View file @
9865a724
...
@@ -438,12 +438,14 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
...
@@ -438,12 +438,14 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
items
.push
(
quote!
{
items
.push
(
quote!
{
#[allow(non_camel_case_types)]
#[allow(non_camel_case_types)]
pub
struct
#
name
{
_0
:
()
}
pub
struct
#
name
{
_0
:
PhantomData
<*
const
()
>
}
unsafe
impl
Sync
for
#
name
{}
#[allow(unsafe_code)]
#[allow(unsafe_code)]
impl
#
name
{
impl
#
name
{
pub
unsafe
fn
new
()
->
Self
{
pub
unsafe
fn
new
()
->
Self
{
#
name
{
_0
:
()
}
#
name
{
_0
:
PhantomData
}
}
}
}
}
});
});
...
@@ -455,6 +457,8 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
...
@@ -455,6 +457,8 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
root
.push
(
quote!
{
root
.push
(
quote!
{
#[allow(unsafe_code)]
#[allow(unsafe_code)]
mod
_resource
{
mod
_resource
{
use
core
::
marker
::
PhantomData
;
#
(
#
items
)
*
#
(
#
items
)
*
}
}
})
})
...
...
This diff is collapsed.
Click to expand it.
tests/cfail/resource-not-send.rs
0 → 100644
+
52
−
0
View file @
9865a724
#![deny(warnings)]
#![feature(const_fn)]
#![feature(proc_macro)]
#![no_std]
extern
crate
cortex_m_rtfm
as
rtfm
;
extern
crate
stm32f103xx
;
use
rtfm
::{
app
,
Resource
,
Threshold
};
app!
{
device
:
stm32f103xx
,
resources
:
{
static
SHARED
:
bool
=
false
;
},
tasks
:
{
EXTI0
:
{
path
:
exti0
,
priority
:
1
,
resources
:
[
SHARED
],
},
EXTI1
:
{
path
:
exti1
,
priority
:
2
,
resources
:
[
SHARED
],
},
},
}
fn
init
(
_p
:
init
::
Peripherals
,
_r
:
init
::
Resources
)
{}
fn
idle
()
->
!
{
loop
{}
}
fn
is_send
<
T
>
(
_
:
&
T
)
where
T
:
Send
{}
fn
is_sync
<
T
>
(
_
:
&
T
)
where
T
:
Sync
{}
fn
exti0
(
_t
:
&
mut
Threshold
,
r
:
EXTI0
::
Resources
)
{
// OK
is_sync
(
&
r
.SHARED
);
// ERROR resource proxies are not `Send`able across tasks
is_send
(
&
r
.SHARED
);
//~^ error the trait bound `*const (): core::marker::Send` is not satisfied
}
fn
exti1
(
_t
:
&
mut
Threshold
,
_r
:
EXTI1
::
Resources
)
{
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment