illegal recursive type
check is excessively strict on associated types
#17744
Labels
A-type-system
Area: Type system
As far as I can tell, the purpose of the "illegal recursive type" error (in src/librustc/middle/typeck/astconv.rs) is to prevent types from referring to themselves in their definition, e.g. as done in src/test/compile-fail/infinite-vec-type-recursion.rs (
type x = Vec<x>;
).However, the logic being used to implement this check also disallows the following usage of associated types, which is intended to provide an implementation of the trait
R
onVec<T>
ifT
itself implementsR
(doing so by passing throughT
's associated typeassoc
):It seems like this code should be accepted (though
type assoc=<Vec<T> as R>::assoc;
should still fail this check).The text was updated successfully, but these errors were encountered: