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
7 changed files with 10 additions and 42 deletions
|
@ -272,7 +272,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
|
||||||
}
|
}
|
||||||
let cfg = syntax::ext::expand::ExpansionConfig {
|
let cfg = syntax::ext::expand::ExpansionConfig {
|
||||||
crate_name: crate_name.to_string(),
|
crate_name: crate_name.to_string(),
|
||||||
deriving_hash_type_parameter: sess.features.borrow().default_type_params,
|
|
||||||
enable_quotes: sess.features.borrow().quote,
|
enable_quotes: sess.features.borrow().quote,
|
||||||
recursion_limit: sess.recursion_limit.get(),
|
recursion_limit: sess.recursion_limit.get(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#![feature(globs)]
|
#![feature(globs)]
|
||||||
#![feature(link_args)]
|
#![feature(link_args)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
|
#![feature(old_orphan_check)]
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#![feature(globs, phase, slicing_syntax)]
|
#![feature(globs, phase, slicing_syntax)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(associated_types)]
|
#![feature(associated_types)]
|
||||||
|
#![feature(old_orphan_check)]
|
||||||
|
|
||||||
#[phase(plugin, link)] extern crate log;
|
#[phase(plugin, link)] extern crate log;
|
||||||
#[phase(plugin, link)] extern crate syntax;
|
#[phase(plugin, link)] extern crate syntax;
|
||||||
|
|
|
@ -360,14 +360,6 @@ fn create_substs_for_ast_path<'tcx,AC,RS>(
|
||||||
supplied_ty_param_count)[]);
|
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);
|
let mut substs = Substs::new_type(types, regions);
|
||||||
|
|
||||||
match self_ty {
|
match self_ty {
|
||||||
|
|
|
@ -25,20 +25,14 @@ pub fn expand_deriving_hash<F>(cx: &mut ExtCtxt,
|
||||||
F: FnOnce(P<Item>),
|
F: FnOnce(P<Item>),
|
||||||
{
|
{
|
||||||
|
|
||||||
let (path, generics, args) = if cx.ecfg.deriving_hash_type_parameter {
|
let path = Path::new_(vec!("std", "hash", "Hash"), None,
|
||||||
(Path::new_(vec!("std", "hash", "Hash"), None,
|
vec!(box Literal(Path::new_local("__S"))), true);
|
||||||
vec!(box Literal(Path::new_local("__S"))), true),
|
let generics = LifetimeBounds {
|
||||||
LifetimeBounds {
|
|
||||||
lifetimes: Vec::new(),
|
lifetimes: Vec::new(),
|
||||||
bounds: vec!(("__S",
|
bounds: vec!(("__S",
|
||||||
vec!(Path::new(vec!("std", "hash", "Writer"))))),
|
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 args = Path::new_local("__S");
|
||||||
let inline = cx.meta_word(span, InternedString::new("inline"));
|
let inline = cx.meta_word(span, InternedString::new("inline"));
|
||||||
let attrs = vec!(cx.attribute(span, inline));
|
let attrs = vec!(cx.attribute(span, inline));
|
||||||
let hash_trait_def = TraitDef {
|
let hash_trait_def = TraitDef {
|
||||||
|
|
|
@ -1161,7 +1161,6 @@ fn new_span(cx: &ExtCtxt, sp: Span) -> Span {
|
||||||
|
|
||||||
pub struct ExpansionConfig {
|
pub struct ExpansionConfig {
|
||||||
pub crate_name: String,
|
pub crate_name: String,
|
||||||
pub deriving_hash_type_parameter: bool,
|
|
||||||
pub enable_quotes: bool,
|
pub enable_quotes: bool,
|
||||||
pub recursion_limit: uint,
|
pub recursion_limit: uint,
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1169,6 @@ impl ExpansionConfig {
|
||||||
pub fn default(crate_name: String) -> ExpansionConfig {
|
pub fn default(crate_name: String) -> ExpansionConfig {
|
||||||
ExpansionConfig {
|
ExpansionConfig {
|
||||||
crate_name: crate_name,
|
crate_name: crate_name,
|
||||||
deriving_hash_type_parameter: false,
|
|
||||||
enable_quotes: false,
|
enable_quotes: false,
|
||||||
recursion_limit: 64,
|
recursion_limit: 64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
||||||
("lang_items", Active),
|
("lang_items", Active),
|
||||||
|
|
||||||
("simd", Active),
|
("simd", Active),
|
||||||
("default_type_params", Active),
|
("default_type_params", Accepted),
|
||||||
("quote", Active),
|
("quote", Active),
|
||||||
("link_llvm_intrinsics", Active),
|
("link_llvm_intrinsics", Active),
|
||||||
("linkage", Active),
|
("linkage", Active),
|
||||||
|
@ -112,7 +112,6 @@ enum Status {
|
||||||
/// A set of features to be used by later passes.
|
/// A set of features to be used by later passes.
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
pub struct Features {
|
pub struct Features {
|
||||||
pub default_type_params: bool,
|
|
||||||
pub unboxed_closures: bool,
|
pub unboxed_closures: bool,
|
||||||
pub rustc_diagnostic_macros: bool,
|
pub rustc_diagnostic_macros: bool,
|
||||||
pub import_shadowing: bool,
|
pub import_shadowing: bool,
|
||||||
|
@ -125,7 +124,6 @@ pub struct Features {
|
||||||
impl Features {
|
impl Features {
|
||||||
pub fn new() -> Features {
|
pub fn new() -> Features {
|
||||||
Features {
|
Features {
|
||||||
default_type_params: false,
|
|
||||||
unboxed_closures: false,
|
unboxed_closures: false,
|
||||||
rustc_diagnostic_macros: false,
|
rustc_diagnostic_macros: false,
|
||||||
import_shadowing: false,
|
import_shadowing: false,
|
||||||
|
@ -356,20 +354,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
|
||||||
visit::walk_expr(self, e);
|
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) {
|
fn visit_attribute(&mut self, attr: &ast::Attribute) {
|
||||||
if attr::contains_name(slice::ref_slice(attr), "lang") {
|
if attr::contains_name(slice::ref_slice(attr), "lang") {
|
||||||
self.gate_feature("lang_items",
|
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);
|
check(&mut cx, krate);
|
||||||
|
|
||||||
(Features {
|
(Features {
|
||||||
default_type_params: cx.has_feature("default_type_params"),
|
|
||||||
unboxed_closures: cx.has_feature("unboxed_closures"),
|
unboxed_closures: cx.has_feature("unboxed_closures"),
|
||||||
rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"),
|
rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"),
|
||||||
import_shadowing: cx.has_feature("import_shadowing"),
|
import_shadowing: cx.has_feature("import_shadowing"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue