Require a list of features to allow in allow_internal_unstable

This commit is contained in:
Oliver Scherer 2019-02-03 12:55:00 +01:00
parent 57d7cfc3cf
commit d3c212c552
35 changed files with 182 additions and 93 deletions

View file

@ -385,9 +385,9 @@ impl Span {
/// Check if a span is "internal" to a macro in which `#[unstable]`
/// items can be used (that is, a macro marked with
/// `#[allow_internal_unstable]`).
pub fn allows_unstable(&self) -> bool {
pub fn allows_unstable(&self, feature: &str) -> bool {
match self.ctxt().outer().expn_info() {
Some(info) => info.allow_internal_unstable,
Some(info) => info.allow_internal_unstable.iter().any(|&f| f == feature),
None => false,
}
}