Skip to content

Commit dd074ab

Browse files
committed
Rename #[on_unimplemented] -> #[rustc_on_unimplemented]
1 parent add20bb commit dd074ab

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

src/libcore/iter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ pub trait Iterator {
101101

102102
/// Conversion from an `Iterator`
103103
#[stable]
104-
#[on_unimplemented="a collection of type `{Self}` cannot be \
105-
built from an iterator over elements of type `{A}`"]
104+
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
105+
built from an iterator over elements of type `{A}`"]
106106
pub trait FromIterator<A> {
107107
/// Build a container with elements from an external iterator.
108108
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;

src/librustc/lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ impl LintPass for UnusedAttributes {
666666
"must_use",
667667
"stable",
668668
"unstable",
669-
"on_unimplemented",
669+
"rustc_on_unimplemented",
670670

671671
// FIXME: #19470 this shouldn't be needed forever
672672
"old_orphan_check",

src/librustc/middle/traits/error_reporting.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
7171
let def_id = trait_ref.def_id;
7272
let mut report = None;
7373
ty::each_attr(infcx.tcx, def_id, |item| {
74-
if item.check_name("on_unimplemented") {
74+
if item.check_name("rustc_on_unimplemented") {
7575
let err_sp = if item.meta().span == DUMMY_SP {
7676
span
7777
} else {
@@ -99,7 +99,8 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
9999
None => {
100100
infcx.tcx.sess
101101
.span_err(err_sp,
102-
format!("the #[on_unimplemented] attribute on \
102+
format!("the #[rustc_on_unimplemented] \
103+
attribute on \
103104
trait definition for {} refers to \
104105
non-existent type parameter {}",
105106
trait_str, s)
@@ -111,10 +112,12 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
111112
_ => {
112113
infcx.tcx.sess
113114
.span_err(err_sp,
114-
format!("the #[on_unimplemented] attribute on \
115+
format!("the #[rustc_on_unimplemented] \
116+
attribute on \
115117
trait definition for {} must have named \
116118
format arguments, \
117-
eg `#[on_unimplemented = \"foo {{T}}\"]`",
119+
eg `#[rustc_on_unimplemented = \
120+
\"foo {{T}}\"]`",
118121
trait_str).as_slice());
119122
errored = true;
120123
None
@@ -128,9 +131,9 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
128131
}
129132
} else {
130133
infcx.tcx.sess.span_err(err_sp,
131-
format!("the #[on_unimplemented] attribute on \
134+
format!("the #[rustc_on_unimplemented] attribute on \
132135
trait definition for {} must have a value, \
133-
eg `#[on_unimplemented = \"foo\"]`",
136+
eg `#[rustc_on_unimplemented = \"foo\"]`",
134137
trait_str).as_slice());
135138
}
136139
false
@@ -173,7 +176,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
173176
"the trait `{}` is not implemented for the type `{}`",
174177
trait_ref.user_string(infcx.tcx),
175178
trait_ref.self_ty().user_string(infcx.tcx)).as_slice());
176-
// Check if it has a custom "#[on_unimplemented]" error message,
179+
// Check if it has a custom "#[rustc_on_unimplemented]" error message,
177180
// report with that message if it does
178181
let custom_note = report_on_unimplemented(infcx, &*trait_ref.0,
179182
obligation.cause.span);

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
783783
generics: &ast::Generics,
784784
item: &ast::Item) {
785785
if let Some(ref attr) = item.attrs.iter().find(|&: a| {
786-
a.check_name("on_unimplemented")
786+
a.check_name("rustc_on_unimplemented")
787787
}) {
788788
if let Some(ref istring) = attr.value_str() {
789789
let mut parser = Parser::new(istring.get());
@@ -819,7 +819,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
819819
} else {
820820
ccx.tcx.sess.span_err(attr.span,
821821
"this attribute must have a value, \
822-
eg `#[on_unimplemented = \"foo\"]`")
822+
eg `#[rustc_on_unimplemented = \"foo\"]`")
823823
}
824824
}
825825
}

src/test/compile-fail/on-unimplemented-bad-anno.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111

1212
#[allow(unused)]
1313

14-
#[on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
14+
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
1515
trait Foo<Bar, Baz, Quux>{}
1616

17-
#[on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
17+
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
1818
trait MyFromIterator<A> {
1919
/// Build a container with elements from an external iterator.
2020
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
2121
}
2222

23-
#[on_unimplemented] //~ ERROR this attribute must have a value
23+
#[rustc_on_unimplemented] //~ ERROR this attribute must have a value
2424
trait BadAnnotation1 {}
2525

26-
#[on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
26+
#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
2727
//~^ ERROR there is no type parameter C on trait BadAnnotation2
2828
trait BadAnnotation2<A,B> {}
2929

src/test/compile-fail/on-unimplemented.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
// except according to those terms.
1010
// ignore-tidy-linelength
1111

12-
#[on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
12+
#[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}`"]
1313
trait Foo<Bar, Baz, Quux>{}
1414

1515
fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T {
1616

1717
}
1818

19-
#[on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
19+
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"]
2020
trait MyFromIterator<A> {
2121
/// Build a container with elements from an external iterator.
2222
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;

0 commit comments

Comments
 (0)