-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent dependency cycle with -Zthir-unsafeck
#87492
Conversation
AFAICT this PR introduces a correctness hole: unsafe fn unsf() {}
fn bad<T>() -> Box<dyn Iterator<Item = [(); { unsafe { || { unsf() } }; 4 }]>> { todo!() }
// ^^^^^^ shouldn't error, but does with this PR I think the issue in #87414 is rather that the closure tries to run unsafeck for
This works for closures in functions but apparently misbehaves in constants. The proper fix is probably changing this to use enclosing_body_owner .
@rustbot author |
Good point; this should be fixed now (I've also expanded the test case with your example). @rustbot ready |
This comment has been minimized.
This comment has been minimized.
Sorry if I explained badly, I was wondering if using |
Superseded by #87645. |
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`
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``
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```
Fixes #87414.
r? @LeSeulArtichaut