diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-05 18:42:00 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-05 18:42:00 -0800 |
| commit | b24431970ece166309ef4870307e9fa4a85296d5 (patch) | |
| tree | bedba778d92b8df9eafbb7376943b30bcbe59a71 /src/libsyntax | |
| parent | cda6acb2f10e159fc6d3cb1112f2011f7bcdb206 (diff) | |
| parent | 3e9d5938cc4030de2e8c8e140633cc4d7d58733c (diff) | |
| download | rust-b24431970ece166309ef4870307e9fa4a85296d5.tar.gz rust-b24431970ece166309ef4870307e9fa4a85296d5.zip | |
rollup merge of #20568: huonw/ungate-AT-globs
These aren't in their final form, but are all aiming to be part of 1.0, so at the very least encouraging usage now to find the bugs is nice. Also, the widespread roll-out of associated types in the standard library indicates they're getting good, and it's lame to have to activate a feature in essentially every crate ever.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/deriving/hash.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 54 |
3 files changed, 11 insertions, 65 deletions
diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs index b9acde4bf6b..844bd80d161 100644 --- a/src/libsyntax/ext/deriving/hash.rs +++ b/src/libsyntax/ext/deriving/hash.rs @@ -25,20 +25,14 @@ pub fn expand_deriving_hash<F>(cx: &mut ExtCtxt, F: FnOnce(P<Item>), { - let (path, generics, args) = if cx.ecfg.deriving_hash_type_parameter { - (Path::new_(vec!("std", "hash", "Hash"), None, - vec!(box Literal(Path::new_local("__S"))), true), - LifetimeBounds { - lifetimes: Vec::new(), - bounds: vec!(("__S", - vec!(Path::new(vec!("std", "hash", "Writer"))))), - }, - Path::new_local("__S")) - } else { - (Path::new(vec!("std", "hash", "Hash")), - LifetimeBounds::empty(), - Path::new(vec!("std", "hash", "sip", "SipState"))) + let path = Path::new_(vec!("std", "hash", "Hash"), None, + vec!(box Literal(Path::new_local("__S"))), true); + let generics = LifetimeBounds { + lifetimes: Vec::new(), + bounds: vec!(("__S", + vec!(Path::new(vec!("std", "hash", "Writer"))))), }; + let args = Path::new_local("__S"); let inline = cx.meta_word(span, InternedString::new("inline")); let attrs = vec!(cx.attribute(span, inline)); let hash_trait_def = TraitDef { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index b3f30dd4581..b3e839b4fb6 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1161,7 +1161,6 @@ fn new_span(cx: &ExtCtxt, sp: Span) -> Span { pub struct ExpansionConfig { pub crate_name: String, - pub deriving_hash_type_parameter: bool, pub enable_quotes: bool, pub recursion_limit: uint, } @@ -1170,7 +1169,6 @@ impl ExpansionConfig { pub fn default(crate_name: String) -> ExpansionConfig { ExpansionConfig { crate_name: crate_name, - deriving_hash_type_parameter: false, enable_quotes: false, recursion_limit: 64, } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index cb6277069e1..2802ad3c3e3 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -36,7 +36,7 @@ use std::ascii::AsciiExt; // if you change this list without updating src/doc/reference.md, @cmr will be sad static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ - ("globs", Active), + ("globs", Accepted), ("macro_rules", Active), ("struct_variant", Accepted), ("asm", Active), @@ -54,7 +54,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("lang_items", Active), ("simd", Active), - ("default_type_params", Active), + ("default_type_params", Accepted), ("quote", Active), ("link_llvm_intrinsics", Active), ("linkage", Active), @@ -67,7 +67,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("import_shadowing", Active), ("advanced_slice_patterns", Active), ("tuple_indexing", Accepted), - ("associated_types", Active), + ("associated_types", Accepted), ("visible_private_types", Active), ("slicing_syntax", Active), @@ -112,7 +112,6 @@ enum Status { /// A set of features to be used by later passes. #[derive(Copy)] pub struct Features { - pub default_type_params: bool, pub unboxed_closures: bool, pub rustc_diagnostic_macros: bool, pub import_shadowing: bool, @@ -125,7 +124,6 @@ pub struct Features { impl Features { pub fn new() -> Features { Features { - default_type_params: false, unboxed_closures: false, rustc_diagnostic_macros: false, import_shadowing: false, @@ -232,13 +230,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { fn visit_view_item(&mut self, i: &ast::ViewItem) { match i.node { - ast::ViewItemUse(ref path) => { - if let ast::ViewPathGlob(..) = path.node { - self.gate_feature("globs", path.span, - "glob import statements are \ - experimental and possibly buggy"); - } - } + ast::ViewItemUse(..) => {} ast::ViewItemExternCrate(..) => { for attr in i.attrs.iter() { if attr.name().get() == "phase"{ @@ -313,18 +305,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { many unsafe patterns and may be \ removed in the future"); } - - for item in items.iter() { - match *item { - ast::MethodImplItem(_) => {} - ast::TypeImplItem(ref typedef) => { - self.gate_feature("associated_types", - typedef.span, - "associated types are \ - experimental") - } - } - } } _ => {} @@ -333,17 +313,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { visit::walk_item(self, i); } - fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) { - match *trait_item { - ast::RequiredMethod(_) | ast::ProvidedMethod(_) => {} - ast::TypeTraitItem(ref ti) => { - self.gate_feature("associated_types", - ti.ty_param.span, - "associated types are experimental") - } - } - } - fn visit_foreign_item(&mut self, i: &ast::ForeignItem) { if attr::contains_name(i.attrs[], "linkage") { self.gate_feature("linkage", i.span, @@ -379,20 +348,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { visit::walk_expr(self, e); } - fn visit_generics(&mut self, generics: &ast::Generics) { - for type_parameter in generics.ty_params.iter() { - match type_parameter.default { - Some(ref ty) => { - self.gate_feature("default_type_params", ty.span, - "default type parameters are \ - experimental and possibly buggy"); - } - None => {} - } - } - visit::walk_generics(self, generics); - } - fn visit_attribute(&mut self, attr: &ast::Attribute) { if attr::contains_name(slice::ref_slice(attr), "lang") { self.gate_feature("lang_items", @@ -498,7 +453,6 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C check(&mut cx, krate); (Features { - default_type_params: cx.has_feature("default_type_params"), unboxed_closures: cx.has_feature("unboxed_closures"), rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"), import_shadowing: cx.has_feature("import_shadowing"), |
