#![feature(const_fn)]
#![feature(crate_visibility_modifier)]
#![feature(custom_attribute)]
+#![feature(nll)]
#![feature(non_exhaustive)]
#![feature(optin_builtin_traits)]
#![feature(rustc_attrs)]
/// Checks 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,
}
}