From d693e1926894824bc4fb2249a17a9cd71c926ac2 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 22 Aug 2024 00:25:37 +0000 Subject: [PATCH] Promote crashes tests to ui. --- tests/crashes/125249.rs | 8 ------ .../impl-trait/closure-in-type.rs} | 3 ++- .../in-trait/return-type-notation.rs | 9 +++++++ .../in-trait/return-type-notation.stderr | 27 +++++++++++++++++++ 4 files changed, 38 insertions(+), 9 deletions(-) delete mode 100644 tests/crashes/125249.rs rename tests/{crashes/126850.rs => ui/impl-trait/closure-in-type.rs} (81%) create mode 100644 tests/ui/impl-trait/in-trait/return-type-notation.rs create mode 100644 tests/ui/impl-trait/in-trait/return-type-notation.stderr diff --git a/tests/crashes/125249.rs b/tests/crashes/125249.rs deleted file mode 100644 index 1cf6338a0d6..00000000000 --- a/tests/crashes/125249.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: rust-lang/rust#125185 -#![feature(return_position_impl_trait_in_trait, return_type_notation)] - -trait IntFactory { - fn stream(&self) -> impl IntFactory + Send>; -} - -pub fn main() {} diff --git a/tests/crashes/126850.rs b/tests/ui/impl-trait/closure-in-type.rs similarity index 81% rename from tests/crashes/126850.rs rename to tests/ui/impl-trait/closure-in-type.rs index 0ddc24c8bb1..1e06e6e21fd 100644 --- a/tests/crashes/126850.rs +++ b/tests/ui/impl-trait/closure-in-type.rs @@ -1,4 +1,5 @@ -//@ known-bug: rust-lang/rust#126850 +//@ check-pass + fn bug() -> impl Iterator< Item = [(); { |found: &String| Some(false); diff --git a/tests/ui/impl-trait/in-trait/return-type-notation.rs b/tests/ui/impl-trait/in-trait/return-type-notation.rs new file mode 100644 index 00000000000..3945eb9bdee --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-type-notation.rs @@ -0,0 +1,9 @@ +#![allow(incomplete_features)] +#![feature(return_type_notation)] + +trait IntFactory { + fn stream(&self) -> impl IntFactory + Send>; + //~^ ERROR cycle detected when resolving lifetimes for `IntFactory::stream` +} + +pub fn main() {} diff --git a/tests/ui/impl-trait/in-trait/return-type-notation.stderr b/tests/ui/impl-trait/in-trait/return-type-notation.stderr new file mode 100644 index 00000000000..d9fd780cdff --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-type-notation.stderr @@ -0,0 +1,27 @@ +error[E0391]: cycle detected when resolving lifetimes for `IntFactory::stream` + --> $DIR/return-type-notation.rs:5:5 + | +LL | fn stream(&self) -> impl IntFactory + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing function signature of `IntFactory::stream`... + --> $DIR/return-type-notation.rs:5:5 + | +LL | fn stream(&self) -> impl IntFactory + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires looking up late bound vars inside `IntFactory::stream`... + --> $DIR/return-type-notation.rs:5:5 + | +LL | fn stream(&self) -> impl IntFactory + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires resolving lifetimes for `IntFactory::stream`, completing the cycle +note: cycle used when listing captured lifetimes for opaque `IntFactory::stream::{opaque#0}` + --> $DIR/return-type-notation.rs:5:25 + | +LL | fn stream(&self) -> impl IntFactory + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`.