-
Notifications
You must be signed in to change notification settings - Fork 13.4k
stricter hidden type wf-check [based on #115008] #121679
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
93bc7a4
wf-check RPITs
lcnr 71d82c2
when defining opaques, require the hidden type to be well-formed
lcnr 6591c80
use typeck root when checking closure oblig
lcnr 300cffa
yeet now unnecessary special-case
lcnr af0d508
update comments
lcnr 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 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 |
---|---|---|
@@ -1,21 +1,34 @@ | ||
error: unconstrained opaque type | ||
--> $DIR/issue-86800.rs:31:34 | ||
--> $DIR/issue-86800.rs:25:34 | ||
| | ||
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
error: internal compiler error[E0792]: expected generic lifetime parameter, found `'_` | ||
--> $DIR/issue-86800.rs:39:5 | ||
= note: `TransactionFuture` must be used in combination with a concrete type within the same module | ||
|
||
error[E0792]: expected generic lifetime parameter, found `'_` | ||
--> $DIR/issue-86800.rs:34:5 | ||
| | ||
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>; | ||
| --- this generic parameter must be used with a generic lifetime parameter | ||
... | ||
LL | f | ||
| ^ | ||
|
||
error: the compiler unexpectedly panicked. this is a bug. | ||
error[E0792]: expected generic lifetime parameter, found `'_` | ||
--> $DIR/issue-86800.rs:42:5 | ||
| | ||
LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>; | ||
| --- this generic parameter must be used with a generic lifetime parameter | ||
... | ||
LL | / { | ||
LL | | | ||
LL | | let mut conn = Connection {}; | ||
LL | | let mut transaction = TestTransaction { conn: &mut conn }; | ||
LL | | f(&mut transaction).await | ||
LL | | } | ||
| |_____^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
query stack during panic: | ||
#0 [mir_borrowck] borrow-checking `execute_transaction_fut` | ||
#1 [type_of_opaque] computing type of opaque `execute_transaction_fut::{opaque#0}` | ||
end of query stack | ||
For more information about this error, try `rustc --explain E0792`. |
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 |
---|---|---|
@@ -1,20 +1,14 @@ | ||
error[E0491]: in type `&'b &'a ()`, reference has a longer lifetime than the data it references | ||
--> $DIR/wf-check-hidden-type.rs:13:22 | ||
error: lifetime may not live long enough | ||
--> $DIR/wf-check-hidden-type.rs:14:5 | ||
| | ||
LL | fn boom<'a, 'b>() -> impl Extend<'a, 'b> { | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| -- -- lifetime `'b` defined here | ||
| | | ||
| lifetime `'a` defined here | ||
LL | None::<&'_ &'_ ()> | ||
| ^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | ||
| | ||
note: the pointer is valid for the lifetime `'b` as defined here | ||
--> $DIR/wf-check-hidden-type.rs:13:13 | ||
| | ||
LL | fn boom<'a, 'b>() -> impl Extend<'a, 'b> { | ||
| ^^ | ||
note: but the referenced data is only valid for the lifetime `'a` as defined here | ||
--> $DIR/wf-check-hidden-type.rs:13:9 | ||
| | ||
LL | fn boom<'a, 'b>() -> impl Extend<'a, 'b> { | ||
| ^^ | ||
= help: consider adding the following bound: `'a: 'b` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0491`. |
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
2 changes: 1 addition & 1 deletion
2
tests/ui/traits/next-solver/normalize-async-closure-in-trait.rs
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
//@ compile-flags: -Znext-solver | ||
//@ check-pass | ||
//@ known-bug: unknown | ||
//@ edition:2021 | ||
|
||
trait Foo { | ||
|
15 changes: 15 additions & 0 deletions
15
tests/ui/traits/next-solver/normalize-async-closure-in-trait.stderr
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,15 @@ | ||
error[E0271]: type mismatch resolving `impl Future<Output = ()> == {async fn body@$DIR/normalize-async-closure-in-trait.rs:6:20: 6:22}` | ||
--> $DIR/normalize-async-closure-in-trait.rs:6:20 | ||
| | ||
LL | async fn bar() {} | ||
| ^^ types differ | ||
|
||
error[E0271]: type mismatch resolving `{async fn body@$DIR/normalize-async-closure-in-trait.rs:6:20: 6:22} <: impl Future<Output = ()>` | ||
--> $DIR/normalize-async-closure-in-trait.rs:6:20 | ||
| | ||
LL | async fn bar() {} | ||
| ^^ types differ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0271`. |
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
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.
Uh oh!
There was an error while loading. Please reload this page.