@@ -7,7 +7,7 @@ use rustc::mir::{
7
7
use rustc:: mir:: { Terminator , TerminatorKind } ;
8
8
use rustc:: ty:: { self , Const , DefIdTree , Ty , TyS , TyCtxt } ;
9
9
use rustc_data_structures:: indexed_vec:: Idx ;
10
- use syntax_pos:: Span ;
10
+ use syntax_pos:: { Span , CompilerDesugaringKind } ;
11
11
use syntax_pos:: symbol:: kw;
12
12
13
13
use crate :: dataflow:: move_paths:: InitLocation ;
@@ -41,14 +41,16 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
41
41
) ;
42
42
43
43
let mut err;
44
- let mut item_msg;
45
44
let reason;
46
45
let access_place_desc = self . describe_place ( access_place) ;
47
46
debug ! ( "report_mutability_error: access_place_desc={:?}" , access_place_desc) ;
48
47
49
- item_msg = match & access_place_desc {
50
- Some ( desc) => format ! ( "`{}`" , desc) ,
51
- None => "temporary place" . to_string ( ) ,
48
+ let mut item_msg = match ( & access_place_desc, & the_place_err) {
49
+ ( Some ( desc) , _) => format ! ( "`{}`" , desc) ,
50
+ ( None , Place :: Base ( PlaceBase :: Local ( local) ) ) if self . mir . local_decls [ * local]
51
+ . source_info . span . is_compiler_desugaring ( CompilerDesugaringKind :: Async )
52
+ => "async `fn` parameter" . to_string ( ) ,
53
+ ( None , _) => "temporary place" . to_string ( ) ,
52
54
} ;
53
55
match the_place_err {
54
56
Place :: Base ( PlaceBase :: Local ( local) ) => {
0 commit comments