]> git.lizzy.rs Git - rust.git/commitdiff
Feature gate #[rustc_on_unimplemented]
authorManish Goregaokar <manishsmail@gmail.com>
Sun, 11 Jan 2015 15:23:24 +0000 (20:53 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Sun, 11 Jan 2015 18:30:53 +0000 (00:00 +0530)
src/libcore/lib.rs
src/librustc/middle/traits/error_reporting.rs
src/libsyntax/feature_gate.rs
src/test/compile-fail/on-unimplemented-bad-anno.rs
src/test/compile-fail/on-unimplemented.rs

index 28f8cf588bea9a1a408876d308837a45b3e9bdd4..78e8a2a9e9164be4bf34700c3ec630231a328202 100644 (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]
index da3b5f635e13b6faf13776d57dc4cc58ce160d1d..6b4dd101286d664ec0195992e7dd29c48a2c6b09 100644 (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());
                         }
                     }
                 }
index 8175c0a9eecf4805d88fd571467b3c241a4a359f..8929bbe0232edc7bf78a6404f8204cbdfb83cd13 100644 (file)
@@ -71,6 +71,7 @@
     ("visible_private_types", Active),
     ("slicing_syntax", Active),
     ("box_syntax", Active),
+    ("on_unimplemented", Active),
 
     ("if_let", Accepted),
     ("while_let", Accepted),
@@ -249,6 +250,10 @@ fn visit_item(&mut self, i: &ast::Item) {
                 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 {
index ec825c1304331cc0703886154dff14ee3d9b7565..3bd3f517dbccd095af3327a9f81045c4a6ff08ce 100644 (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>{}
index 7d579fb340a988ff9c380798bfddb17298e005fe..7b406afcf1f5832dcd79890388076ff26b09da29 100644 (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>{}