1 // Regression test for #54779, checks if the diagnostics are confusing.
5 trait DebugWith
<Cx
: ?Sized
> {
6 fn debug_with
<'me
>(&'me
self, cx
: &'me Cx
) -> DebugCxPair
<'me
, Self, Cx
> {
7 DebugCxPair { value: self, cx }
10 fn fmt_with(&self, cx
: &Cx
, fmt
: &mut std
::fmt
::Formatter
<'_
>) -> std
::fmt
::Result
;
13 struct DebugCxPair
<'me
, Value
: ?Sized
, Cx
: ?Sized
>
27 impl DebugWith
<dyn DebugContext
> for Foo
{
30 cx
: &dyn DebugContext
,
31 fmt
: &mut std
::fmt
::Formatter
<'_
>,
32 ) -> std
::fmt
::Result
{
33 let Foo { bar }
= self;
34 bar
.debug_with(cx
); //~ ERROR: lifetime may not live long enough
41 impl DebugWith
<dyn DebugContext
> for Bar
{
44 cx
: &dyn DebugContext
,
45 fmt
: &mut std
::fmt
::Formatter
<'_
>,
46 ) -> std
::fmt
::Result
{