Skip to content

Commit bcaf7df

Browse files
authored
Rollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-Simulacrum
Add regression test for mutual recursion in obligation forest Add regression test for #75860 with a slightly smaller example. I was looking at what caused the issue and was surprised when it errors out on nightly, so I just added a regression test which should effectively close the issue, altho it would be nice to find the fix for reference. Also I found that 80066 is not fixed by whatever fixed 75860.
2 parents 9abd746 + 2e049a6 commit bcaf7df

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pub fn iso<A, B, F1, F2>(a: F1, b: F2) -> (Box<dyn Fn(A) -> B>, Box<dyn Fn(B) -> A>)
2+
where
3+
F1: (Fn(A) -> B) + 'static,
4+
F2: (Fn(B) -> A) + 'static,
5+
{
6+
(Box::new(a), Box::new(b))
7+
}
8+
pub fn iso_un_option<A, B>() -> (Box<dyn Fn(A) -> B>, Box<dyn Fn(B) -> A>) {
9+
let left = |o_a: Option<_>| o_a.unwrap();
10+
let right = |o_b: Option<_>| o_b.unwrap();
11+
iso(left, right)
12+
//~^ ERROR overflow
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0275]: overflow evaluating the requirement `Option<_>: Sized`
2+
--> $DIR/mutual-recursion-issue-75860.rs:11:5
3+
|
4+
LL | iso(left, right)
5+
| ^^^
6+
|
7+
::: $SRC_DIR/core/src/option.rs:LL:COL
8+
|
9+
LL | pub enum Option<T> {
10+
| - required by this bound in `Option`
11+
|
12+
= help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`mutual_recursion_issue_75860`)
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0275`.

0 commit comments

Comments
 (0)