about summary refs log tree commit diff
path: root/tests/ui/traits/hrtb-related-type-params-30867.rs
blob: ec1e3355bfba7080ff8371b02491eab02d7f4e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ check-pass
//! Tests that HRTB impl selection covers type parameters not directly related
//! to the trait.
//! Test for <https://github.com/rust-lang/rust/issues/30867>

#![crate_type = "lib"]

trait Unary<T> {}
impl<T, U, F: Fn(T) -> U> Unary<T> for F {}
fn unary<F: for<'a> Unary<&'a T>, T>() {}

pub fn test<F: for<'a> Fn(&'a i32) -> &'a i32>() {
    unary::<F, i32>()
}