From 12804230a25d4f996f4738de20c161d95df4933b Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Fri, 30 Jul 2021 19:04:16 +0200 Subject: [PATCH] Properly find owner of closure in THIR unsafeck Co-authored-by: FabianWolff --- compiler/rustc_mir_build/src/check_unsafety.rs | 11 ++++------- src/test/ui/unsafe/issue-87414-query-cycle.rs | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 src/test/ui/unsafe/issue-87414-query-cycle.rs diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 21534290d1291..d27ce6ec81a90 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -599,13 +599,10 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam() -> Box> { todo!() } + +fn foo() -> [(); { |x: u32| { x }; 4 }] { todo!() } +fn bar() { let _: [(); { |x: u32| { x }; 4 }]; } + +// This one should not cause any errors either: +unsafe fn unsf() {} +fn bad2() -> Box> { todo!() } + +fn main() {}