@@ -66,13 +66,20 @@ enum InvalidationCause {
6666
6767impl Invalidation {
6868 fn generate_diagnostic ( & self ) -> ( String , SpanData ) {
69- (
69+ let message = if let InvalidationCause :: Retag ( _, RetagCause :: FnEntry ) = self . cause {
70+ // For a FnEntry retag, our Span points at the caller.
71+ // See `DiagnosticCx::log_invalidation`.
72+ format ! (
73+ "{:?} was later invalidated at offsets {:?} by a {} inside this call" ,
74+ self . tag, self . range, self . cause
75+ )
76+ } else {
7077 format ! (
7178 "{:?} was later invalidated at offsets {:?} by a {}" ,
7279 self . tag, self . range, self . cause
73- ) ,
74- self . span . data ( ) ,
75- )
80+ )
81+ } ;
82+ ( message , self . span . data ( ) )
7683 }
7784}
7885
@@ -82,7 +89,7 @@ impl fmt::Display for InvalidationCause {
8289 InvalidationCause :: Access ( kind) => write ! ( f, "{}" , kind) ,
8390 InvalidationCause :: Retag ( perm, kind) =>
8491 if * kind == RetagCause :: FnEntry {
85- write ! ( f, "{:?} FnEntry retag inside this call " , perm)
92+ write ! ( f, "{:?} FnEntry retag" , perm)
8693 } else {
8794 write ! ( f, "{:?} retag" , perm)
8895 } ,
0 commit comments