Closed
Description
I tried this code:
struct Foo<T> { v: Vec<Bar<T>> }
struct Bar<T> { f: Foo<T> }
I expected to see this happen:
error[[E0072]](https://doc.rust-lang.org/stable/error_codes/E0072.html): recursive types `Foo` and `Bar` have infinite size
--> src/lib.rs:1:1
|
1 | struct Foo<T> { v: Bar<T> }
| ^^^^^^^^^^^^^ ------ recursive without indirection
2 | struct Bar<T> { f: Foo<T> }
| ^^^^^^^^^^^^^ ------ recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
OR actually compiling.
Instead, this happened: not compiling
error[E0392]: parameter `T` is never used
--> src/main.rs:2:12
|
2 | struct Foo<T> { v: Vec<Bar<T>> }
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: usize` instead
error[E0392]: parameter `T` is never used
--> src/main.rs:3:12
|
3 | struct Bar<T> { f: Foo<T> }
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `T` to be a const parameter, use `const T: usize` instead
For more information about this error, try `rustc --explain E0392`.
Meta
rustc --version --verbose
:
rustc 1.70.0-nightly (db0cbc48d 2023-03-26)
binary: rustc
commit-hash: db0cbc48d4aaa300713a95d9b317a365a474490c
commit-date: 2023-03-26
host: x86_64-pc-windows-msvc
release: 1.70.0-nightly
LLVM version: 16.0.0