@@ -66,13 +66,20 @@ enum InvalidationCause {
66
66
67
67
impl Invalidation {
68
68
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 {
70
77
format ! (
71
78
"{:?} was later invalidated at offsets {:?} by a {}" ,
72
79
self . tag, self . range, self . cause
73
- ) ,
74
- self . span . data ( ) ,
75
- )
80
+ )
81
+ } ;
82
+ ( message , self . span . data ( ) )
76
83
}
77
84
}
78
85
@@ -82,7 +89,7 @@ impl fmt::Display for InvalidationCause {
82
89
InvalidationCause :: Access ( kind) => write ! ( f, "{}" , kind) ,
83
90
InvalidationCause :: Retag ( perm, kind) =>
84
91
if * kind == RetagCause :: FnEntry {
85
- write ! ( f, "{:?} FnEntry retag inside this call " , perm)
92
+ write ! ( f, "{:?} FnEntry retag" , perm)
86
93
} else {
87
94
write ! ( f, "{:?} retag" , perm)
88
95
} ,
0 commit comments