@@ -1985,16 +1985,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19851985 let ( place_desc, note) = if let Some ( place_desc) = opt_place_desc {
19861986 let local_kind = if let Some ( local) = borrow. borrowed_place . as_local ( ) {
19871987 match self . body . local_kind ( local) {
1988- LocalKind :: ReturnPointer | LocalKind :: Temp => {
1989- bug ! ( "temporary or return pointer with a name" )
1988+ LocalKind :: Temp if self . body . local_decls [ local ] . is_user_variable ( ) => {
1989+ "local variable "
19901990 }
1991- LocalKind :: Var => "local variable " ,
19921991 LocalKind :: Arg
19931992 if !self . upvars . is_empty ( ) && local == ty:: CAPTURE_STRUCT_LOCAL =>
19941993 {
19951994 "variable captured by `move` "
19961995 }
19971996 LocalKind :: Arg => "function parameter " ,
1997+ LocalKind :: ReturnPointer | LocalKind :: Temp => {
1998+ bug ! ( "temporary or return pointer with a name" )
1999+ }
19982000 }
19992001 } else {
20002002 "local data "
@@ -2008,16 +2010,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20082010 self . prefixes ( borrow. borrowed_place . as_ref ( ) , PrefixSet :: All ) . last ( ) . unwrap ( ) ;
20092011 let local = root_place. local ;
20102012 match self . body . local_kind ( local) {
2011- LocalKind :: ReturnPointer | LocalKind :: Temp => {
2012- ( "temporary value" . to_string ( ) , "temporary value created here" . to_string ( ) )
2013- }
20142013 LocalKind :: Arg => (
20152014 "function parameter" . to_string ( ) ,
20162015 "function parameter borrowed here" . to_string ( ) ,
20172016 ) ,
2018- LocalKind :: Var => {
2017+ LocalKind :: Temp if self . body . local_decls [ local ] . is_user_variable ( ) => {
20192018 ( "local binding" . to_string ( ) , "local binding introduced here" . to_string ( ) )
20202019 }
2020+ LocalKind :: ReturnPointer | LocalKind :: Temp => {
2021+ ( "temporary value" . to_string ( ) , "temporary value created here" . to_string ( ) )
2022+ }
20212023 }
20222024 } ;
20232025
0 commit comments