mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
e7ad2da7f1
When given ```rust trait SomeTrait { type SomeType<'a>; } struct Foo<T: SomeTrait> { x: for<'a> fn(T::SomeType<'a>) } ``` expand to ```rust impl<T: ::core::clone::Clone + SomeTrait> ::core::clone::Clone for Foo<T> where for<'a> T::SomeType<'a>: ::core::clone::Clone { #[inline] fn clone(&self) -> Foo<T> { Foo { x: ::core::clone::Clone::clone(&self.x) } } } ``` instead of the previous invalid ``` impl<T: ::core::clone::Clone + SomeTrait> ::core::clone::Clone for Foo<T> where T::SomeType<'a>: ::core::clone::Clone { #[inline] fn clone(&self) -> Foo<T> { Foo { x: ::core::clone::Clone::clone(&self.x) } } } ``` Fix #122622.
14 lines
271 B
Rust
14 lines
271 B
Rust
//@ run-pass
|
|
// Issue #122622: `#[derive(Clone)]` should work for HRTB function type taking an associated type
|
|
#![allow(dead_code)]
|
|
trait SomeTrait {
|
|
type SomeType<'a>;
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
struct Foo<T: SomeTrait> {
|
|
x: for<'a> fn(T::SomeType<'a>)
|
|
}
|
|
|
|
fn main() {}
|