]> git.lizzy.rs Git - rust.git/commitdiff
Rename #[on_unimplemented] -> #[rustc_on_unimplemented]
authorManish Goregaokar <manishsmail@gmail.com>
Sun, 11 Jan 2015 12:58:06 +0000 (18:28 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Sun, 11 Jan 2015 15:22:43 +0000 (20:52 +0530)
src/libcore/iter.rs
src/librustc/lint/builtin.rs
src/librustc/middle/traits/error_reporting.rs
src/librustc_typeck/check/mod.rs
src/test/compile-fail/on-unimplemented-bad-anno.rs
src/test/compile-fail/on-unimplemented.rs

index e22de10a974f02a7df795881b62c5c48418099d9..c88f3553e6b5506beb73d4419d73db2c2ff20e5e 100644 (file)
@@ -101,8 +101,8 @@ fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
 
 /// Conversion from an `Iterator`
 #[stable]
-#[on_unimplemented="a collection of type `{Self}` cannot be \
-                    built from an iterator over elements of type `{A}`"]
+#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
+                          built from an iterator over elements of type `{A}`"]
 pub trait FromIterator<A> {
     /// Build a container with elements from an external iterator.
     fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
index 300b9aaf10060cf02b68f92c3786cda435dd2ba1..8ed177c82a8f7c70749990544ef4c4e3e42f59a2 100644 (file)
@@ -666,7 +666,7 @@ fn check_attribute(&mut self, cx: &Context, attr: &ast::Attribute) {
             "must_use",
             "stable",
             "unstable",
-            "on_unimplemented",
+            "rustc_on_unimplemented",
 
             // FIXME: #19470 this shouldn't be needed forever
             "old_orphan_check",
index 0b0079c062db35bff5261f272ea80602a0fd14fa..da3b5f635e13b6faf13776d57dc4cc58ce160d1d 100644 (file)
@@ -71,7 +71,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
     let def_id = trait_ref.def_id;
     let mut report = None;
     ty::each_attr(infcx.tcx, def_id, |item| {
-        if item.check_name("on_unimplemented") {
+        if item.check_name("rustc_on_unimplemented") {
             let err_sp = if item.meta().span == DUMMY_SP {
                 span
             } else {
@@ -99,7 +99,8 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                 None => {
                                     infcx.tcx.sess
                                          .span_err(err_sp,
-                                                   format!("the #[on_unimplemented] attribute on \
+                                                   format!("the #[rustc_on_unimplemented] \
+                                                            attribute on \
                                                             trait definition for {} refers to \
                                                             non-existent type parameter {}",
                                                            trait_str, s)
@@ -111,10 +112,12 @@ trait definition for {} refers to \
                             _ => {
                                 infcx.tcx.sess
                                      .span_err(err_sp,
-                                               format!("the #[on_unimplemented] attribute on \
+                                               format!("the #[rustc_on_unimplemented] \
+                                                        attribute on \
                                                         trait definition for {} must have named \
                                                         format arguments, \
-                                                        eg `#[on_unimplemented = \"foo {{T}}\"]`",
+                                                        eg `#[rustc_on_unimplemented = \
+                                                        \"foo {{T}}\"]`",
                                                        trait_str).as_slice());
                                 errored = true;
                                 None
@@ -128,9 +131,9 @@ trait definition for {} must have named \
                 }
             } else {
                 infcx.tcx.sess.span_err(err_sp,
-                                        format!("the #[on_unimplemented] attribute on \
+                                        format!("the #[rustc_on_unimplemented] attribute on \
                                                  trait definition for {} must have a value, \
-                                                 eg `#[on_unimplemented = \"foo\"]`",
+                                                 eg `#[rustc_on_unimplemented = \"foo\"]`",
                                                  trait_str).as_slice());
             }
             false
@@ -173,7 +176,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
                                 "the trait `{}` is not implemented for the type `{}`",
                                 trait_ref.user_string(infcx.tcx),
                                 trait_ref.self_ty().user_string(infcx.tcx)).as_slice());
-                        // Check if it has a custom "#[on_unimplemented]" error message,
+                        // Check if it has a custom "#[rustc_on_unimplemented]" error message,
                         // report with that message if it does
                         let custom_note = report_on_unimplemented(infcx, &*trait_ref.0,
                                                                   obligation.cause.span);
index de6c884d6d71b450a4438a53ca04501f4c2eab51..7513d50deeac0c96cd3ba490d7c00e71af096aa4 100644 (file)
@@ -783,7 +783,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                generics: &ast::Generics,
                                item: &ast::Item) {
     if let Some(ref attr) = item.attrs.iter().find(|&: a| {
-        a.check_name("on_unimplemented")
+        a.check_name("rustc_on_unimplemented")
     }) {
         if let Some(ref istring) = attr.value_str() {
             let mut parser = Parser::new(istring.get());
@@ -819,7 +819,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
         } else {
             ccx.tcx.sess.span_err(attr.span,
                                   "this attribute must have a value, \
-                                   eg `#[on_unimplemented = \"foo\"]`")
+                                   eg `#[rustc_on_unimplemented = \"foo\"]`")
         }
     }
 }
index 7ca228a69b8b15808d5bb835a3b1ed5116fedd28..ec825c1304331cc0703886154dff14ee3d9b7565 100644 (file)
 
 #[allow(unused)]
 
-#[on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
+#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
 trait Foo<Bar, Baz, Quux>{}
 
-#[on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
+#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
 trait MyFromIterator<A> {
     /// Build a container with elements from an external iterator.
     fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
 }
 
-#[on_unimplemented] //~ ERROR this attribute must have a value
+#[rustc_on_unimplemented] //~ ERROR this attribute must have a value
 trait BadAnnotation1 {}
 
-#[on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
+#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
 //~^ ERROR there is no type parameter C on trait BadAnnotation2
 trait BadAnnotation2<A,B> {}
 
index 20b4448ea77721837c440f6808094e9d300873e1..7d579fb340a988ff9c380798bfddb17298e005fe 100644 (file)
@@ -9,14 +9,14 @@
 // except according to those terms.
 // ignore-tidy-linelength
 
-#[on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
+#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
 trait Foo<Bar, Baz, Quux>{}
 
 fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T {
 
 }
 
-#[on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
+#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
 trait MyFromIterator<A> {
     /// Build a container with elements from an external iterator.
     fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;