Description
I tried this code(reduced):
//...
trait Trait {
type AssTrait;
}
//...
struct St<'a, T: Trait> {
_var1: Box<&'a T>,
_var2: Box<St<'a, T::AssTrait>>,
}
fn main() {
//...
}
When attempting to compile the provided code, the program hangs indefinitely, resulting in a non-responsive state. This issue occurs when using associated types in structs with trait bounds.
😃I expected to see this happen: The code should compile successfully or produce a clear error message indicating the cause of the issue.
😥Instead, this happened: The compilation process hangs indefinitely, and the program does not execute.
Meta
rustc --version --verbose
:
rustc 1.72.0 (5680fa18f 2023-08-23)
binary: rustc
commit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be
commit-date: 2023-08-23
host: x86_64-unknown-linux-gnu
release: 1.72.0
LLVM version: 16.0.5
We have attempted to use the BACKTRACE=1
command to obtain a backtrace for debugging purposes😢, but no output is generated. It is worth mentioning that the provided code snippet causes a hang issue on both the latest stable and nightly(nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.74.0-nightly (59a8294 2023-08-30)) versions of Rust.
What‘s more,when we change _var2: Box<St<'a, T::AssTrait>>
to _var2: Box<St<'a, T>>
, the program will produce the correct output
Backtrace
<backtrace>