@@ -720,20 +720,33 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
720
720
//NOTE(@jroesch): mixed RefCell borrow causes crash
721
721
let adj = infcx. adjustments ( ) . get ( & expr. id ) . map ( |x| x. clone ( ) ) ;
722
722
if let Some ( adjustment) = adj {
723
- match adjustment {
724
- adjustment:: AdjustNeverToAny ( .. ) |
725
- adjustment:: AdjustReifyFnPointer |
726
- adjustment:: AdjustUnsafeFnPointer |
727
- adjustment:: AdjustMutToConstPointer => {
723
+ match adjustment. kind {
724
+ adjustment:: Adjust :: NeverToAny |
725
+ adjustment:: Adjust :: ReifyFnPointer |
726
+ adjustment:: Adjust :: UnsafeFnPointer |
727
+ adjustment:: Adjust :: MutToConstPointer => {
728
728
// Creating a closure/fn-pointer or unsizing consumes
729
729
// the input and stores it into the resulting rvalue.
730
730
debug ! ( "walk_adjustment: trivial adjustment" ) ;
731
731
let cmt_unadjusted =
732
732
return_if_err ! ( self . mc. cat_expr_unadjusted( expr) ) ;
733
733
self . delegate_consume ( expr. id , expr. span , cmt_unadjusted) ;
734
734
}
735
- adjustment:: AdjustDerefRef ( ref adj) => {
736
- self . walk_autoderefref ( expr, adj) ;
735
+ adjustment:: Adjust :: DerefRef { autoderefs, autoref, unsize } => {
736
+ debug ! ( "walk_adjustment expr={:?} adj={:?}" , expr, adjustment) ;
737
+
738
+ self . walk_autoderefs ( expr, autoderefs) ;
739
+
740
+ let cmt_derefd =
741
+ return_if_err ! ( self . mc. cat_expr_autoderefd( expr, autoderefs) ) ;
742
+
743
+ let cmt_refd =
744
+ self . walk_autoref ( expr, cmt_derefd, autoref) ;
745
+
746
+ if unsize {
747
+ // Unsizing consumes the thin pointer and produces a fat one.
748
+ self . delegate_consume ( expr. id , expr. span , cmt_refd) ;
749
+ }
737
750
}
738
751
}
739
752
}
@@ -770,28 +783,6 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
770
783
}
771
784
}
772
785
773
- fn walk_autoderefref ( & mut self ,
774
- expr : & hir:: Expr ,
775
- adj : & adjustment:: AutoDerefRef < ' tcx > ) {
776
- debug ! ( "walk_autoderefref expr={:?} adj={:?}" ,
777
- expr,
778
- adj) ;
779
-
780
- self . walk_autoderefs ( expr, adj. autoderefs ) ;
781
-
782
- let cmt_derefd =
783
- return_if_err ! ( self . mc. cat_expr_autoderefd( expr, adj. autoderefs) ) ;
784
-
785
- let cmt_refd =
786
- self . walk_autoref ( expr, cmt_derefd, adj. autoref ) ;
787
-
788
- if adj. unsize . is_some ( ) {
789
- // Unsizing consumes the thin pointer and produces a fat one.
790
- self . delegate_consume ( expr. id , expr. span , cmt_refd) ;
791
- }
792
- }
793
-
794
-
795
786
/// Walks the autoref `opt_autoref` applied to the autoderef'd
796
787
/// `expr`. `cmt_derefd` is the mem-categorized form of `expr`
797
788
/// after all relevant autoderefs have occurred. Because AutoRefs
@@ -803,7 +794,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
803
794
fn walk_autoref ( & mut self ,
804
795
expr : & hir:: Expr ,
805
796
cmt_base : mc:: cmt < ' tcx > ,
806
- opt_autoref : Option < adjustment:: AutoRef < ' tcx > > )
797
+ opt_autoref : Option < adjustment:: AutoBorrow < ' tcx > > )
807
798
-> mc:: cmt < ' tcx >
808
799
{
809
800
debug ! ( "walk_autoref(expr.id={} cmt_derefd={:?} opt_autoref={:?})" ,
@@ -822,7 +813,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
822
813
} ;
823
814
824
815
match * autoref {
825
- adjustment:: AutoPtr ( r, m) => {
816
+ adjustment:: AutoBorrow :: Ref ( r, m) => {
826
817
self . delegate . borrow ( expr. id ,
827
818
expr. span ,
828
819
cmt_base,
@@ -831,7 +822,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
831
822
AutoRef ) ;
832
823
}
833
824
834
- adjustment:: AutoUnsafe ( m) => {
825
+ adjustment:: AutoBorrow :: RawPtr ( m) => {
835
826
debug ! ( "walk_autoref: expr.id={} cmt_base={:?}" ,
836
827
expr. id,
837
828
cmt_base) ;
0 commit comments