From e13e1e4c0c3253d25e2571ed7e58b3a02e28e922 Mon Sep 17 00:00:00 2001 From: Adwin White Date: Tue, 12 Aug 2025 17:13:13 +0800 Subject: fix(debuginfo): handle false positives in overflow check --- tests/debuginfo/recursive-struct.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/debuginfo/recursive-struct.rs') diff --git a/tests/debuginfo/recursive-struct.rs b/tests/debuginfo/recursive-struct.rs index 5be90992848..427a7100a4f 100644 --- a/tests/debuginfo/recursive-struct.rs +++ b/tests/debuginfo/recursive-struct.rs @@ -62,6 +62,7 @@ use self::Opt::{Empty, Val}; use std::boxed::Box as B; +use std::marker::PhantomData; enum Opt { Empty, @@ -98,6 +99,11 @@ struct LongCycleWithAnonymousTypes { value: usize, } +struct Expanding { + a: PhantomData, + b: *const Expanding<(T, T)>, +} + // This test case makes sure that recursive structs are properly described. The Node structs are // generic so that we can have a new type (that newly needs to be described) for the different // cases. The potential problem with recursive types is that the DI generation algorithm gets @@ -205,6 +211,9 @@ fn main() { value: 30 }))))); + // This type can generate new instances infinitely if not handled properly. + std::hint::black_box(Expanding::<()> { a: PhantomData, b: std::ptr::null() }); + zzz(); // #break } -- cgit 1.4.1-3-g733a5