From 381a0e3cb0a71cbef439be974135562e64d40f38 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 6 Apr 2024 14:41:59 -0700 Subject: Move ice tests to rustdoc-ui --- tests/rustdoc-ui/auxiliary/issue-73061.rs | 17 +++++++++++ tests/rustdoc-ui/ice-blanket-impl-56701.rs | 35 ++++++++++++++++++++++ .../ice-cross-crate-opaque-assoc-type-73061.rs | 15 ++++++++++ 3 files changed, 67 insertions(+) create mode 100644 tests/rustdoc-ui/auxiliary/issue-73061.rs create mode 100644 tests/rustdoc-ui/ice-blanket-impl-56701.rs create mode 100644 tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs (limited to 'tests/rustdoc-ui') diff --git a/tests/rustdoc-ui/auxiliary/issue-73061.rs b/tests/rustdoc-ui/auxiliary/issue-73061.rs new file mode 100644 index 00000000000..9a2e4aaf75e --- /dev/null +++ b/tests/rustdoc-ui/auxiliary/issue-73061.rs @@ -0,0 +1,17 @@ +//@edition:2018 + +#![feature(impl_trait_in_assoc_type)] + +pub trait Foo { + type X: std::future::Future; + fn x(&self) -> Self::X; +} + +pub struct F; + +impl Foo for F { + type X = impl std::future::Future; + fn x(&self) -> Self::X { + async {} + } +} diff --git a/tests/rustdoc-ui/ice-blanket-impl-56701.rs b/tests/rustdoc-ui/ice-blanket-impl-56701.rs new file mode 100644 index 00000000000..13b0fc9032a --- /dev/null +++ b/tests/rustdoc-ui/ice-blanket-impl-56701.rs @@ -0,0 +1,35 @@ +//@ check-pass +// This shouldn't cause a stack overflow when rustdoc is run +// https://github.com/rust-lang/rust/issues/56701 + +use std::ops::Deref; +use std::ops::DerefMut; + +pub trait SimpleTrait { + type SimpleT; +} + +impl> SimpleTrait for Outer { + type SimpleT = Inner::SimpleT; +} + +pub trait AnotherTrait { + type AnotherT; +} + +impl>> AnotherTrait for Simple { + type AnotherT = T; +} + +pub struct Unrelated>>(UnrelatedT); + +impl>> Deref for Unrelated { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + + +pub fn main() { } diff --git a/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs b/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs new file mode 100644 index 00000000000..1434bef49e0 --- /dev/null +++ b/tests/rustdoc-ui/ice-cross-crate-opaque-assoc-type-73061.rs @@ -0,0 +1,15 @@ +// Regression test for ICE https://github.com/rust-lang/rust/issues/73061 + +//@ check-pass +//@ aux-build:issue-73061.rs + +extern crate issue_73061; + +pub struct Z; + +impl issue_73061::Foo for Z { + type X = ::X; + fn x(&self) -> Self::X { + issue_73061::F.x() + } +} -- cgit 1.4.1-3-g733a5