#![feature(or_patterns)]
#![feature(rustc_private)]
#![feature(stmt_expr_attributes)]
+#![feature(control_flow_enum)]
#![recursion_limit = "512"]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![allow(clippy::missing_docs_in_private_items, clippy::must_use_candidate)]
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::{BytePos, Span};
use std::convert::TryFrom;
+use std::ops::ControlFlow;
macro_rules! unwrap_or_continue {
($x:expr) => {
self.possible_borrower.add(borrowed.local, lhs);
},
other => {
- if !ContainsRegion.visit_ty(place.ty(&self.body.local_decls, self.cx.tcx).ty) {
+ if ContainsRegion.visit_ty(place.ty(&self.body.local_decls, self.cx.tcx).ty) == ControlFlow::CONTINUE {
return;
}
rvalue_locals(other, |rhs| {
// If the call returns something with lifetimes,
// let's conservatively assume the returned value contains lifetime of all the arguments.
// For example, given `let y: Foo<'a> = foo(x)`, `y` is considered to be a possible borrower of `x`.
- if !ContainsRegion.visit_ty(&self.body.local_decls[*dest].ty) {
+ if ContainsRegion.visit_ty(&self.body.local_decls[*dest].ty) == ControlFlow::CONTINUE {
return;
}
struct ContainsRegion;
impl TypeVisitor<'_> for ContainsRegion {
- fn visit_region(&mut self, _: ty::Region<'_>) -> bool {
- true
+ fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<(), ()> {
+ ControlFlow::BREAK
}
}