@@ -1565,38 +1565,70 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
1565
1565
error_reported = true ;
1566
1566
1567
1567
let mut err_info = None ;
1568
+
1568
1569
match * place_err {
1569
- Place :: Projection ( ref proj ) => {
1570
- match proj . elem {
1571
- ProjectionElem :: Deref => {
1572
- match proj . base {
1573
- Place :: Local ( local ) => {
1574
- let locations = self . mir . find_assignments ( local) ;
1575
- if locations . len ( ) > 0 {
1576
- let item_msg = if error_reported {
1577
- match self . specialized_description ( & proj . base ) {
1578
- Some ( msg ) => msg ,
1579
- None => self . get_main_error_message ( place )
1580
- }
1581
- } else {
1582
- self . get_main_error_message ( place )
1583
- } ;
1584
- err_info = Some ( (
1585
- self . mir . source_info ( locations [ 0 ] ) . span ,
1586
- "consider changing this to be a \
1587
- mutable reference: `&mut`" , item_msg ,
1588
- "cannot assign through `&`-reference" ) ) ;
1589
- }
1570
+
1571
+ Place :: Projection ( box Projection {
1572
+ ref base , elem : ProjectionElem :: Deref } ) => {
1573
+
1574
+ match * base {
1575
+ Place :: Local ( local) => {
1576
+ let locations = self . mir . find_assignments ( local ) ;
1577
+ if locations . len ( ) > 0 {
1578
+ let item_msg = if error_reported {
1579
+ match self . specialized_description ( base ) {
1580
+ Some ( msg ) => msg ,
1581
+ None => self . get_main_error_message ( place )
1582
+ }
1583
+ } else {
1584
+ self . get_main_error_message ( place )
1585
+ } ;
1586
+ err_info = Some ( (
1587
+ self . mir . source_info ( locations [ 0 ] ) . span ,
1588
+ "consider changing this to be a \
1589
+ mutable reference: `&mut`" , item_msg ,
1590
+ "cannot assign through `&`-reference" ) ) ;
1590
1591
}
1591
- _ => { } ,
1592
- }
1593
- }
1594
- _ => { }
1592
+ } ,
1593
+ _ => { } ,
1595
1594
}
1596
- }
1597
- _ => { }
1595
+ } ,
1596
+ _ => { } ,
1598
1597
}
1599
1598
1599
+
1600
+ // match *place_err {
1601
+ // Place::Projection(ref proj) => {
1602
+ // match proj.elem {
1603
+ // ProjectionElem::Deref => {
1604
+ // match proj.base {
1605
+ // Place::Local(local) => {
1606
+ // let locations = self.mir.find_assignments(local);
1607
+ // if locations.len() > 0 {
1608
+ // let item_msg = if error_reported {
1609
+ // match self.specialized_description(base){
1610
+ // Some(msg) => msg,
1611
+ // None => self.get_main_error_message(place)
1612
+ // }
1613
+ // } else {
1614
+ // self.get_main_error_message(place)
1615
+ // };
1616
+ // err_info = Some((
1617
+ // self.mir.source_info(locations[0]).span,
1618
+ // "consider changing this to be a \
1619
+ // mutable reference: `&mut`", item_msg,
1620
+ // "cannot assign through `&`-reference"));
1621
+ // }
1622
+ // }
1623
+ // _ => {},
1624
+ // }
1625
+ // }
1626
+ // _ => {}
1627
+ // }
1628
+ // }
1629
+ // _ => {}
1630
+ // }
1631
+
1600
1632
if let Some ( ( err_help_span, err_help_stmt, item_msg, sec_span) ) = err_info {
1601
1633
let mut err = self . tcx . cannot_assign ( span, & item_msg, Origin :: Mir , true ) ;
1602
1634
err. span_suggestion ( err_help_span, err_help_stmt, format ! ( "" ) ) ;
0 commit comments