forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#119817 - compiler-errors:normalize-opaques, r=lcnr Remove special-casing around `AliasKind::Opaque` when structurally resolving in new solver This fixes a few inconsistencies around where we don't eagerly resolve opaques to their (locally-defined) hidden types in the new solver. It essentially allows this code to work: ```rust fn main() { type Tait = impl Sized; struct S { i: i32, } let x: Tait = S { i: 0 }; println!("{}", x.i); } ``` Since `Tait` is defined in `main`, we are able to poke through the type of `x` with deref. r? lcnr
- Loading branch information
Showing
19 changed files
with
158 additions
and
96 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
error[E0391]: cycle detected when type-checking `foo` | ||
--> $DIR/clone-rpit.rs:12:1 | ||
| | ||
LL | pub fn foo<'a, 'b>() -> impl Clone { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: ...which requires coroutine witness types for `foo::{closure#0}`... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
note: ...which requires promoting constants in MIR for `foo::{closure#0}`... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
note: ...which requires preparing `foo::{closure#0}` for borrow checking... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
note: ...which requires checking if `foo::{closure#0}` contains FFI-unwind calls... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
note: ...which requires building MIR for `foo::{closure#0}`... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
note: ...which requires match-checking `foo::{closure#0}`... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
note: ...which requires type-checking `foo::{closure#0}`... | ||
--> $DIR/clone-rpit.rs:13:5 | ||
| | ||
LL | move |_: ()| { | ||
| ^^^^^^^^^^^^ | ||
= note: ...which again requires type-checking `foo`, completing the cycle | ||
note: cycle used when computing type of opaque `foo::{opaque#0}` | ||
--> $DIR/clone-rpit.rs:12:25 | ||
| | ||
LL | pub fn foo<'a, 'b>() -> impl Clone { | ||
| ^^^^^^^^^^ | ||
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0391`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// check-pass | ||
// compile-flags: -Znext-solver | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() { | ||
type Tait = impl Sized; | ||
struct S { | ||
i: i32, | ||
} | ||
let x: Tait = S { i: 0 }; | ||
println!("{}", x.i); | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/ui/impl-trait/recursive-coroutine-indirect.current.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
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
16 changes: 2 additions & 14 deletions
16
tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.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,21 +1,9 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:34 | ||
| | ||
LL | fn produce() -> impl !Fn<(u32,)> {} | ||
| ---------------- ^^ types differ | ||
| | | ||
| the expected opaque type | ||
| | ||
= note: expected opaque type `impl !Fn<(u32,)>` | ||
found unit type `()` | ||
|
||
error[E0271]: type mismatch resolving `() == impl !Fn<(u32,)>` | ||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17 | ||
| | ||
LL | fn produce() -> impl !Fn<(u32,)> {} | ||
| ^^^^^^^^^^^^^^^^ types differ | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to 1 previous error | ||
|
||
Some errors have detailed explanations: E0271, E0308. | ||
For more information about an error, try `rustc --explain E0271`. | ||
For more information about this error, try `rustc --explain E0271`. |
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
Oops, something went wrong.