Feature gate #[rustc_on_unimplemented]
This commit is contained in:
parent
dd074ab4ee
commit
ad7e33efee
5 changed files with 13 additions and 4 deletions
|
@ -63,6 +63,7 @@
|
||||||
#![feature(simd, unsafe_destructor, slicing_syntax)]
|
#![feature(simd, unsafe_destructor, slicing_syntax)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![allow(unknown_features)] #![feature(int_uint)]
|
#![allow(unknown_features)] #![feature(int_uint)]
|
||||||
|
#![feature(on_unimplemented)]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -181,8 +181,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
||||||
let custom_note = report_on_unimplemented(infcx, &*trait_ref.0,
|
let custom_note = report_on_unimplemented(infcx, &*trait_ref.0,
|
||||||
obligation.cause.span);
|
obligation.cause.span);
|
||||||
if let Some(s) = custom_note {
|
if let Some(s) = custom_note {
|
||||||
infcx.tcx.sess.span_note(
|
infcx.tcx.sess.span_note(obligation.cause.span,
|
||||||
obligation.cause.span,
|
|
||||||
s.as_slice());
|
s.as_slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
|
||||||
("visible_private_types", Active),
|
("visible_private_types", Active),
|
||||||
("slicing_syntax", Active),
|
("slicing_syntax", Active),
|
||||||
("box_syntax", Active),
|
("box_syntax", Active),
|
||||||
|
("on_unimplemented", Active),
|
||||||
|
|
||||||
("if_let", Accepted),
|
("if_let", Accepted),
|
||||||
("while_let", Accepted),
|
("while_let", Accepted),
|
||||||
|
@ -249,6 +250,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
|
||||||
self.gate_feature("linkage", i.span,
|
self.gate_feature("linkage", i.span,
|
||||||
"the `linkage` attribute is experimental \
|
"the `linkage` attribute is experimental \
|
||||||
and not portable across platforms")
|
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 {
|
match i.node {
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
#[allow(unused)]
|
#![feature(on_unimplemented)]
|
||||||
|
|
||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
|
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
|
||||||
trait Foo<Bar, Baz, Quux>{}
|
trait Foo<Bar, Baz, Quux>{}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
|
#![feature(on_unimplemented)]
|
||||||
|
|
||||||
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
|
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
|
||||||
trait Foo<Bar, Baz, Quux>{}
|
trait Foo<Bar, Baz, Quux>{}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue