Skip to content

Commit bc41291

Browse files
committed
---
yaml --- r: 273149 b: refs/heads/beta c: e816910 h: refs/heads/master i: 273147: 176cccd
1 parent 1a83ae1 commit bc41291

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 9f16c2ce59ac942e1c0415987012100756a44039
26+
refs/heads/beta: e81691039854e678381042ce93e13bee6971c3d9
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/middle/traits/specialize.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ impl SpecializationGraph {
8888
let overlap = traits::overlapping_impls(&infcx, possible_sibling, impl_def_id);
8989

9090
if let Some(trait_ref) = overlap {
91+
if !tcx.sess.features.borrow().specialization {
92+
// if specialization is not turned on, all overlaps
93+
// should immediately trigger an error
94+
95+
return Err(Overlap {
96+
with_impl: possible_sibling,
97+
on_trait_ref: trait_ref,
98+
});
99+
}
100+
91101
let le = specializes(tcx, impl_def_id, possible_sibling);
92102
let ge = specializes(tcx, possible_sibling, impl_def_id);
93103

branches/beta/src/libsyntax/feature_gate.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
248248

249249
// `expr?`
250250
("question_mark", "1.9.0", Some(31436), Active)
251+
252+
// impl specialization (RFC 1210)
253+
("specialization", "1.7.0", None, Active),
251254
];
252255
// (changing above list without updating src/doc/reference.md makes @cmr sad)
253256

@@ -574,6 +577,7 @@ pub struct Features {
574577
pub stmt_expr_attributes: bool,
575578
pub deprecated: bool,
576579
pub question_mark: bool,
580+
pub specialization: bool,
577581
}
578582

579583
impl Features {
@@ -608,6 +612,7 @@ impl Features {
608612
stmt_expr_attributes: false,
609613
deprecated: false,
610614
question_mark: false,
615+
specialization: false,
611616
}
612617
}
613618
}
@@ -1102,6 +1107,12 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
11021107
}
11031108

11041109
fn visit_impl_item(&mut self, ii: &'v ast::ImplItem) {
1110+
if ii.defaultness == ast::Defaultness::Default {
1111+
self.gate_feature("specialization",
1112+
ii.span,
1113+
"specialization is unstable");
1114+
}
1115+
11051116
match ii.node {
11061117
ast::ImplItemKind::Const(..) => {
11071118
self.gate_feature("associated_consts",
@@ -1212,6 +1223,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler,
12121223
stmt_expr_attributes: cx.has_feature("stmt_expr_attributes"),
12131224
deprecated: cx.has_feature("deprecated"),
12141225
question_mark: cx.has_feature("question_mark"),
1226+
specialization: cx.has_feature("specialization"),
12151227
}
12161228
}
12171229

0 commit comments

Comments
 (0)