This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ trait Trait { }
2
+
3
+ struct Chars ;
4
+ impl Trait for Chars { }
5
+
6
+ struct FlatMap < T > ( T ) ;
7
+ impl < T : Trait > std:: fmt:: Debug for FlatMap < T > {
8
+ fn fmt ( & self , _: & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
9
+ unimplemented ! ( )
10
+ }
11
+ }
12
+
13
+ fn lol ( ) {
14
+ format_args ! ( "{:?}" , FlatMap ( & Chars ) ) ;
15
+ //~^ ERROR the trait bound `&Chars: Trait` is not satisfied [E0277]
16
+ }
17
+
18
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0277]: the trait bound `&Chars: Trait` is not satisfied
2
+ --> $DIR/suggest-remove-deref-issue-140166.rs:14:26
3
+ |
4
+ LL | format_args!("{:?}", FlatMap(&Chars));
5
+ | ---- ^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `&Chars`
6
+ | |
7
+ | required by a bound introduced by this call
8
+ |
9
+ note: required for `FlatMap<&Chars>` to implement `Debug`
10
+ --> $DIR/suggest-remove-deref-issue-140166.rs:7:16
11
+ |
12
+ LL | impl<T: Trait> std::fmt::Debug for FlatMap<T> {
13
+ | ----- ^^^^^^^^^^^^^^^ ^^^^^^^^^^
14
+ | |
15
+ | unsatisfied trait bound introduced here
16
+ note: required by a bound in `core::fmt::rt::Argument::<'_>::new_debug`
17
+ --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
18
+ help: consider removing the leading `&`-reference
19
+ |
20
+ LL - format_args!("{:?}", FlatMap(&Chars));
21
+ LL + format_args!("{:?}", latMap(&Chars));
22
+ |
23
+
24
+ error: aborting due to 1 previous error
25
+
26
+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments