Skip to content

Commit 382365b

Browse files
committed
Add test for issue 30867
1 parent fa4f18b commit 382365b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ check-pass
2+
//! Tests that HRTB impl selection covers type parameters not directly related
3+
//! to the trait.
4+
//! Test for <https://github.com/rust-lang/rust/issues/30867>
5+
6+
#![crate_type = "lib"]
7+
8+
trait Unary<T> {}
9+
impl<T, U, F: Fn(T) -> U> Unary<T> for F {}
10+
fn unary<F: for<'a> Unary<&'a T>, T>() {}
11+
12+
pub fn test<F: for<'a> Fn(&'a i32) -> &'a i32>() {
13+
unary::<F, i32>()
14+
}

0 commit comments

Comments
 (0)