Skip to content

Commit df0bdb9

Browse files
committed
Allow --crate-type proc-macro and trace tests for it
1 parent c224e20 commit df0bdb9

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

ferrocene/doc/user-manual/src/rustc/cli.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,9 @@
642642

643643
.. caution::
644644

645-
Only the ``bin``, ``lib``, ``rlib`` and ``staticlib`` crate types can
646-
be used in a safety critical context.
645+
Only the ``bin``, ``lib``, ``proc-macro``, ``rlib`` and ``staticlib`` crate types can be used in a safety critical context.
646+
647+
For usage of ``--crate-type proc-macro`` see the next entry.
647648

648649
Compiler argument ``--crate-type`` specifies the type of crate to build.
649650

@@ -682,6 +683,15 @@
682683
683684
$ rustc --crate-type dylib --crate-type rlib my_library.rs
684685
686+
.. cli:option:: --crate-type proc-macro
687+
:category: narrow
688+
689+
All of :cli:option:`--crate-type \<types\> <rustc --crate-type <types>>` applies to ``--crate-type proc-macro`` as well.
690+
691+
The crate type ``proc-macro`` allows to use the ``proc_macro`` library and the proc macro attributes ``#[proc_macro]``, ``#[proc_macro_attribute]`` and ``#[proc_macro_derive]``.
692+
693+
The crate type ``proc-macro`` cannot be used in combination with other crate types.
694+
685695
.. cli:option:: -D <lints>
686696
:category: narrow
687697

tests/ui/ferrocene/compiler-arguments/crate-type/crate-type_proc-macro-no-proc-macro.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ pub fn foo(input: TokenStream) -> TokenStream { //~ ERROR `proc-macro` crate
1111
}
1212

1313
// ferrocene-annotations: um_rustc_crate_type
14+
// ferrocene-annotations: um_rustc_crate_type_proc_macro

tests/ui/ferrocene/compiler-arguments/crate-type/crate-type_proc-macro.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ pub fn foo(input: TokenStream) -> TokenStream {
1212
}
1313

1414
// ferrocene-annotations: um_rustc_crate_type
15+
// ferrocene-annotations: um_rustc_crate_type_proc_macro

tests/ui/proc-macro/ferrocene-annotations

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
//
1313
// ferrocene-annotations: fls_gvwd0kf72jt
1414
// Attributes
15+
//
16+
// ferrocene-annotations: um_rustc_crate_type_proc_macro

0 commit comments

Comments
 (0)