mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Ungate default type parameters.
These are in scope for 1.0, and this is good to e.g. find as many bugs as possible.
This commit is contained in:
parent
6795148169
commit
6e3d78f06f
@ -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(),
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
#![feature(globs)]
|
||||
#![feature(link_args)]
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(old_orphan_check)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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<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"),
|
||||
|
Loading…
Reference in New Issue
Block a user