pub fn expand_include(input: TokenStream, options: &Options) -> TokenStreamExpand description
Expands one include_c99!("path") invocation: the same translation, over a
.c file rather than over C written inside the .rs.
The file is read and translated exactly as string-literal
input would be — every C construct is
accepted, #pragma cinrs … inside it configures the unit, and its own
directory is what its #include "…" searches first, as a header’s is.
§Where a relative path is resolved
Against the directory of the .rs file the macro is written in, which
is what #include "…" in a c99! block already does and what the author
is looking at. Span::local_file is how that directory is found; where the
compiler will not say (input built by another macro, some IDE contexts), the
invocation is looked for in the crate’s own sources — see Origin — and
CARGO_MANIFEST_DIR stands in when even that finds nothing, so that a path
written relative to the package still resolves. An absolute path is used as
it stands.
§Diagnostics
There is no C in the .rs file, so there is no span to point into: every
diagnostic — this crate’s and rustc’s about the generated code — lands on
the macro invocation, and a message of ours carries path:line:column in
front of it, exactly as one inside an #included header does. The file is
named in the expansion with include_str! as well, so that editing it
rebuilds the crate.