Skip to content

Commit

Permalink
Move test #93775 to crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
DianQK committed Dec 21, 2024
1 parent 6076bee commit 2a87896
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ui/associated-consts/issue-58022.rs
ui/associated-consts/issue-63496.rs
ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs
ui/associated-consts/issue-88599-ref-self.rs
ui/associated-consts/issue-93775.rs
ui/associated-consts/issue-93835.rs
ui/associated-inherent-types/issue-104260.rs
ui/associated-inherent-types/issue-109071.rs
Expand Down
38 changes: 38 additions & 0 deletions tests/crashes/recursive-print-issue-93775.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//! This test case is modified from <https://github.com/rust-lang/rust/issues/93775>.
//! The type printing involves recursive calls that lead to stack overflow.
//! If it no longer crashes, please increase the nested type levels
//! unless you are fixing this issue.
//@ known-bug: #93775

#![recursion_limit = "2049"]

use std::marker::PhantomData;

struct Z;
struct S<T>(PhantomData<T>);

type Nested4<T> = S<S<S<S<T>>>>;
type Nested16<T> = Nested4<Nested4<Nested4<Nested4<T>>>>;
type Nested64<T> = Nested16<Nested16<Nested16<Nested16<T>>>>;
type Nested256<T> = Nested64<Nested64<Nested64<Nested64<T>>>>;
type Nested1024<T> = Nested256<Nested256<Nested256<Nested256<T>>>>;
type Nested4096<T> = Nested1024<Nested1024<Nested1024<Nested1024<T>>>>;
type Nested16384<T> = Nested4096<Nested4096<Nested4096<Nested4096<T>>>>;

type Nested = Nested16384<Z>;

trait AsNum {
const NUM: u32;
}

impl AsNum for Z {
const NUM: u32 = 0;
}

impl<T: AsNum> AsNum for S<T> {
const NUM: u32 = T::NUM + 1;
}

fn main() {
let _ = Nested::NUM;
}
33 changes: 0 additions & 33 deletions tests/ui/associated-consts/issue-93775.rs

This file was deleted.

0 comments on commit 2a87896

Please sign in to comment.