blob: 54d50346cc83113238d3f25c22365912d3effae8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// #98842 stack overflow in trait inference
// issue: rust-lang/rust#98842
//@ check-fail
//@ edition:2021
//@ stderr-per-bitwidth
//@ ignore-endian-big
//~^^^^^^ ERROR cycle detected when computing layout of `Foo`
// 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 _;
//~^ ERROR it is undefined behavior to use this value
pub fn main() {}
|