about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-01-11 16:21:30 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2020-02-01 18:58:08 +0100
commit98fd6a5c88a44214f15a43a9e633e3b71876bdb3 (patch)
tree52ab451508805fb2d0a2e40cff72145933da6486 /src/libsyntax
parent097d5e1c5edea1c0bf350b709087ddf5d60d2d9f (diff)
1. move allow_internal_unstable to rustc_attr
2. as a result, drop rustc_errors dep from syntax
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/Cargo.toml1
-rw-r--r--src/libsyntax/attr/mod.rs24
2 files changed, 0 insertions, 25 deletions
diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml
index b3e16f740fd..ff03ae3f425 100644
--- a/src/libsyntax/Cargo.toml
+++ b/src/libsyntax/Cargo.toml
@@ -13,7 +13,6 @@ doctest = false
 rustc_serialize = { path = "../libserialize", package = "serialize" }
 log = "0.4"
 scoped-tls = "1.0"
-rustc_errors = { path = "../librustc_errors" }
 rustc_span = { path = "../librustc_span" }
 rustc_data_structures = { path = "../librustc_data_structures" }
 rustc_index = { path = "../librustc_index" }
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index e4d4017a345..313f5269235 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -406,30 +406,6 @@ pub fn find_by_name(attrs: &[Attribute], name: Symbol) -> Option<&Attribute> {
     attrs.iter().find(|attr| attr.check_name(name))
 }
 
-pub fn allow_internal_unstable<'a>(
-    attrs: &[Attribute],
-    span_diagnostic: &'a rustc_errors::Handler,
-) -> Option<impl Iterator<Item = Symbol> + 'a> {
-    find_by_name(attrs, sym::allow_internal_unstable).and_then(|attr| {
-        attr.meta_item_list()
-            .or_else(|| {
-                span_diagnostic
-                    .span_err(attr.span, "allow_internal_unstable expects list of feature names");
-                None
-            })
-            .map(|features| {
-                features.into_iter().filter_map(move |it| {
-                    let name = it.ident().map(|ident| ident.name);
-                    if name.is_none() {
-                        span_diagnostic
-                            .span_err(it.span(), "`allow_internal_unstable` expects feature names")
-                    }
-                    name
-                })
-            })
-    })
-}
-
 pub fn filter_by_name(attrs: &[Attribute], name: Symbol) -> impl Iterator<Item = &Attribute> {
     attrs.iter().filter(move |attr| attr.check_name(name))
 }