File tree 1 file changed +16
-0
lines changed
src/doc/unstable-book/src/compiler-flags
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ` crate-attr `
2
+
3
+ The tracking issue for this feature is: [ #138287 ] ( https://github.com/rust-lang/rust/issues/138287 ) .
4
+
5
+ ------------------------
6
+
7
+ The ` -Z crate-attr ` flag allows you to inject attributes into the crate root.
8
+ For example, ` -Z crate-attr=crate_name="test" ` acts as if ` #![crate_name="test"] ` were present before the first source line of the crate root.
9
+
10
+ To inject multiple attributes, pass ` -Z crate-attr ` multiple times.
11
+
12
+ Formally, the expansion behaves as follows:
13
+ 1 . The crate is parsed as if ` -Z crate-attr ` were not present.
14
+ 2 . The attributes in ` -Z crate-attr ` are parsed and validated.
15
+ 3 . The attributes are injected at the top of the crate root.
16
+ 4 . Macro expansion is performed.
You can’t perform that action at this time.
0 commit comments