-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Do leak check after function pointer coercion #97206
Merged
Merged
Changes from all commits
Commits
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
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
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
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
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
31 changes: 3 additions & 28 deletions
31
src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr
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 |
---|---|---|
@@ -1,37 +1,12 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/placeholder-pattern-fail.rs:9:12 | ||
--> $DIR/placeholder-pattern-fail.rs:9:47 | ||
| | ||
LL | let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| ^^^ one type is more general than the other | ||
| | ||
= note: expected fn pointer `for<'a, 'b> fn(Inv<'a>, Inv<'b>)` | ||
found fn pointer `for<'a> fn(Inv<'a>, Inv<'a>)` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/placeholder-pattern-fail.rs:9:12 | ||
| | ||
LL | let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected fn pointer `for<'a, 'b> fn(Inv<'a>, Inv<'b>)` | ||
found fn pointer `for<'a> fn(Inv<'a>, Inv<'a>)` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/placeholder-pattern-fail.rs:14:13 | ||
| | ||
LL | fn simple1<'c>(x: (&'c i32,)) { | ||
| -- lifetime `'c` defined here | ||
LL | let _x: (&'static i32,) = x; | ||
| ^^^^^^^^^^^^^^^ type annotation requires that `'c` must outlive `'static` | ||
|
||
error: lifetime may not live long enough | ||
--> $DIR/placeholder-pattern-fail.rs:19:12 | ||
| | ||
LL | fn simple2<'c>(x: (&'c i32,)) { | ||
| -- lifetime `'c` defined here | ||
LL | let _: (&'static i32,) = x; | ||
| ^^^^^^^^^^^^^^^ type annotation requires that `'c` must outlive `'static` | ||
|
||
error: aborting due to 4 previous errors | ||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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
5 changes: 4 additions & 1 deletion
5
...t/ui/lub-glb/old-lub-glb-hr-noteq1.stderr → ...glb/old-lub-glb-hr-noteq1.baseleak.stderr
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
21 changes: 21 additions & 0 deletions
21
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr
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,21 @@ | ||
error[E0308]: `match` arms have incompatible types | ||
--> $DIR/old-lub-glb-hr-noteq1.rs:17:14 | ||
| | ||
LL | let z = match 22 { | ||
| _____________- | ||
LL | | 0 => x, | ||
| | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` | ||
LL | | _ => y, | ||
| | ^ one type is more general than the other | ||
LL | | | ||
... | | ||
LL | | | ||
LL | | }; | ||
| |_____- `match` arms have incompatible types | ||
| | ||
= note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` | ||
found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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.
I will admit that I have no idea if this should be
false
ortrue
.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.
The name is not very good. It only affects diagnostics. I think the idea is that you say true if the "placeholders" result from the "actual type" and false if they come from the expected type.
In this instance, B is the expected type, I think, and the placeholders would come from B, so I guess that makes false the proper value. (i.e., the value you are supplying is insufficiently polymorphic to be cast to the type required).