-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #122366 - oli-obk:opaques_defined_by_overflow, r=lcnr Fix stack overflow with recursive associated types fixes #122364
- Loading branch information
Showing
3 changed files
with
30 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,14 @@ | ||
trait Foo { | ||
type Bar; | ||
fn foo(self) -> Self::Bar; | ||
} | ||
|
||
impl Foo for Box<dyn Foo> { | ||
//~^ ERROR: the value of the associated type `Bar` in `Foo` must be specified | ||
type Bar = <Self as Foo>::Bar; | ||
fn foo(self) -> <Self as Foo>::Bar { | ||
(*self).foo() | ||
} | ||
} | ||
|
||
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,12 @@ | ||
error[E0191]: the value of the associated type `Bar` in `Foo` must be specified | ||
--> $DIR/associated-type-cycle.rs:6:22 | ||
| | ||
LL | type Bar; | ||
| -------- `Bar` defined here | ||
... | ||
LL | impl Foo for Box<dyn Foo> { | ||
| ^^^ help: specify the associated type: `Foo<Bar = Type>` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0191`. |