forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#87645 - LeSeulArtichaut:issue-87414, r=oli-obk
Properly find owner of closure in THIR unsafeck Previously, when encountering a closure in a constant, the THIR unsafeck gets invoked on the owner of the constant instead of the constant itself, producing cycles. Supersedes rust-lang#87492. `@FabianWolff` thanks for your work on that PR, I copied your test file and added you as a co-author. Fixes rust-lang#87414. r? `@oli-obk`
- Loading branch information
Showing
2 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Regression test for #87414. | ||
|
||
// check-pass | ||
// compile-flags: -Zthir-unsafeck | ||
|
||
fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { 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<T>() -> Box<dyn Iterator<Item = [(); { unsafe { || { unsf() } }; 4 }]>> { todo!() } | ||
|
||
fn main() {} |