1
Fork 0

run borrowck tests on BIDs and emit tail-expr-drop-order lints for

potential violations
This commit is contained in:
Ding Xiang Fei 2024-12-05 02:58:59 +08:00 committed by Michael Goulet
parent 6afee111c2
commit 045271cccc
6 changed files with 155 additions and 17 deletions

View file

@ -1131,15 +1131,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Schedule emission of a backwards incompatible drop lint hint.
/// Applicable only to temporary values for now.
#[instrument(level = "debug", skip(self))]
pub(crate) fn schedule_backwards_incompatible_drop(
&mut self,
span: Span,
region_scope: region::Scope,
local: Local,
) {
if !self.local_decls[local].ty.has_significant_drop(self.tcx, self.typing_env()) {
return;
}
// Note that we are *not* gating BIDs here on whether they have significant destructor.
// We need to know all of them so that we can capture potential borrow-checking errors.
for scope in self.scopes.scopes.iter_mut().rev() {
// Since we are inserting linting MIR statement, we have to invalidate the caches
scope.invalidate_cache();