@@ -18,6 +18,7 @@ use rustc_mir::dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, Re
18
18
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
19
19
use rustc_span:: source_map:: { BytePos , Span } ;
20
20
use std:: convert:: TryFrom ;
21
+ use std:: ops:: ControlFlow ;
21
22
22
23
macro_rules! unwrap_or_continue {
23
24
( $x: expr) => {
@@ -517,7 +518,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
517
518
self . possible_borrower . add ( borrowed. local , lhs) ;
518
519
} ,
519
520
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 {
521
522
return ;
522
523
}
523
524
rvalue_locals ( other, |rhs| {
@@ -539,7 +540,7 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
539
540
// If the call returns something with lifetimes,
540
541
// let's conservatively assume the returned value contains lifetime of all the arguments.
541
542
// 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 {
543
544
return ;
544
545
}
545
546
@@ -558,8 +559,8 @@ impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'tcx> {
558
559
struct ContainsRegion ;
559
560
560
561
impl 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
563
564
}
564
565
}
565
566
0 commit comments