forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not allow typeck children items to constrain outer RPITs
- Loading branch information
1 parent
8bd12e8
commit e8d9f38
Showing
5 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::fmt::Display; | ||
|
||
fn main() { | ||
test("hi", true); | ||
} | ||
|
||
fn test<T: Display>(t: T, recurse: bool) -> impl Display { | ||
let f = || { | ||
let i: u32 = test::<i32>(-1, false); | ||
//~^ ERROR mismatched types | ||
println!("{i}"); | ||
}; | ||
if recurse { | ||
f(); | ||
} | ||
t | ||
} |
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,15 @@ | ||
error[E0308]: mismatched types | ||
--> $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 | ||
| | ||
= note: expected opaque type `impl std::fmt::Display` | ||
found type `u32` | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn main() { | ||
let _ = fix(|_: &dyn Fn()| {}); | ||
} | ||
|
||
fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() { | ||
move || f(fix(&f)) | ||
//~^ ERROR mismatched types | ||
} |
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,14 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-99073.rs:6:13 | ||
| | ||
LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() { | ||
| --------- the expected opaque type | ||
LL | move || f(fix(&f)) | ||
| ^^^^^^^^^^ types differ | ||
| | ||
= note: expected opaque type `impl Fn()` | ||
found type parameter `G` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |