Add test for issue 30867

This commit is contained in:
clubby789 2024-10-07 11:36:58 +00:00
parent fa4f18be55
commit 382365bfe3

View File

@ -0,0 +1,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>()
}