Feature gate #[rustc_on_unimplemented]

This commit is contained in:
Manish Goregaokar 2015-01-11 20:53:24 +05:30
parent dd074ab4ee
commit ad7e33efee
5 changed files with 13 additions and 4 deletions

View File

@ -63,6 +63,7 @@
#![feature(simd, unsafe_destructor, slicing_syntax)]
#![feature(unboxed_closures)]
#![allow(unknown_features)] #![feature(int_uint)]
#![feature(on_unimplemented)]
#![deny(missing_docs)]
#[macro_use]

View File

@ -181,9 +181,8 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
let custom_note = report_on_unimplemented(infcx, &*trait_ref.0,
obligation.cause.span);
if let Some(s) = custom_note {
infcx.tcx.sess.span_note(
obligation.cause.span,
s.as_slice());
infcx.tcx.sess.span_note(obligation.cause.span,
s.as_slice());
}
}
}

View File

@ -71,6 +71,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
("visible_private_types", Active),
("slicing_syntax", Active),
("box_syntax", Active),
("on_unimplemented", Active),
("if_let", Accepted),
("while_let", Accepted),
@ -249,6 +250,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
self.gate_feature("linkage", i.span,
"the `linkage` attribute is experimental \
and not portable across platforms")
} else if attr.name() == "rustc_on_unimplemented" {
self.gate_feature("on_unimplemented", i.span,
"the `#[rustc_on_unimplemented]` attribute \
is an experimental feature")
}
}
match i.node {

View File

@ -9,7 +9,9 @@
// except according to those terms.
// ignore-tidy-linelength
#[allow(unused)]
#![feature(on_unimplemented)]
#![allow(unused)]
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
trait Foo<Bar, Baz, Quux>{}

View File

@ -9,6 +9,8 @@
// except according to those terms.
// ignore-tidy-linelength
#![feature(on_unimplemented)]
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
trait Foo<Bar, Baz, Quux>{}