@@ -17,7 +17,7 @@ use rustc::ty;
1717use syntax:: ast;
1818use syntax_pos;
1919use errors:: DiagnosticBuilder ;
20- use rustc :: hir :: map :: PatternSource ;
20+ use borrowck :: gather_loans :: gather_moves :: PatternSource ;
2121
2222pub struct MoveErrorCollector < ' tcx > {
2323 errors : Vec < MoveError < ' tcx > >
@@ -41,12 +41,12 @@ impl<'tcx> MoveErrorCollector<'tcx> {
4141
4242pub struct MoveError < ' tcx > {
4343 move_from : mc:: cmt < ' tcx > ,
44- move_to : Option < MoveSpanAndPath < ' tcx > >
44+ move_to : Option < MovePlace < ' tcx > >
4545}
4646
4747impl < ' tcx > MoveError < ' tcx > {
4848 pub fn with_move_info ( move_from : mc:: cmt < ' tcx > ,
49- move_to : Option < MoveSpanAndPath < ' tcx > > )
49+ move_to : Option < MovePlace < ' tcx > > )
5050 -> MoveError < ' tcx > {
5151 MoveError {
5252 move_from : move_from,
@@ -56,27 +56,27 @@ impl<'tcx> MoveError<'tcx> {
5656}
5757
5858#[ derive( Clone ) ]
59- pub struct MoveSpanAndPath < ' tcx > {
59+ pub struct MovePlace < ' tcx > {
6060 pub span : syntax_pos:: Span ,
6161 pub name : ast:: Name ,
6262 pub pat_source : PatternSource < ' tcx > ,
6363}
6464
6565pub struct GroupedMoveErrors < ' tcx > {
6666 move_from : mc:: cmt < ' tcx > ,
67- move_to_places : Vec < MoveSpanAndPath < ' tcx > >
67+ move_to_places : Vec < MovePlace < ' tcx > >
6868}
6969
7070fn report_move_errors < ' a , ' tcx > ( bccx : & BorrowckCtxt < ' a , ' tcx > , errors : & Vec < MoveError < ' tcx > > ) {
7171 let grouped_errors = group_errors_with_same_origin ( errors) ;
7272 for error in & grouped_errors {
7373 let mut err = report_cannot_move_out_of ( bccx, error. move_from . clone ( ) ) ;
7474 let mut is_first_note = true ;
75-
76- if let Some ( pattern_source ) = error . move_to_places . get ( 0 ) {
77-
78- match pattern_source . pat_source {
79- PatternSource :: LetDecl ( _ ) => { }
75+ match error . move_to_places . get ( 0 ) {
76+ Some ( & MovePlace { pat_source : PatternSource :: LetDecl ( _ ) , .. } ) => {
77+ // ignore patterns that are found at the top-level of a `let`;
78+ // see `get_pattern_source()` for details
79+ }
8080 _ => {
8181 for move_to in & error. move_to_places {
8282
@@ -85,14 +85,14 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &Vec<Move
8585 }
8686 }
8787 }
88- }
8988 if let NoteClosureEnv ( upvar_id) = error. move_from . note {
90- err. span_label ( bccx. tcx . hir . span ( upvar_id. var_id ) , & "captured outer variable" ) ;
89+ err. span_label ( bccx. tcx . hir . span ( upvar_id. var_id ) ,
90+ & "captured outer variable" ) ;
9191 }
9292 err. emit ( ) ;
93-
94- }
93+
9594 }
95+ }
9696
9797fn group_errors_with_same_origin < ' tcx > ( errors : & Vec < MoveError < ' tcx > > )
9898 -> Vec < GroupedMoveErrors < ' tcx > > {
0 commit comments