Skip to content

Commit 6a6132d

Browse files
committed
Extend no-display ui test to cover another fmt trait
1 parent a061beb commit 6a6132d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/ui/no-display.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ pub struct Error {
99
thread: NoDisplay,
1010
}
1111

12+
#[derive(Error, Debug)]
13+
#[error("thread: {thread:o}")]
14+
pub struct ErrorOctal {
15+
thread: NoDisplay,
16+
}
17+
1218
fn main() {}

tests/ui/no-display.stderr

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,29 @@ note: the trait `std::fmt::Display` must be implemented
1818
= help: items from traits can only be used if the trait is implemented and in scope
1919
= note: the following trait defines an item `as_display`, perhaps you need to implement it:
2020
candidate #1: `AsDisplay`
21+
22+
error[E0277]: the trait bound `NoDisplay: Octal` is not satisfied
23+
--> tests/ui/no-display.rs:13:9
24+
|
25+
12 | #[derive(Error, Debug)]
26+
| ----- in this derive macro expansion
27+
13 | #[error("thread: {thread:o}")]
28+
| ^^^^^^^^^^^^^^^^^^^^ the trait `Octal` is not implemented for `NoDisplay`
29+
|
30+
= help: the following other types implement trait `Octal`:
31+
&T
32+
&mut T
33+
NonZero<T>
34+
Saturating<T>
35+
Var<'a, T>
36+
Wrapping<T>
37+
i128
38+
i16
39+
and $N others
40+
= note: required for `Var<'_, NoDisplay>` to implement `Octal`
41+
note: required by a bound in `core::fmt::rt::Argument::<'_>::new_octal`
42+
--> $RUST/core/src/fmt/rt.rs
43+
|
44+
| pub fn new_octal<T: Octal>(x: &T) -> Argument<'_> {
45+
| ^^^^^ required by this bound in `Argument::<'_>::new_octal`
46+
= 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)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy