@@ -18,6 +18,7 @@ use rustc_mir::dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, Re
1818use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
1919use rustc_span:: source_map:: { BytePos , Span } ;
2020use std:: convert:: TryFrom ;
21+ use std:: ops:: ControlFlow ;
2122
2223macro_rules! unwrap_or_continue {
2324 ( $x: expr) => {
@@ -517,7 +518,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
517518 self . possible_borrower . add ( borrowed. local , lhs) ;
518519 } ,
519520 other => {
520- if ! ContainsRegion . visit_ty ( place. ty ( & self . body . local_decls , self . cx . tcx ) . ty ) {
521+ if ContainsRegion . visit_ty ( place. ty ( & self . body . local_decls , self . cx . tcx ) . ty ) == ControlFlow :: CONTINUE {
521522 return ;
522523 }
523524 rvalue_locals ( other, |rhs| {
@@ -539,7 +540,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
539540 // If the call returns something with lifetimes,
540541 // let's conservatively assume the returned value contains lifetime of all the arguments.
541542 // For example, given `let y: Foo<'a> = foo(x)`, `y` is considered to be a possible borrower of `x`.
542- if ! ContainsRegion . visit_ty ( & self . body . local_decls [ * dest] . ty ) {
543+ if ContainsRegion . visit_ty ( & self . body . local_decls [ * dest] . ty ) == ControlFlow :: CONTINUE {
543544 return ;
544545 }
545546
@@ -558,8 +559,8 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
558559struct ContainsRegion ;
559560
560561impl TypeVisitor < ' _ > for ContainsRegion {
561- fn visit_region ( & mut self , _: ty:: Region < ' _ > ) -> bool {
562- true
562+ fn visit_region ( & mut self , _: ty:: Region < ' _ > ) -> ControlFlow < ( ) , ( ) > {
563+ ControlFlow :: BREAK
563564 }
564565}
565566
0 commit comments