Test that names of variables in external macros are not shown on a borrow error

This commit is contained in:
Jana Dönszelmann 2025-05-02 13:26:35 +02:00
parent f97b3c6044
commit 867b4c9e48
No known key found for this signature in database
4 changed files with 65 additions and 0 deletions

View file

@ -317,6 +317,14 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
opt: DescribePlaceOpt,
) -> Option<String> {
let local = place.local;
if self.body.local_decls[local]
.source_info
.span
.in_external_macro(self.infcx.tcx.sess.source_map())
{
return None;
}
let mut autoderef_index = None;
let mut buf = String::new();
let mut ok = self.append_local_to_string(local, &mut buf);