2024-03-22 18:06:46 +00:00
|
|
|
// #98842 stack overflow in trait inference
|
2024-03-22 18:21:50 +00:00
|
|
|
// issue: rust-lang/rust#98842
|
2024-03-22 18:06:46 +00:00
|
|
|
//@ check-fail
|
|
|
|
//@ edition:2021
|
2024-03-22 18:21:50 +00:00
|
|
|
//@ stderr-per-bitwidth
|
2024-07-02 13:28:16 +00:00
|
|
|
//~^^^^^ ERROR cycle detected when computing layout of `Foo`
|
2024-03-22 18:06:46 +00:00
|
|
|
|
|
|
|
// 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 _;
|
2024-06-22 14:26:30 +00:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
2024-03-22 18:06:46 +00:00
|
|
|
|
|
|
|
pub fn main() {}
|