blob: 2f5dd523435dd98632e996a6ed3a776f1b365f9f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use super::bindings::extra_assertions;
use crate::analyze::Analysis;
use crate::syntax::ast::App;
/// Generates compile-time assertions that check that types implement the `Send` / `Sync` traits
pub fn codegen(app: &App, analysis: &Analysis) -> Vec<TokenStream2> {
let mut stmts = vec![];
for ty in &analysis.send_types {
stmts.push(quote!(rtic::export::assert_send::<#ty>();));
}
for ty in &analysis.sync_types {
stmts.push(quote!(rtic::export::assert_sync::<#ty>();));
}
stmts.append(&mut extra_assertions(app, analysis));
stmts
}
|