-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive types in a Vec<T>
with generic parameters gives ambiguous error
#110466
Comments
This should compile right? There is indirection because @rustbot claim EDIT: rustbot doesn't like me lol |
This is not a bug. Simpler example:
It's easy to replace inner
|
I'm not entirely sure about the correctness of your reduction. |
@zirconium-n I think that'll delegate to someone more experienced than me for the final say on this: |
Rollup merge of rust-lang#127871 - compiler-errors:recursive, r=estebank Mention that type parameters are used recursively on bivariance error Right now when a type parameter is used recursively, even with indirection (so it has a finite size) we say that the type parameter is unused: ``` struct B<T>(Box<B<T>>); ``` This is confusing, because the type parameter is *used*, it just doesn't have its variance constrained. This PR tweaks that message to mention that it must be used *non-recursively*. Not sure if we should actually mention "variance" here, but also I'd somewhat prefer we don't keep the power users in the dark w.r.t the real underlying issue, which is that the variance isn't constrained. That technical detail is reserved for a note, though. cc `@fee1-dead` Fixes rust-lang#118976 Fixes rust-lang#26283 Fixes rust-lang#53191 Fixes rust-lang#105740 Fixes rust-lang#110466
I tried this code:
I expected to see this happen:
OR actually compiling.
Instead, this happened: not compiling
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: