Closed
Description
// If the inner `Foo` is named through an associated type, the "infinite size" error does not occur.
struct Foo(<&'static Foo as ::core::ops::Deref>::Target);
// But Rust will be unable to know whether `Foo` is sized or not,
// and it will infinitely recurse somewhere trying to figure out the size of this pointer (is my guess):
const _: *const Foo = 0 as _;
This happens on 1.0.0
, stable
, and nightly
(haven't checked the others).
Error
On older toolchains, it succintly says:
thread
rustc
has overflowed its stack
On newer ones, it yields:
/opt/compiler-explorer/rust-nightly/bin/../lib/librustc_driver-82e4545cc4765a53.so(+0x519703)[0x7f215aa83703]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x143c0)[0x7f215a1ca3c0]
/opt/compiler-explorer/rust-nightly/bin/../lib/librustc_driver-82e4545cc4765a53.so(_RNvXNtNtNtCslVMVSX5WZa3_21rustc_trait_selection6traits5query19evaluate_obligationNtNtCskKqV9GDjbtg_11rustc_infer5infer9InferCtxtNtB2_12InferCtxtExt34predicate_must_hold_modulo_regions+0x26)[0x7f215c91e606]
/opt/compiler-explorer/rust-nightly/bin/../lib/librustc_driver-82e4545cc4765a53.so(_RNvNtCslVMVSX5WZa3_21rustc_trait_selection6traits39type_known_to_meet_bound_modulo_regions+0x122)[0x7f215c980332]
/opt/compiler-explorer/rust-nightly/bin/../lib/librustc_driver-82e4545cc4765a53.so(+0x2939da2)[0x7f215cea3da2]
/opt/compiler-explorer/rust-nightly/bin/../lib/librustc_driver-82e4545cc4765a53.so(+0x2939e5a)[0x7f215cea3e5a]
…
/opt/compiler-explorer/rust-nightly/bin/../lib/librustc_driver-82e4545cc4765a53.so(+0x2939e5a)[0x7f215cea3e5a]
Metadata
Metadata
Assignees
Labels
Area: Code generationCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.