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.
This commit is contained in:
commit
c84e797642
41 changed files with 622 additions and 512 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue