Prevent dependency cycle with -Zthir-unsafeck#87492
Closed
FabianWolff wants to merge 1 commit intorust-lang:masterfrom
Closed
Prevent dependency cycle with -Zthir-unsafeck#87492FabianWolff wants to merge 1 commit intorust-lang:masterfrom
-Zthir-unsafeck#87492FabianWolff wants to merge 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
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 PRI 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 |
Collaborator
Contributor
Author
|
Good point; this should be fixed now (I've also expanded the test case with your example). @rustbot ready |
Collaborator
This comment has been minimized.
This comment has been minimized.
Contributor
|
Sorry if I explained badly, I was wondering if using |
Contributor
Author
|
Superseded by #87645. |
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Aug 3, 2021
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`
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Aug 3, 2021
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``
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Aug 3, 2021
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```
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #87414.
r? @LeSeulArtichaut