Add the -Zcrate-attr=foo nightly rustc flag to inject crate attributes

This commit is contained in:
Pietro Albini 2018-07-18 20:34:08 +02:00
parent b18b9edf00
commit 71276c6abc
No known key found for this signature in database
GPG key ID: E8C1042DD1624519
6 changed files with 66 additions and 3 deletions

View file

@ -100,6 +100,8 @@ pub enum FileName {
ProcMacroSourceCode,
/// Strings provided as --cfg [cfgspec] stored in a crate_cfg
CfgSpec,
/// Strings provided as crate attributes in the CLI
CliCrateAttr,
/// Custom sources for explicit parser calls from plugins and drivers
Custom(String),
}
@ -115,6 +117,7 @@ impl std::fmt::Display for FileName {
Anon => write!(fmt, "<anon>"),
ProcMacroSourceCode => write!(fmt, "<proc-macro source code>"),
CfgSpec => write!(fmt, "cfgspec"),
CliCrateAttr => write!(fmt, "<crate attribute>"),
Custom(ref s) => write!(fmt, "<{}>", s),
}
}
@ -137,6 +140,7 @@ impl FileName {
MacroExpansion |
ProcMacroSourceCode |
CfgSpec |
CliCrateAttr |
Custom(_) |
QuoteExpansion => false,
}
@ -150,6 +154,7 @@ impl FileName {
MacroExpansion |
ProcMacroSourceCode |
CfgSpec |
CliCrateAttr |
Custom(_) |
QuoteExpansion => false,
Macros(_) => true,