mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Rename #[on_unimplemented] -> #[rustc_on_unimplemented]
This commit is contained in:
parent
add20bbb6d
commit
dd074ab4ee
@ -101,8 +101,8 @@ pub trait Iterator {
|
|||||||
|
|
||||||
/// Conversion from an `Iterator`
|
/// Conversion from an `Iterator`
|
||||||
#[stable]
|
#[stable]
|
||||||
#[on_unimplemented="a collection of type `{Self}` cannot be \
|
#[rustc_on_unimplemented="a collection of type `{Self}` cannot be \
|
||||||
built from an iterator over elements of type `{A}`"]
|
built from an iterator over elements of type `{A}`"]
|
||||||
pub trait FromIterator<A> {
|
pub trait FromIterator<A> {
|
||||||
/// Build a container with elements from an external iterator.
|
/// Build a container with elements from an external iterator.
|
||||||
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
||||||
|
@ -666,7 +666,7 @@ impl LintPass for UnusedAttributes {
|
|||||||
"must_use",
|
"must_use",
|
||||||
"stable",
|
"stable",
|
||||||
"unstable",
|
"unstable",
|
||||||
"on_unimplemented",
|
"rustc_on_unimplemented",
|
||||||
|
|
||||||
// FIXME: #19470 this shouldn't be needed forever
|
// FIXME: #19470 this shouldn't be needed forever
|
||||||
"old_orphan_check",
|
"old_orphan_check",
|
||||||
|
@ -71,7 +71,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||||||
let def_id = trait_ref.def_id;
|
let def_id = trait_ref.def_id;
|
||||||
let mut report = None;
|
let mut report = None;
|
||||||
ty::each_attr(infcx.tcx, def_id, |item| {
|
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 {
|
let err_sp = if item.meta().span == DUMMY_SP {
|
||||||
span
|
span
|
||||||
} else {
|
} else {
|
||||||
@ -99,7 +99,8 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||||||
None => {
|
None => {
|
||||||
infcx.tcx.sess
|
infcx.tcx.sess
|
||||||
.span_err(err_sp,
|
.span_err(err_sp,
|
||||||
format!("the #[on_unimplemented] attribute on \
|
format!("the #[rustc_on_unimplemented] \
|
||||||
|
attribute on \
|
||||||
trait definition for {} refers to \
|
trait definition for {} refers to \
|
||||||
non-existent type parameter {}",
|
non-existent type parameter {}",
|
||||||
trait_str, s)
|
trait_str, s)
|
||||||
@ -111,10 +112,12 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||||||
_ => {
|
_ => {
|
||||||
infcx.tcx.sess
|
infcx.tcx.sess
|
||||||
.span_err(err_sp,
|
.span_err(err_sp,
|
||||||
format!("the #[on_unimplemented] attribute on \
|
format!("the #[rustc_on_unimplemented] \
|
||||||
|
attribute on \
|
||||||
trait definition for {} must have named \
|
trait definition for {} must have named \
|
||||||
format arguments, \
|
format arguments, \
|
||||||
eg `#[on_unimplemented = \"foo {{T}}\"]`",
|
eg `#[rustc_on_unimplemented = \
|
||||||
|
\"foo {{T}}\"]`",
|
||||||
trait_str).as_slice());
|
trait_str).as_slice());
|
||||||
errored = true;
|
errored = true;
|
||||||
None
|
None
|
||||||
@ -128,9 +131,9 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
infcx.tcx.sess.span_err(err_sp,
|
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, \
|
trait definition for {} must have a value, \
|
||||||
eg `#[on_unimplemented = \"foo\"]`",
|
eg `#[rustc_on_unimplemented = \"foo\"]`",
|
||||||
trait_str).as_slice());
|
trait_str).as_slice());
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
@ -173,7 +176,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||||||
"the trait `{}` is not implemented for the type `{}`",
|
"the trait `{}` is not implemented for the type `{}`",
|
||||||
trait_ref.user_string(infcx.tcx),
|
trait_ref.user_string(infcx.tcx),
|
||||||
trait_ref.self_ty().user_string(infcx.tcx)).as_slice());
|
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
|
// report with that message if it does
|
||||||
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);
|
||||||
|
@ -783,7 +783,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
|||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
item: &ast::Item) {
|
item: &ast::Item) {
|
||||||
if let Some(ref attr) = item.attrs.iter().find(|&: a| {
|
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() {
|
if let Some(ref istring) = attr.value_str() {
|
||||||
let mut parser = Parser::new(istring.get());
|
let mut parser = Parser::new(istring.get());
|
||||||
@ -819,7 +819,7 @@ fn check_trait_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
|||||||
} else {
|
} else {
|
||||||
ccx.tcx.sess.span_err(attr.span,
|
ccx.tcx.sess.span_err(attr.span,
|
||||||
"this attribute must have a value, \
|
"this attribute must have a value, \
|
||||||
eg `#[on_unimplemented = \"foo\"]`")
|
eg `#[rustc_on_unimplemented = \"foo\"]`")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
#[allow(unused)]
|
#[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>{}
|
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> {
|
trait MyFromIterator<A> {
|
||||||
/// Build a container with elements from an external iterator.
|
/// Build a container with elements from an external iterator.
|
||||||
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
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 {}
|
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
|
//~^ ERROR there is no type parameter C on trait BadAnnotation2
|
||||||
trait BadAnnotation2<A,B> {}
|
trait BadAnnotation2<A,B> {}
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
// ignore-tidy-linelength
|
// 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>{}
|
trait Foo<Bar, Baz, Quux>{}
|
||||||
|
|
||||||
fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T {
|
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> {
|
trait MyFromIterator<A> {
|
||||||
/// Build a container with elements from an external iterator.
|
/// Build a container with elements from an external iterator.
|
||||||
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
||||||
|
Loading…
Reference in New Issue
Block a user