Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/lower.rs')
-rw-r--r--crates/hir-ty/src/mir/lower.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 28d26c6c8a..1572a6d497 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -25,7 +25,7 @@ use triomphe::Arc;
use crate::{
consteval::ConstEvalError,
- db::HirDatabase,
+ db::{HirDatabase, InternedClosure},
display::HirDisplay,
infer::{CaptureKind, CapturedItem, TypeMismatch},
inhabitedness::is_ty_uninhabited_from,
@@ -126,6 +126,10 @@ impl DropScopeToken {
}
}
+impl Drop for DropScopeToken {
+ fn drop(&mut self) {}
+}
+
// Uncomment this to make `DropScopeToken` a drop bomb. Unfortunately we can't do this in release, since
// in cases that mir lowering fails, we don't handle (and don't need to handle) drop scopes so it will be
// actually reached. `pop_drop_scope_assert_finished` will also detect this case, but doesn't show useful
@@ -1630,7 +1634,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
self.set_goto(prev_block, begin, span);
f(self, begin)?;
let my = mem::replace(&mut self.current_loop_blocks, prev).ok_or(
- MirLowerError::ImplementationError("current_loop_blocks is corrupt".to_string()),
+ MirLowerError::ImplementationError("current_loop_blocks is corrupt".to_owned()),
)?;
if let Some(prev) = prev_label {
self.labeled_loop_blocks.insert(label.unwrap(), prev);
@@ -1665,7 +1669,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
.current_loop_blocks
.as_mut()
.ok_or(MirLowerError::ImplementationError(
- "Current loop access out of loop".to_string(),
+ "Current loop access out of loop".to_owned(),
))?
.end
{
@@ -1675,7 +1679,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
self.current_loop_blocks
.as_mut()
.ok_or(MirLowerError::ImplementationError(
- "Current loop access out of loop".to_string(),
+ "Current loop access out of loop".to_owned(),
))?
.end = Some(s);
s
@@ -1973,7 +1977,7 @@ pub fn mir_body_for_closure_query(
db: &dyn HirDatabase,
closure: ClosureId,
) -> Result<Arc<MirBody>> {
- let (owner, expr) = db.lookup_intern_closure(closure.into());
+ let InternedClosure(owner, expr) = db.lookup_intern_closure(closure.into());
let body = db.body(owner);
let infer = db.infer(owner);
let Expr::Closure { args, body: root, .. } = &body[expr] else {