-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that RPITs constrained by a recursive call in a closure are com…
…patible
- Loading branch information
1 parent
90939e6
commit 5e8f1e8
Showing
5 changed files
with
139 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
error[E0308]: mismatched types | ||
error: concrete type differs from previous defining opaque type use | ||
--> $DIR/issue-99073-2.rs:9:22 | ||
| | ||
LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display { | ||
| ------------ the expected opaque type | ||
LL | let f = || { | ||
LL | let i: u32 = test::<i32>(-1, false); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ types differ | ||
| ^^^^^^^^^^^^^^^^^^^^^^ expected `T`, got `u32` | ||
| | ||
= note: expected opaque type `impl std::fmt::Display` | ||
found type `u32` | ||
note: previous use here | ||
--> $DIR/issue-99073-2.rs:16:5 | ||
| | ||
LL | t | ||
| ^ | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
fn main() { | ||
let _ = fix(|_: &dyn Fn()| {}); | ||
let _ = fix(|_: &dyn Fn()| {}); | ||
} | ||
|
||
fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() { | ||
move || f(fix(&f)) | ||
//~^ ERROR mismatched types | ||
move || f(fix(&f)) | ||
//~^ ERROR concrete type differs from previous defining opaque type use | ||
} |
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,14 +1,14 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-99073.rs:6:13 | ||
error: concrete type differs from previous defining opaque type use | ||
--> $DIR/issue-99073.rs:6:11 | ||
| | ||
LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() { | ||
| --------- the expected opaque type | ||
LL | move || f(fix(&f)) | ||
| ^^^^^^^^^^ types differ | ||
LL | move || f(fix(&f)) | ||
| ^^^^^^^^^^ expected `[closure@$DIR/issue-99073.rs:6:3: 6:10]`, got `G` | ||
| | ||
= note: expected opaque type `impl Fn()` | ||
found type parameter `G` | ||
note: previous use here | ||
--> $DIR/issue-99073.rs:6:3 | ||
| | ||
LL | move || f(fix(&f)) | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |