-
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.
fix(suggestion): insert projection to associated types
- Loading branch information
Showing
5 changed files
with
89 additions
and
29 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,26 @@ | ||
pub trait TraitE { | ||
type I3; | ||
} | ||
|
||
pub trait TraitD { | ||
type I3; | ||
} | ||
|
||
pub trait TraitC { | ||
type I1; | ||
type I2; | ||
} | ||
|
||
pub trait TraitB { | ||
type Item; | ||
} | ||
|
||
pub trait TraitA<G1, G2, G3> { | ||
fn baz< | ||
U: TraitC<I1 = G1, I2 = G2> + TraitD<I3 = G3> + TraitE, | ||
V: TraitD<I3 = G1> | ||
>(_: U, _: V) -> Self | ||
where | ||
U: TraitB, | ||
<U as TraitB>::Item: Copy; | ||
} |
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,12 @@ | ||
// aux-build:extern-issue-98562.rs | ||
|
||
extern crate extern_issue_98562; | ||
use extern_issue_98562::TraitA; | ||
|
||
struct X; | ||
impl TraitA<u8, u16, u32> for X { | ||
//~^ ERROR not all trait items implemented | ||
} | ||
//~^ HELP implement the missing item: `fn baz<U: TraitC<I1 = u8, I2 = u16> + TraitD<I3 = u32>, V: TraitD<I3 = u8>>(_: U, _: V) -> Self where U: TraitE, U: TraitB, <U as TraitB>::Item: Copy { todo!() }` | ||
|
||
fn main() {} |
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,11 @@ | ||
error[E0046]: not all trait items implemented, missing: `baz` | ||
--> $DIR/issue-98562.rs:7:1 | ||
| | ||
LL | impl TraitA<u8, u16, u32> for X { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `baz` in implementation | ||
| | ||
= help: implement the missing item: `fn baz<U: TraitC<I1 = u8, I2 = u16> + TraitD<I3 = u32>, V: TraitD<I3 = u8>>(_: U, _: V) -> Self where U: TraitE, U: TraitB, <U as TraitB>::Item: Copy { todo!() }` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0046`. |
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