1 // Regression test for #54779, checks if the diagnostics are confusing.
3 trait DebugWith<Cx: ?Sized> {
4 fn debug_with<'me>(&'me self, cx: &'me Cx) -> DebugCxPair<'me, Self, Cx> {
5 DebugCxPair { value: self, cx }
8 fn fmt_with(&self, cx: &Cx, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result;
11 struct DebugCxPair<'me, Value: ?Sized, Cx: ?Sized>
25 impl DebugWith<dyn DebugContext> for Foo {
28 cx: &dyn DebugContext,
29 fmt: &mut std::fmt::Formatter<'_>,
30 ) -> std::fmt::Result {
31 let Foo { bar } = self;
32 bar.debug_with(cx); //~ ERROR: lifetime may not live long enough
39 impl DebugWith<dyn DebugContext> for Bar {
42 cx: &dyn DebugContext,
43 fmt: &mut std::fmt::Formatter<'_>,
44 ) -> std::fmt::Result {