From 6a6132d79bee8baf89ea0896ec6dadc3ad6b388b Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 10 Nov 2024 13:08:49 -0800 Subject: [PATCH] Extend no-display ui test to cover another fmt trait --- tests/ui/no-display.rs | 6 ++++++ tests/ui/no-display.stderr | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/tests/ui/no-display.rs b/tests/ui/no-display.rs index 181a66e0..d804e005 100644 --- a/tests/ui/no-display.rs +++ b/tests/ui/no-display.rs @@ -9,4 +9,10 @@ pub struct Error { thread: NoDisplay, } +#[derive(Error, Debug)] +#[error("thread: {thread:o}")] +pub struct ErrorOctal { + thread: NoDisplay, +} + fn main() {} diff --git a/tests/ui/no-display.stderr b/tests/ui/no-display.stderr index 88d00926..a60c0d35 100644 --- a/tests/ui/no-display.stderr +++ b/tests/ui/no-display.stderr @@ -18,3 +18,29 @@ note: the trait `std::fmt::Display` must be implemented = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `as_display`, perhaps you need to implement it: candidate #1: `AsDisplay` + +error[E0277]: the trait bound `NoDisplay: Octal` is not satisfied + --> tests/ui/no-display.rs:13:9 + | +12 | #[derive(Error, Debug)] + | ----- in this derive macro expansion +13 | #[error("thread: {thread:o}")] + | ^^^^^^^^^^^^^^^^^^^^ the trait `Octal` is not implemented for `NoDisplay` + | + = help: the following other types implement trait `Octal`: + &T + &mut T + NonZero + Saturating + Var<'a, T> + Wrapping + i128 + i16 + and $N others + = note: required for `Var<'_, NoDisplay>` to implement `Octal` +note: required by a bound in `core::fmt::rt::Argument::<'_>::new_octal` + --> $RUST/core/src/fmt/rt.rs + | + | pub fn new_octal(x: &T) -> Argument<'_> { + | ^^^^^ required by this bound in `Argument::<'_>::new_octal` + = note: this error originates in the macro `$crate::format_args` which comes from the expansion of the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)