Skip to content

Commit b244319

Browse files
committed
rollup merge of rust-lang#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.
2 parents cda6acb + 3e9d593 commit b244319

File tree

186 files changed

+37
-409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+37
-409
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
@@ -361,14 +361,6 @@ fn create_substs_for_ast_path<'tcx>(
361361
supplied_ty_param_count)[]);
362362
}
363363

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

374366
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: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use std::ascii::AsciiExt;
3636

3737
// if you change this list without updating src/doc/reference.md, @cmr will be sad
3838
static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
39-
("globs", Active),
39+
("globs", Accepted),
4040
("macro_rules", Active),
4141
("struct_variant", Accepted),
4242
("asm", Active),
@@ -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),
@@ -67,7 +67,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
6767
("import_shadowing", Active),
6868
("advanced_slice_patterns", Active),
6969
("tuple_indexing", Accepted),
70-
("associated_types", Active),
70+
("associated_types", Accepted),
7171
("visible_private_types", Active),
7272
("slicing_syntax", Active),
7373

@@ -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,
@@ -232,13 +230,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
232230

233231
fn visit_view_item(&mut self, i: &ast::ViewItem) {
234232
match i.node {
235-
ast::ViewItemUse(ref path) => {
236-
if let ast::ViewPathGlob(..) = path.node {
237-
self.gate_feature("globs", path.span,
238-
"glob import statements are \
239-
experimental and possibly buggy");
240-
}
241-
}
233+
ast::ViewItemUse(..) => {}
242234
ast::ViewItemExternCrate(..) => {
243235
for attr in i.attrs.iter() {
244236
if attr.name().get() == "phase"{
@@ -313,18 +305,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
313305
many unsafe patterns and may be \
314306
removed in the future");
315307
}
316-
317-
for item in items.iter() {
318-
match *item {
319-
ast::MethodImplItem(_) => {}
320-
ast::TypeImplItem(ref typedef) => {
321-
self.gate_feature("associated_types",
322-
typedef.span,
323-
"associated types are \
324-
experimental")
325-
}
326-
}
327-
}
328308
}
329309

330310
_ => {}
@@ -333,17 +313,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
333313
visit::walk_item(self, i);
334314
}
335315

336-
fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) {
337-
match *trait_item {
338-
ast::RequiredMethod(_) | ast::ProvidedMethod(_) => {}
339-
ast::TypeTraitItem(ref ti) => {
340-
self.gate_feature("associated_types",
341-
ti.ty_param.span,
342-
"associated types are experimental")
343-
}
344-
}
345-
}
346-
347316
fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
348317
if attr::contains_name(i.attrs[], "linkage") {
349318
self.gate_feature("linkage", i.span,
@@ -379,20 +348,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
379348
visit::walk_expr(self, e);
380349
}
381350

382-
fn visit_generics(&mut self, generics: &ast::Generics) {
383-
for type_parameter in generics.ty_params.iter() {
384-
match type_parameter.default {
385-
Some(ref ty) => {
386-
self.gate_feature("default_type_params", ty.span,
387-
"default type parameters are \
388-
experimental and possibly buggy");
389-
}
390-
None => {}
391-
}
392-
}
393-
visit::walk_generics(self, generics);
394-
}
395-
396351
fn visit_attribute(&mut self, attr: &ast::Attribute) {
397352
if attr::contains_name(slice::ref_slice(attr), "lang") {
398353
self.gate_feature("lang_items",
@@ -498,7 +453,6 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, krate: &ast::C
498453
check(&mut cx, krate);
499454

500455
(Features {
501-
default_type_params: cx.has_feature("default_type_params"),
502456
unboxed_closures: cx.has_feature("unboxed_closures"),
503457
rustc_diagnostic_macros: cx.has_feature("rustc_diagnostic_macros"),
504458
import_shadowing: cx.has_feature("import_shadowing"),

src/test/auxiliary/associated-types-cc-lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// cross-crate scenario.
1313

1414
#![crate_type="lib"]
15-
#![feature(associated_types)]
1615

1716
pub trait Bar {
1817
type T;

src/test/auxiliary/default_type_params_xc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(default_type_params)]
12-
1311
pub struct Heap;
1412

1513
pub struct FakeHeap;

src/test/auxiliary/issue-16643.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![crate_type = "lib"]
12-
#![feature(associated_types)]
1312

1413
pub struct TreeBuilder<H>;
1514

0 commit comments

Comments
 (0)