Skip to content

Commit aa8a885

Browse files
authored
Rollup merge of #112976 - dswij:issue-112347, r=compiler-errors
Add test for futures with HRTB Part of #112347 This PR adds test for ice when resolving for `Futures` with HRTB.
2 parents db3c394 + 91351ef commit aa8a885

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: the compiler unexpectedly panicked. this is a bug.
2+
3+
query stack during panic:
4+
#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> [async fn body@$DIR/future.rs:32:35: 34:2]: core::future::future::Future`
5+
#1 [codegen_select_candidate] computing candidate for `<strlen as Trait>`
6+
end of query stack
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// ignore-tidy-linelength
2+
// edition:2021
3+
// revisions: classic next
4+
//[next] compile-flags: -Ztrait-solver=next
5+
//[next] check-pass
6+
//[classic] known-bug: #112347
7+
//[classic] build-fail
8+
//[classic] failure-status: 101
9+
//[classic] normalize-stderr-test "note: .*\n\n" -> ""
10+
//[classic] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
11+
//[classic] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
12+
//[classic] rustc-env:RUST_BACKTRACE=0
13+
14+
#![feature(unboxed_closures)]
15+
16+
use std::future::Future;
17+
18+
trait Trait {
19+
fn func(&self, _: &str);
20+
}
21+
22+
impl<T> Trait for T
23+
where
24+
for<'a> T: Fn<(&'a str,)> + Send + Sync,
25+
for<'a> <T as FnOnce<(&'a str,)>>::Output: Future<Output = usize> + Send,
26+
{
27+
fn func(&self, _: &str) {
28+
println!("hello!");
29+
}
30+
}
31+
32+
async fn strlen(x: &str) -> usize {
33+
x.len()
34+
}
35+
36+
fn main() {
37+
strlen.func("hi");
38+
}

0 commit comments

Comments
 (0)