Skip to content

Commit

Permalink
Add test for issue 30867
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Oct 7, 2024
1 parent fa4f18b commit 382365b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/ui/traits/hrtb-related-type-params-30867.rs
Original file line number Diff line number Diff line change
@@ -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>()
}

0 comments on commit 382365b

Please sign in to comment.