diff options
| author | bors <bors@rust-lang.org> | 2019-02-12 12:10:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-12 12:10:10 +0000 |
| commit | c84e7976423bb910bb5eb5eecffc7e33a897a97f (patch) | |
| tree | 24570884cb7742fe817286a3cde2643722eb8c6a /src/libsyntax_pos/lib.rs | |
| parent | a54b5c7a645ead203d77e78245362f9e0f00dd3c (diff) | |
| parent | bbe524d7c1a1028737a93c7c71c508a68363b681 (diff) | |
| download | rust-c84e7976423bb910bb5eb5eecffc7e33a897a97f.tar.gz rust-c84e7976423bb910bb5eb5eecffc7e33a897a97f.zip | |
Auto merge of #58098 - oli-obk:maybe_allow_internal_unstable, r=petrochenkov
Require a list of features in `#[allow_internal_unstable]` The blanket-permission slip is not great and will likely give us trouble some point down the road.
Diffstat (limited to 'src/libsyntax_pos/lib.rs')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index dbb4f8f8159..042005ea538 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -386,9 +386,13 @@ 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 + .map_or(false, |features| features.iter().any(|&f| + f == feature || f == "allow_internal_unstable_backcompat_hack" + )), None => false, } } |
