From 2e049a658d582275e816c09f9d57e8cc14f03c13 Mon Sep 17 00:00:00 2001 From: kadmin Date: Mon, 28 Dec 2020 07:40:58 +0000 Subject: [PATCH] Add regr. test for mutual recursion --- .../ui/traits/mutual-recursion-issue-75860.rs | 15 +++++++++++++++ .../traits/mutual-recursion-issue-75860.stderr | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/test/ui/traits/mutual-recursion-issue-75860.rs create mode 100644 src/test/ui/traits/mutual-recursion-issue-75860.stderr diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.rs b/src/test/ui/traits/mutual-recursion-issue-75860.rs new file mode 100644 index 0000000000000..d7d7307b42431 --- /dev/null +++ b/src/test/ui/traits/mutual-recursion-issue-75860.rs @@ -0,0 +1,15 @@ +pub fn iso(a: F1, b: F2) -> (Box B>, Box A>) + where + F1: (Fn(A) -> B) + 'static, + F2: (Fn(B) -> A) + 'static, +{ + (Box::new(a), Box::new(b)) +} +pub fn iso_un_option() -> (Box B>, Box A>) { + let left = |o_a: Option<_>| o_a.unwrap(); + let right = |o_b: Option<_>| o_b.unwrap(); + iso(left, right) + //~^ ERROR overflow +} + +fn main() {} diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.stderr b/src/test/ui/traits/mutual-recursion-issue-75860.stderr new file mode 100644 index 0000000000000..cf867ef78c3b1 --- /dev/null +++ b/src/test/ui/traits/mutual-recursion-issue-75860.stderr @@ -0,0 +1,16 @@ +error[E0275]: overflow evaluating the requirement `Option<_>: Sized` + --> $DIR/mutual-recursion-issue-75860.rs:11:5 + | +LL | iso(left, right) + | ^^^ + | + ::: $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub enum Option { + | - required by this bound in `Option` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`mutual_recursion_issue_75860`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`.