You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![feature(associated_types)]traitFactory{typeProduct;fncreate(&self) -> <SelfasFactory>::Product;}implFactoryforf64{typeProduct = f64;fncreate(&self) -> f64{*self**self}}impl<A:Factory,B:Factory>Factoryfor(A,B){typeProduct = (<AasFactory>::Product, <BasFactory>::Product);// line 14fncreate(&self) -> (<AasFactory>::Product, <BasFactory>::Product){let(ref a,ref b) = *self;(a.create(), b.create())}}fnmain(){println!("{}",(4.0f64,5.0f64).create());// ^ should print (16, 25)}
Failed to compile with error:
1.rs:14:20: 14:70 error: illegal recursive type; insert an enum or struct in the cycle, if this is desired
1.rs:14 type Product = (<A as Factory>::Product, <B as Factory>::Product);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~