-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Do not propogate unnecessary closure constraints. #148329
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
Open
LorrensP-2158466
wants to merge
10
commits into
rust-lang:main
Choose a base branch
from
LorrensP-2158466:closure-prop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+171
−55
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8c66aab
Do not propogate unnecessary closure constraints + tests.
LorrensP-2158466 a36dc08
correct filtering of regions + update comment
LorrensP-2158466 a2e305d
address review: add explanation for tests
LorrensP-2158466 477a820
fix typo in test explanation
LorrensP-2158466 b7f5bca
propagate region error for every non-local lower bound
LorrensP-2158466 3071a81
test case2
LorrensP-2158466 967e963
bless test about post dominating lower bounds
LorrensP-2158466 44fcd46
add explanation to postdom test
LorrensP-2158466 d1674cb
oops
LorrensP-2158466 402f3e0
address review: improve documentation of impl
LorrensP-2158466 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| //@ check-pass | ||
| // This checks that the compiler does not require that 'a: 'b. '_ has 'a and 'b as non-local | ||
| // upper bounds, but the compiler should not propagate 'a: 'b OR 'b: 'a when checking | ||
| // the closures. If it did, this would fail to compile, eventhough it's a valid program. | ||
| // PR #148329 explains this in detail. | ||
|
|
||
| struct MyTy<'x, 'a, 'b>(std::cell::Cell<(&'x &'a u8, &'x &'b u8)>); | ||
| fn wf<T>(_: T) {} | ||
| fn test<'a, 'b>() { | ||
| |_: &'a u8, x: MyTy<'_, 'a, 'b>| wf(x); | ||
| |x: MyTy<'_, 'a, 'b>, _: &'a u8| wf(x); | ||
| } | ||
|
|
||
| fn main(){} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| //@ check-pass | ||
| // FIXME: add explanation. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👀 |
||
|
|
||
| struct MyTy<'a, 'b, 'x>(std::cell::Cell<(&'a &'x str, &'b &'x str)>); | ||
| fn wf<T>(_: T) {} | ||
| fn test<'a, 'b, 'x>() { | ||
| |x: MyTy<'a, 'b, '_>| wf(x); | ||
| } | ||
|
|
||
| fn main() {} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| //@ check-pass | ||
| // This test checks that the compiler does not propagate 'd: 'c when propagating region errors | ||
| // for the closure argument. If it did, this would fail to compile, eventhough it's a valid program. | ||
| // It should only propagate 'd: 'b. | ||
| // PR #148329 explains this in detail. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mean the stabilization report, or the new comments in |
||
|
|
||
| #[derive(Clone, Copy)] | ||
| struct Inv<'a>(*mut &'a ()); | ||
| impl<'a> Inv<'a> { | ||
| fn outlived_by<'b: 'a>(self, _: Inv<'b>) {} | ||
| } | ||
| struct OutlivedBy<'a, 'b: 'a>(Inv<'a>, Inv<'b>); | ||
|
|
||
| fn closure_arg<'b, 'c, 'd>( | ||
| _: impl for<'a> FnOnce(Inv<'a>, OutlivedBy<'a, 'b>, OutlivedBy<'a, 'c>, Inv<'d>), | ||
| ) { | ||
| } | ||
| fn foo<'b, 'c, 'd: 'b>() { | ||
| closure_arg::<'b, 'c, 'd>(|a, b, c, d| { | ||
| a.outlived_by(b.1); | ||
| a.outlived_by(c.1); | ||
| b.1.outlived_by(d); | ||
| }); | ||
| } | ||
|
|
||
| fn main() {} | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add an assert that
propagated_constraintsis not empty before theforhere?