Skip to content

Commit 0f2b79c

Browse files
committed
add tests
1 parent 098a568 commit 0f2b79c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//@ ignore-compare-mode-next-solver
2+
//@ compile-flags: -Znext-solver
3+
//@ check-pass
4+
5+
// Regression test for trait-system-refactor-initiative#220. Builtin `Fn`-trait
6+
// candidates required `for<'latebound> Output<'latebound>: Sized` which ended
7+
// up resulting in overflow if the return type is an opaque in the defining scope.
8+
//
9+
// We now eagerly instantiate the binder of the function definition which avoids
10+
// that overflow by relating the lifetime of the opaque to something from the
11+
// input.
12+
fn flat_map<T, F, I, G>(_: F, _: G)
13+
where
14+
F: FnOnce(T) -> I,
15+
I: Iterator,
16+
G: Fn(<I as Iterator>::Item) -> usize,
17+
{
18+
}
19+
20+
fn rarw<'a>(_: &'a ()) -> impl Iterator<Item = &'a str> {
21+
flat_map(rarw, |x| x.len());
22+
std::iter::empty()
23+
}
24+
25+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ ignore-compare-mode-next-solver
2+
//@ compile-flags: -Znext-solver
3+
//@ check-pass
4+
5+
// Regression test for trait-system-refactor-initiative#204, see
6+
// the sibling test for more details.
7+
8+
fn constrain<'a, F: FnOnce(&'a ())>(_: F) {}
9+
fn foo<'a>(_: &'a ()) -> impl Sized + use<'a> {
10+
constrain(foo);
11+
()
12+
}
13+
14+
fn main() {}

0 commit comments

Comments
 (0)