aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/assertions.rs
blob: 4a77352f570a52536927e0bbc7b66eeda82edf1f (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
24
25
26
27
28
29
30
31
32
33
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;

use crate::{analyze::Analysis, check::Extra};

/// Generates compile-time assertions that check that types implement the `Send` / `Sync` traits
pub fn codegen(core: u8, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream2> {
    let mut stmts = vec![];

    // we don't generate *all* assertions on all cores because the user could conditionally import a
    // type only on some core (e.g. `#[cfg(core = "0")] use some::Type;`)

    if let Some(types) = analysis.send_types.get(&core) {
        for ty in types {
            stmts.push(quote!(rtfm::export::assert_send::<#ty>();));
        }
    }

    if let Some(types) = analysis.sync_types.get(&core) {
        for ty in types {
            stmts.push(quote!(rtfm::export::assert_sync::<#ty>();));
        }
    }

    // if the `schedule` API is used in more than one core then we need to check that the
    // `monotonic` timer can be used in multi-core context
    if analysis.timer_queues.len() > 1 && analysis.timer_queues.contains_key(&core) {
        let monotonic = extra.monotonic();
        stmts.push(quote!(rtfm::export::assert_multicore::<#monotonic>();));
    }

    stmts
}
rred/tcc Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/src/fallback.html (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-10-01Fix `setTimeout(0)`, improve test coverage slightly, reduce memory usage of t...Gravatar Jarred Sumner 5-87/+221
2022-10-01[napi] Implement `napi_remove_wrap`Gravatar Jarred Sumner 3-0/+32
2022-10-01Add missing type check to `napi_wrap`Gravatar Jarred Sumner 1-3/+21
2022-10-01[bun:test] When there are lots of tests, print the failures at the bottom so ...Gravatar Jarred Sumner 1-6/+20
2022-10-01Fix release mode value semantics bugGravatar Jarred Sumner 1-20/+20
2022-10-01Increase test coverage for request body streamingGravatar Jarred Sumner 9-133/+251
2022-09-30Make setTimeout/setInterval more reliableGravatar Jarred Sumner 3-60/+103
2022-09-30Fix body mixinGravatar Jarred Sumner 2-9/+9
2022-09-30Fix failing tests from backpressureGravatar Jarred Sumner 1-132/+91
2022-09-30Eagerly receive incoming request bodiesGravatar Jarred Sumner 1-77/+71
2022-09-30Fix outdated typeGravatar Jarred Sumner 1-1/+1
2022-09-30Simplify some of thisGravatar Jarred Sumner 1-127/+23
2022-09-30Delete some codeGravatar Jarred Sumner 1-105/+56
2022-09-30Add a couple assertionsGravatar Jarred Sumner 1-1/+5
2022-09-30Fix incorrect first number in byte streamGravatar Jarred Sumner 1-8/+6
2022-09-30Attempt to address .write() bugGravatar Jarred Sumner 1-8/+23
2022-09-30Fix unnecessary "Buffer is detached" errorGravatar Jarred Sumner 1-8/+34
2022-09-30Request->url == string, not ZigString nowGravatar Jarred Sumner 2-21/+38
2022-09-30Improve test coverage for Request body streaming!Gravatar Jarred Sumner 1-59/+288
2022-09-30Fix OOB when multiple headers have the same name lengthGravatar Jarred Sumner 1-18/+24
2022-09-30Add a better wrapper function for promisesGravatar Jarred Sumner 1-3/+28
2022-09-30Use poll_ref in the io tasksGravatar Jarred Sumner 1-11/+12
2022-09-30Support all `ArrayBufferView` in all hashing functions and node fs functionsGravatar Jarred Sumner 1-11/+46
2022-09-30Verbose flagGravatar Jarred Sumner 1-1/+17
2022-09-30Use pollref in FileBlobLoaderGravatar Jarred Sumner 1-1/+1
2022-09-30Fixup Body mixin implementationGravatar Jarred Sumner 1-233/+193
2022-09-30Use PollRef in napiGravatar Jarred Sumner 1-0/+5
2022-09-30more gc in fs testGravatar Jarred Sumner 2-2/+13
2022-09-30Remove extraneous calls to `.ref()`Gravatar Jarred Sumner 17-169/+172
2022-09-30Add hidden `verbose` flag to `fetch` (the third argument)Gravatar Jarred Sumner 1-0/+13
2022-09-30[internal] Use `PollRef` for `fetch()`Gravatar Jarred Sumner 1-1/+6