This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
compiler/rustc_ty_utils/src Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
240240 continue ;
241241 }
242242
243+ if !self . seen . insert ( assoc. def_id . expect_local ( ) ) {
244+ return ;
245+ }
246+
243247 let impl_args = alias_ty. args . rebase_onto (
244248 self . tcx ,
245249 impl_trait_ref. def_id ,
Original file line number Diff line number Diff line change 1+ trait Foo {
2+ type Bar ;
3+ fn foo ( self ) -> Self :: Bar ;
4+ }
5+
6+ impl Foo for Box < dyn Foo > {
7+ //~^ ERROR: the value of the associated type `Bar` in `Foo` must be specified
8+ type Bar = <Self as Foo >:: Bar ;
9+ fn foo ( self ) -> <Self as Foo >:: Bar {
10+ ( * self ) . foo ( )
11+ }
12+ }
13+
14+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
2+ --> $DIR/associated-type-cycle.rs:6:22
3+ |
4+ LL | type Bar;
5+ | -------- `Bar` defined here
6+ ...
7+ LL | impl Foo for Box<dyn Foo> {
8+ | ^^^ help: specify the associated type: `Foo<Bar = Type>`
9+
10+ error: aborting due to 1 previous error
11+
12+ For more information about this error, try `rustc --explain E0191`.
You can’t perform that action at this time.
0 commit comments