Skip to content

Commit 6e3d78f

Browse files
committed
Ungate default type parameters.
These are in scope for 1.0, and this is good to e.g. find as many bugs as possible.
1 parent 6795148 commit 6e3d78f

File tree

7 files changed

+10
-42
lines changed

7 files changed

+10
-42
lines changed

src/librustc_driver/driver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
272272
}
273273
let cfg = syntax::ext::expand::ExpansionConfig {
274274
crate_name: crate_name.to_string(),
275-
deriving_hash_type_parameter: sess.features.borrow().default_type_params,
276275
enable_quotes: sess.features.borrow().quote,
277276
recursion_limit: sess.recursion_limit.get(),
278277
};

src/librustc_llvm/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#![feature(globs)]
2525
#![feature(link_args)]
2626
#![feature(unboxed_closures)]
27+
#![feature(old_orphan_check)]
2728

2829
extern crate libc;
2930

src/librustc_resolve/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(globs, phase, slicing_syntax)]
2020
#![feature(rustc_diagnostic_macros)]
2121
#![feature(associated_types)]
22+
#![feature(old_orphan_check)]
2223

2324
#[phase(plugin, link)] extern crate log;
2425
#[phase(plugin, link)] extern crate syntax;

src/librustc_typeck/astconv.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,6 @@ fn create_substs_for_ast_path<'tcx,AC,RS>(
360360
supplied_ty_param_count)[]);
361361
}
362362

363-
if supplied_ty_param_count > required_ty_param_count
364-
&& !this.tcx().sess.features.borrow().default_type_params {
365-
span_err!(this.tcx().sess, span, E0108,
366-
"default type parameters are experimental and possibly buggy");
367-
span_help!(this.tcx().sess, span,
368-
"add #![feature(default_type_params)] to the crate attributes to enable");
369-
}
370-
371363
let mut substs = Substs::new_type(types, regions);
372364

373365
match self_ty {

src/libsyntax/ext/deriving/hash.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,14 @@ pub fn expand_deriving_hash<F>(cx: &mut ExtCtxt,
2525
F: FnOnce(P<Item>),
2626
{
2727

28-
let (path, generics, args) = if cx.ecfg.deriving_hash_type_parameter {
29-
(Path::new_(vec!("std", "hash", "Hash"), None,
30-
vec!(box Literal(Path::new_local("__S"))), true),
31-
LifetimeBounds {
32-
lifetimes: Vec::new(),
33-
bounds: vec!(("__S",
34-
vec!(Path::new(vec!("std", "hash", "Writer"))))),
35-
},
36-
Path::new_local("__S"))
37-
} else {
38-
(Path::new(vec!("std", "hash", "Hash")),
39-
LifetimeBounds::empty(),
40-
Path::new(vec!("std", "hash", "sip", "SipState")))
28+
let path = Path::new_(vec!("std", "hash", "Hash"), None,
29+
vec!(box Literal(Path::new_local("__S"))), true);
30+
let generics = LifetimeBounds {
31+
lifetimes: Vec::new(),
32+
bounds: vec!(("__S",
33+
vec!(Path::new(vec!("std", "hash", "Writer"))))),
4134
};
35+
let args = Path::new_local("__S");
4236
let inline = cx.meta_word(span, InternedString::new("inline"));
4337
let attrs = vec!(cx.attribute(span, inline));
4438
let hash_trait_def = TraitDef {

src/libsyntax/ext/expand.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,6 @@ fn new_span(cx: &ExtCtxt, sp: Span) -> Span {
11611161

11621162
pub struct ExpansionConfig {
11631163
pub crate_name: String,
1164-
pub deriving_hash_type_parameter: bool,
11651164
pub enable_quotes: bool,
11661165
pub recursion_limit: uint,
11671166
}
@@ -1170,7 +1169,6 @@ impl ExpansionConfig {
11701169
pub fn default(crate_name: String) -> ExpansionConfig {
11711170
ExpansionConfig {
11721171
crate_name: crate_name,
1173-
deriving_hash_type_parameter: false,
11741172
enable_quotes: false,
11751173
recursion_limit: 64,
11761174
}

src/libsyntax/feature_gate.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
5454
("lang_items", Active),
5555

5656
("simd", Active),
57-
("default_type_params", Active),
57+
("default_type_params", Accepted),
5858
("quote", Active),
5959
("link_llvm_intrinsics", Active),
6060
("linkage", Active),
@@ -112,7 +112,6 @@ enum Status {
112112
/// A set of features to be used by later passes.
113113
#[derive(Copy)]
114114
pub struct Features {
115-
pub default_type_params: bool,
116115
pub unboxed_closures: bool,
117116
pub rustc_diagnostic_macros: bool,
118117
pub import_shadowing: bool,
@@ -125,7 +124,6 @@ pub struct Features {
125124
impl Features {
126125
pub fn new() -> Features {
127126
Features {
128-
default_type_params: false,
129127
unboxed_closures: false,
130128
rustc_diagnostic_macros: false,
131129
import_shadowing: false,
@@ -356,20 +354,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
356354
visit::walk_expr(self, e);
357355
}
358356

359-
fn visit_generics(&mut self, generics: &ast::Generics) {
360-
for type_parameter in generics.ty_params.iter() {
361-
match type_parameter.default {
362-
Some(ref ty) => {
363-
self.gate_feature("default_type_params", ty.span,
364-
"default type parameters are \
365-
experimental and possibly buggy");
366-
}
367-
None => {}
368-
}
369-
}
370-
visit::walk_generics(self, generics);
371-
}
372-
373357
fn visit_attribute(&mut self, attr: &ast::Attribute) {
374358
if attr::contains_name(slice::ref_slice(attr), "lang") {
375359
self.gate_feature("lang_items",
@@ -475,7 +459,6 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
475459
check(&mut cx, krate);
476460

477461
(Features {
478-
default_type_params: cx.has_feature("default_type_params"),
479462
unboxed_closures: cx.has_feature("unboxed_closures"),
480463
rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"),
481464
import_shadowing: cx.has_feature("import_shadowing"),

0 commit comments

Comments
 (0)