From 82a96a11abcb9cc4d342402746af270eb4f28325 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Mon, 5 Jan 2015 17:04:32 +1100 Subject: Ungate associated types. They work pretty well now, and the stdlib is using them everywhere so they're impossible to avoid anyway. --- src/libsyntax/feature_gate.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f8ac34cfe29..caf3bcd77c4 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -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), @@ -313,18 +313,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 +321,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, -- cgit 1.4.1-3-g733a5 From 679514816974f23eff367b37e9082599a25900f0 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Mon, 5 Jan 2015 17:04:55 +1100 Subject: Ungate globs. These are in scope for 1.0, so this is good to e.g. make it easier find bugs. --- src/libsyntax/feature_gate.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index caf3bcd77c4..19e44c2c21b 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), @@ -232,13 +232,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"{ -- cgit 1.4.1-3-g733a5 From 6e3d78f06fc78e6ad58379824be2d7fed525655a Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Mon, 5 Jan 2015 17:07:16 +1100 Subject: Ungate default type parameters. These are in scope for 1.0, and this is good to e.g. find as many bugs as possible. --- src/librustc_driver/driver.rs | 1 - src/librustc_llvm/lib.rs | 1 + src/librustc_resolve/lib.rs | 1 + src/librustc_typeck/astconv.rs | 8 -------- src/libsyntax/ext/deriving/hash.rs | 20 +++++++------------- src/libsyntax/ext/expand.rs | 2 -- src/libsyntax/feature_gate.rs | 19 +------------------ 7 files changed, 10 insertions(+), 42 deletions(-) (limited to 'src/libsyntax') diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 1455aa3c99b..1a4856333bf 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -272,7 +272,6 @@ pub fn phase_2_configure_and_expand(sess: &Session, } let cfg = syntax::ext::expand::ExpansionConfig { crate_name: crate_name.to_string(), - deriving_hash_type_parameter: sess.features.borrow().default_type_params, enable_quotes: sess.features.borrow().quote, recursion_limit: sess.recursion_limit.get(), }; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 2ec5f37634a..0445404f8e6 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -24,6 +24,7 @@ #![feature(globs)] #![feature(link_args)] #![feature(unboxed_closures)] +#![feature(old_orphan_check)] extern crate libc; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 2c2678c8dc6..5573b675214 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -19,6 +19,7 @@ #![feature(globs, phase, slicing_syntax)] #![feature(rustc_diagnostic_macros)] #![feature(associated_types)] +#![feature(old_orphan_check)] #[phase(plugin, link)] extern crate log; #[phase(plugin, link)] extern crate syntax; diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 1d62733875e..bf01d5e38e7 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -360,14 +360,6 @@ fn create_substs_for_ast_path<'tcx,AC,RS>( supplied_ty_param_count)[]); } - if supplied_ty_param_count > required_ty_param_count - && !this.tcx().sess.features.borrow().default_type_params { - span_err!(this.tcx().sess, span, E0108, - "default type parameters are experimental and possibly buggy"); - span_help!(this.tcx().sess, span, - "add #![feature(default_type_params)] to the crate attributes to enable"); - } - let mut substs = Substs::new_type(types, regions); match self_ty { diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs index 9ff42d85cfb..553b8af172f 100644 --- a/src/libsyntax/ext/deriving/hash.rs +++ b/src/libsyntax/ext/deriving/hash.rs @@ -25,20 +25,14 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt, F: FnOnce(P), { - 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 19e44c2c21b..584558638b7 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -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), @@ -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, @@ -356,20 +354,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", @@ -475,7 +459,6 @@ fn check_crate_inner(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"), -- cgit 1.4.1-3-g733a5