Skip to main content

Crate cinrs_macros

Crate cinrs_macros 

Source
Expand description

The procedural macro front end for cinrs.

Deliberately a thin shim: everything interesting lives in cinrs-core, which is built on proc-macro2 and can therefore be tested without a procedural macro context.

§The nightly feature

cinrs-core never touches proc_macro, so the one thing it cannot do by itself is build a span that points inside a string literal — proc_macro::Literal::subspan is unstable on every channel, and proc-macro2 does not expose it. With the nightly feature this crate turns on #![feature(proc_macro_span)] and hands the front end a Subspan hook that does exactly that, so a c99! { r#"…"# } body reports its errors on the offending C token rather than on the whole literal with the position spelled out in the message. Everything else is unchanged, and without the feature — or wherever subspan declines to answer, as under rust-analyzer — the stable behaviour comes back on its own.

Macros§

c11
Compiles a C11 translation unit written inside Rust.
c17
Compiles a C17 translation unit written inside Rust.
c23
Compiles a C23 translation unit written inside Rust.
c89
Compiles a C89 (C90) translation unit written inside Rust.
c90
Compiles a C90 translation unit written inside Rust.
c99
Compiles a C99 translation unit written inside Rust.
gnu11
Compiles a C11 translation unit with the GNU extensions switched on.
gnu17
Compiles a C17 translation unit with the GNU extensions switched on.
gnu23
Compiles a C23 translation unit with the GNU extensions switched on.
gnu89
Compiles a C89 translation unit with the GNU extensions switched on.
gnu99
Compiles a C99 translation unit with the GNU extensions switched on.
include_c11
Compiles the C11 file at path; see include_c99! and c11!.
include_c17
Compiles the C17 file at path; see include_c99! and c17!.
include_c23
Compiles the C23 file at path; see include_c99! and c23!.
include_c89
Compiles the C89 (C90) file at path.
include_c90
Compiles the C90 file at path; see include_c99! and c90!.
include_c99
Compiles the C99 file at path — one translation unit, exactly as if its text had been written inside c99!.
include_gnu11
Compiles the C11 file at path with the GNU extensions switched on; see include_c99! and gnu11!.
include_gnu17
Compiles the C17 file at path with the GNU extensions switched on; see include_c99! and gnu17!.
include_gnu23
Compiles the C23 file at path with the GNU extensions switched on; see include_c99! and gnu23!.
include_gnu89
Compiles the C89 file at path with the GNU extensions switched on; see include_c99! and gnu89!.
include_gnu99
Compiles the C99 file at path with the GNU extensions switched on; see include_c99! and gnu99!.