-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)Area: auto traits (e.g., `auto trait Send {}`)A-trait-systemArea: Trait systemArea: Trait systemD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
fn is_send<T: Send>(_: T) {}
fn foo() -> impl Sized {
is_send(bar());
1
}
fn bar() -> impl Sized {
is_send(foo());
2
}
results in a query cycle. We stash this query cycle and overwrite it with a nicer diagnostic:
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> src/lib.rs:8:13
|
8 | is_send(foo());
| ------- ^^^^^
| |
| required by a bound introduced by this call
|
= note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
note: opaque type is declared here
--> src/lib.rs:3:13
|
3 | fn foo() -> impl Sized {
| ^^^^^^^^^^
note: required by a bound in `is_send`
--> src/lib.rs:2:15
|
2 | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
This diagnostic has 2 issues:
fetching the hidden types of an opaque inside of the defining scope
We're never doing that. There are two typeck
queries involved in the cycle. Talking about "in the defining scope" isn't right, it should be "fetching the hidden types of opaque types depends on type inference of its defining scopes"
You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
This part of the diagnostic was relevant for TAIT but doesn't help for RPIT(IT) and with explicit define_opaque
attributes. We should remove it
compiler-errors
Metadata
Metadata
Assignees
Labels
A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)Area: auto traits (e.g., `auto trait Send {}`)A-trait-systemArea: Trait systemArea: Trait systemD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.