diff options
| author | Michael Goulet <michael@errs.io> | 2025-08-04 16:24:41 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-08-04 16:35:58 +0000 |
| commit | c7ea022166d2b6d55c3f69bbf69a31b0d7b053e2 (patch) | |
| tree | 1ff6f1889d61e209d6dc0ffa38906e08db87e5eb /compiler | |
| parent | e1b9081e699065badfc1a9419ec9566e5c8615c4 (diff) | |
| download | rust-c7ea022166d2b6d55c3f69bbf69a31b0d7b053e2.tar.gz rust-c7ea022166d2b6d55c3f69bbf69a31b0d7b053e2.zip | |
Enforce tail call type is related to body return type in borrowck
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index f5fedbf95c1..91973f33bd3 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -845,9 +845,13 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { ); } - if let TerminatorKind::Call { destination, target, .. } = term.kind { - self.check_call_dest(term, &sig, destination, target, term_location); - } + let (destination, target) = + if let TerminatorKind::Call { destination, target, .. } = term.kind { + (destination, target) + } else { + (RETURN_PLACE.into(), Some(BasicBlock::ZERO)) + }; + self.check_call_dest(term, &sig, destination, target, term_location); // The ordinary liveness rules will ensure that all // regions in the type of the callee are live here. We |
