1
Fork 0

Rollup merge of #119216 - weiznich:use_diagnostic_namespace_in_stdlib, r=compiler-errors

Use diagnostic namespace in stdlib

This required a minor fix to have the diagnostics shown in third party crates when the `diagnostic_namespace` feature is not enabled. See https://github.com/rust-lang/rust/pull/119216/commits/5d63f5d8d1a72167c1d5242b2e1ed5b7259fd526 for details. I've opted for having a single PR for both changes as it's really not that much code. If it is required it should be easy to split up the change into several PR's.

r? `@compiler-errors`
This commit is contained in:
Michael Goulet 2024-01-05 23:41:41 -05:00 committed by GitHub
commit d90c702566
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 80 additions and 33 deletions

View file

@ -521,7 +521,7 @@ impl<'tcx> OnUnimplementedDirective {
pub fn of_item(tcx: TyCtxt<'tcx>, item_def_id: DefId) -> Result<Option<Self>, ErrorGuaranteed> { pub fn of_item(tcx: TyCtxt<'tcx>, item_def_id: DefId) -> Result<Option<Self>, ErrorGuaranteed> {
if let Some(attr) = tcx.get_attr(item_def_id, sym::rustc_on_unimplemented) { if let Some(attr) = tcx.get_attr(item_def_id, sym::rustc_on_unimplemented) {
return Self::parse_attribute(attr, false, tcx, item_def_id); return Self::parse_attribute(attr, false, tcx, item_def_id);
} else if tcx.features().diagnostic_namespace { } else {
tcx.get_attrs_by_path(item_def_id, &[sym::diagnostic, sym::on_unimplemented]) tcx.get_attrs_by_path(item_def_id, &[sym::diagnostic, sym::on_unimplemented])
.filter_map(|attr| Self::parse_attribute(attr, true, tcx, item_def_id).transpose()) .filter_map(|attr| Self::parse_attribute(attr, true, tcx, item_def_id).transpose())
.try_fold(None, |aggr: Option<Self>, directive| { .try_fold(None, |aggr: Option<Self>, directive| {
@ -592,8 +592,6 @@ impl<'tcx> OnUnimplementedDirective {
Ok(Some(directive)) Ok(Some(directive))
} }
}) })
} else {
Ok(None)
} }
} }

View file

@ -28,7 +28,7 @@ use crate::task::{Context, Poll};
#[must_use = "futures do nothing unless you `.await` or poll them"] #[must_use = "futures do nothing unless you `.await` or poll them"]
#[stable(feature = "futures_api", since = "1.36.0")] #[stable(feature = "futures_api", since = "1.36.0")]
#[lang = "future_trait"] #[lang = "future_trait"]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
label = "`{Self}` is not a future", label = "`{Self}` is not a future",
message = "`{Self}` is not a future", message = "`{Self}` is not a future",
note = "{Self} must be a future or must implement `IntoFuture` to be awaited" note = "{Self} must be a future or must implement `IntoFuture` to be awaited"

View file

@ -217,6 +217,7 @@
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(deprecated_suggestion)] #![feature(deprecated_suggestion)]
#![feature(diagnostic_namespace)]
#![feature(doc_cfg)] #![feature(doc_cfg)]
#![feature(doc_cfg_hide)] #![feature(doc_cfg_hide)]
#![feature(doc_notable_trait)] #![feature(doc_notable_trait)]

View file

@ -75,7 +75,7 @@ macro marker_impls {
/// [ub]: ../../reference/behavior-considered-undefined.html /// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Send")] #[cfg_attr(not(test), rustc_diagnostic_item = "Send")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "`{Self}` cannot be sent between threads safely", message = "`{Self}` cannot be sent between threads safely",
label = "`{Self}` cannot be sent between threads safely" label = "`{Self}` cannot be sent between threads safely"
)] )]
@ -134,7 +134,7 @@ unsafe impl<T: Sync + ?Sized> Send for &T {}
#[doc(alias = "?", alias = "?Sized")] #[doc(alias = "?", alias = "?Sized")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sized"] #[lang = "sized"]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "the size for values of type `{Self}` cannot be known at compilation time", message = "the size for values of type `{Self}` cannot be known at compilation time",
label = "doesn't have a size known at compile-time" label = "doesn't have a size known at compile-time"
)] )]
@ -205,7 +205,7 @@ pub trait Unsize<T: ?Sized> {
/// [RFC1445]: https://github.com/rust-lang/rfcs/blob/master/text/1445-restrict-constants-in-patterns.md /// [RFC1445]: https://github.com/rust-lang/rfcs/blob/master/text/1445-restrict-constants-in-patterns.md
/// [issue 63438]: https://github.com/rust-lang/rust/issues/63438 /// [issue 63438]: https://github.com/rust-lang/rust/issues/63438
#[unstable(feature = "structural_match", issue = "31434")] #[unstable(feature = "structural_match", issue = "31434")]
#[rustc_on_unimplemented(message = "the type `{Self}` does not `#[derive(PartialEq)]`")] #[diagnostic::on_unimplemented(message = "the type `{Self}` does not `#[derive(PartialEq)]`")]
#[lang = "structural_peq"] #[lang = "structural_peq"]
pub trait StructuralPartialEq { pub trait StructuralPartialEq {
// Empty. // Empty.
@ -273,7 +273,7 @@ marker_impls! {
/// of the two derives (`#[derive(PartialEq)]` and `#[derive(Eq)]`) and check /// of the two derives (`#[derive(PartialEq)]` and `#[derive(Eq)]`) and check
/// that both of them are present as part of structural-match checking. /// that both of them are present as part of structural-match checking.
#[unstable(feature = "structural_match", issue = "31434")] #[unstable(feature = "structural_match", issue = "31434")]
#[rustc_on_unimplemented(message = "the type `{Self}` does not `#[derive(Eq)]`")] #[diagnostic::on_unimplemented(message = "the type `{Self}` does not `#[derive(Eq)]`")]
#[lang = "structural_teq"] #[lang = "structural_teq"]
pub trait StructuralEq { pub trait StructuralEq {
// Empty. // Empty.
@ -941,7 +941,7 @@ marker_impls! {
/// [Pin]: crate::pin::Pin /// [Pin]: crate::pin::Pin
/// [`pin` module]: crate::pin /// [`pin` module]: crate::pin
#[stable(feature = "pin", since = "1.33.0")] #[stable(feature = "pin", since = "1.33.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
note = "consider using the `pin!` macro\nconsider using `Box::pin` if you need to access the pinned value outside of the current scope", note = "consider using the `pin!` macro\nconsider using `Box::pin` if you need to access the pinned value outside of the current scope",
message = "`{Self}` cannot be unpinned" message = "`{Self}` cannot be unpinned"
)] )]
@ -989,7 +989,7 @@ pub trait Destruct {}
/// for any user type. /// for any user type.
#[unstable(feature = "tuple_trait", issue = "none")] #[unstable(feature = "tuple_trait", issue = "none")]
#[lang = "tuple_trait"] #[lang = "tuple_trait"]
#[rustc_on_unimplemented(message = "`{Self}` is not a tuple")] #[diagnostic::on_unimplemented(message = "`{Self}` is not a tuple")]
#[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_deny_explicit_impl(implement_via_object = false)]
pub trait Tuple {} pub trait Tuple {}
@ -999,7 +999,7 @@ pub trait Tuple {}
/// `*const ()` automatically implement this trait. /// `*const ()` automatically implement this trait.
#[unstable(feature = "pointer_like_trait", issue = "none")] #[unstable(feature = "pointer_like_trait", issue = "none")]
#[lang = "pointer_like"] #[lang = "pointer_like"]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "`{Self}` needs to have the same ABI as a pointer", message = "`{Self}` needs to have the same ABI as a pointer",
label = "`{Self}` needs to be a pointer-like type" label = "`{Self}` needs to be a pointer-like type"
)] )]
@ -1013,7 +1013,7 @@ pub trait PointerLike {}
/// are `StructuralPartialEq`. /// are `StructuralPartialEq`.
#[lang = "const_param_ty"] #[lang = "const_param_ty"]
#[unstable(feature = "adt_const_params", issue = "95174")] #[unstable(feature = "adt_const_params", issue = "95174")]
#[rustc_on_unimplemented(message = "`{Self}` can't be used as a const parameter type")] #[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
#[allow(multiple_supertrait_upcastable)] #[allow(multiple_supertrait_upcastable)]
pub trait ConstParamTy: StructuralEq + StructuralPartialEq + Eq {} pub trait ConstParamTy: StructuralEq + StructuralPartialEq + Eq {}

View file

@ -307,7 +307,7 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "mul"] #[lang = "mul"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot multiply `{Self}` by `{Rhs}`", message = "cannot multiply `{Self}` by `{Rhs}`",
label = "no implementation for `{Self} * {Rhs}`" label = "no implementation for `{Self} * {Rhs}`"
)] )]
@ -441,7 +441,7 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "div"] #[lang = "div"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot divide `{Self}` by `{Rhs}`", message = "cannot divide `{Self}` by `{Rhs}`",
label = "no implementation for `{Self} / {Rhs}`" label = "no implementation for `{Self} / {Rhs}`"
)] )]
@ -543,7 +543,7 @@ div_impl_float! { f32 f64 }
/// ``` /// ```
#[lang = "rem"] #[lang = "rem"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`", message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`",
label = "no implementation for `{Self} % {Rhs}`" label = "no implementation for `{Self} % {Rhs}`"
)] )]
@ -729,7 +729,7 @@ neg_impl! { isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "add_assign"] #[lang = "add_assign"]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot add-assign `{Rhs}` to `{Self}`", message = "cannot add-assign `{Rhs}` to `{Self}`",
label = "no implementation for `{Self} += {Rhs}`" label = "no implementation for `{Self} += {Rhs}`"
)] )]
@ -796,7 +796,7 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "sub_assign"] #[lang = "sub_assign"]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot subtract-assign `{Rhs}` from `{Self}`", message = "cannot subtract-assign `{Rhs}` from `{Self}`",
label = "no implementation for `{Self} -= {Rhs}`" label = "no implementation for `{Self} -= {Rhs}`"
)] )]
@ -854,7 +854,7 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "mul_assign"] #[lang = "mul_assign"]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot multiply-assign `{Self}` by `{Rhs}`", message = "cannot multiply-assign `{Self}` by `{Rhs}`",
label = "no implementation for `{Self} *= {Rhs}`" label = "no implementation for `{Self} *= {Rhs}`"
)] )]
@ -912,7 +912,7 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "div_assign"] #[lang = "div_assign"]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot divide-assign `{Self}` by `{Rhs}`", message = "cannot divide-assign `{Self}` by `{Rhs}`",
label = "no implementation for `{Self} /= {Rhs}`" label = "no implementation for `{Self} /= {Rhs}`"
)] )]
@ -973,7 +973,7 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ``` /// ```
#[lang = "rem_assign"] #[lang = "rem_assign"]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "cannot calculate and assign the remainder of `{Self}` divided by `{Rhs}`", message = "cannot calculate and assign the remainder of `{Self}` divided by `{Rhs}`",
label = "no implementation for `{Self} %= {Rhs}`" label = "no implementation for `{Self} %= {Rhs}`"
)] )]

View file

@ -137,7 +137,7 @@ impl Not for ! {
#[lang = "bitand"] #[lang = "bitand"]
#[doc(alias = "&")] #[doc(alias = "&")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} & {Rhs}`", message = "no implementation for `{Self} & {Rhs}`",
label = "no implementation for `{Self} & {Rhs}`" label = "no implementation for `{Self} & {Rhs}`"
)] )]
@ -237,7 +237,7 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitor"] #[lang = "bitor"]
#[doc(alias = "|")] #[doc(alias = "|")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} | {Rhs}`", message = "no implementation for `{Self} | {Rhs}`",
label = "no implementation for `{Self} | {Rhs}`" label = "no implementation for `{Self} | {Rhs}`"
)] )]
@ -337,7 +337,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitxor"] #[lang = "bitxor"]
#[doc(alias = "^")] #[doc(alias = "^")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} ^ {Rhs}`", message = "no implementation for `{Self} ^ {Rhs}`",
label = "no implementation for `{Self} ^ {Rhs}`" label = "no implementation for `{Self} ^ {Rhs}`"
)] )]
@ -436,7 +436,7 @@ bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "shl"] #[lang = "shl"]
#[doc(alias = "<<")] #[doc(alias = "<<")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} << {Rhs}`", message = "no implementation for `{Self} << {Rhs}`",
label = "no implementation for `{Self} << {Rhs}`" label = "no implementation for `{Self} << {Rhs}`"
)] )]
@ -554,7 +554,7 @@ shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
#[lang = "shr"] #[lang = "shr"]
#[doc(alias = ">>")] #[doc(alias = ">>")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} >> {Rhs}`", message = "no implementation for `{Self} >> {Rhs}`",
label = "no implementation for `{Self} >> {Rhs}`" label = "no implementation for `{Self} >> {Rhs}`"
)] )]
@ -681,7 +681,7 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
#[lang = "bitand_assign"] #[lang = "bitand_assign"]
#[doc(alias = "&=")] #[doc(alias = "&=")]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} &= {Rhs}`", message = "no implementation for `{Self} &= {Rhs}`",
label = "no implementation for `{Self} &= {Rhs}`" label = "no implementation for `{Self} &= {Rhs}`"
)] )]
@ -752,7 +752,7 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitor_assign"] #[lang = "bitor_assign"]
#[doc(alias = "|=")] #[doc(alias = "|=")]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} |= {Rhs}`", message = "no implementation for `{Self} |= {Rhs}`",
label = "no implementation for `{Self} |= {Rhs}`" label = "no implementation for `{Self} |= {Rhs}`"
)] )]
@ -823,7 +823,7 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitxor_assign"] #[lang = "bitxor_assign"]
#[doc(alias = "^=")] #[doc(alias = "^=")]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} ^= {Rhs}`", message = "no implementation for `{Self} ^= {Rhs}`",
label = "no implementation for `{Self} ^= {Rhs}`" label = "no implementation for `{Self} ^= {Rhs}`"
)] )]
@ -892,7 +892,7 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "shl_assign"] #[lang = "shl_assign"]
#[doc(alias = "<<=")] #[doc(alias = "<<=")]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} <<= {Rhs}`", message = "no implementation for `{Self} <<= {Rhs}`",
label = "no implementation for `{Self} <<= {Rhs}`" label = "no implementation for `{Self} <<= {Rhs}`"
)] )]
@ -974,7 +974,7 @@ shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
#[lang = "shr_assign"] #[lang = "shr_assign"]
#[doc(alias = ">>=")] #[doc(alias = ">>=")]
#[stable(feature = "op_assign_traits", since = "1.8.0")] #[stable(feature = "op_assign_traits", since = "1.8.0")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "no implementation for `{Self} >>= {Rhs}`", message = "no implementation for `{Self} >>= {Rhs}`",
label = "no implementation for `{Self} >>= {Rhs}`" label = "no implementation for `{Self} >>= {Rhs}`"
)] )]

View file

@ -47,7 +47,7 @@
/// assert_eq!(nucleotide_count[Nucleotide::T], 12); /// assert_eq!(nucleotide_count[Nucleotide::T], 12);
/// ``` /// ```
#[lang = "index"] #[lang = "index"]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "the type `{Self}` cannot be indexed by `{Idx}`", message = "the type `{Self}` cannot be indexed by `{Idx}`",
label = "`{Self}` cannot be indexed by `{Idx}`" label = "`{Self}` cannot be indexed by `{Idx}`"
)] )]

View file

@ -83,7 +83,7 @@ use crate::task::{Context, Poll};
/// implemented for any closed over variables passed to `catch_unwind`. /// implemented for any closed over variables passed to `catch_unwind`.
#[stable(feature = "catch_unwind", since = "1.9.0")] #[stable(feature = "catch_unwind", since = "1.9.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "unwind_safe_trait")] #[cfg_attr(not(test), rustc_diagnostic_item = "unwind_safe_trait")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "the type `{Self}` may not be safely transferred across an unwind boundary", message = "the type `{Self}` may not be safely transferred across an unwind boundary",
label = "`{Self}` may not be safely transferred across an unwind boundary" label = "`{Self}` may not be safely transferred across an unwind boundary"
)] )]
@ -99,7 +99,7 @@ pub auto trait UnwindSafe {}
/// [`UnwindSafe`] trait, for more information see that documentation. /// [`UnwindSafe`] trait, for more information see that documentation.
#[stable(feature = "catch_unwind", since = "1.9.0")] #[stable(feature = "catch_unwind", since = "1.9.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "ref_unwind_safe_trait")] #[cfg_attr(not(test), rustc_diagnostic_item = "ref_unwind_safe_trait")]
#[rustc_on_unimplemented( #[diagnostic::on_unimplemented(
message = "the type `{Self}` may contain interior mutability and a reference may not be safely \ message = "the type `{Self}` may contain interior mutability and a reference may not be safely \
transferrable across a catch_unwind boundary", transferrable across a catch_unwind boundary",
label = "`{Self}` may contain interior mutability and a reference may not be safely \ label = "`{Self}` may contain interior mutability and a reference may not be safely \

View file

@ -1,3 +1,6 @@
// FIXME(fmease, #119216): Reenable this test!
// ignore-test
pub struct Inner<T> { pub struct Inner<T> {
field: T, field: T,
} }

View file

@ -0,0 +1,8 @@
#![feature(diagnostic_namespace)]
#[diagnostic::on_unimplemented(
message = "Message",
note = "Note",
label = "label"
)]
pub trait Foo {}

View file

@ -0,0 +1,12 @@
// aux-build:other.rs
extern crate other;
use other::Foo;
fn take_foo(_: impl Foo) {}
fn main() {
take_foo(());
//~^ERROR Message
}

View file

@ -0,0 +1,19 @@
error[E0277]: Message
--> $DIR/error_is_shown_in_downstream_crates.rs:10:14
|
LL | take_foo(());
| -------- ^^ label
| |
| required by a bound introduced by this call
|
= help: the trait `Foo` is not implemented for `()`
= note: Note
note: required by a bound in `take_foo`
--> $DIR/error_is_shown_in_downstream_crates.rs:7:21
|
LL | fn take_foo(_: impl Foo) {}
| ^^^ required by this bound in `take_foo`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.

View file

@ -50,6 +50,9 @@ crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt:
crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it") crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it")
crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site") crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy") crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include") crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include")

View file

@ -73,6 +73,9 @@ crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt:
crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer") crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer")
crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #3, kind: Macro(Bang, "inner") crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #3, kind: Macro(Bang, "inner")
crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "print_bang") crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "print_bang")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "diagnostic::on_unimplemented")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive") crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include") crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include")