mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
55b76f4720
When `derive`ing, account for HRTB on `BareFn` fields When given ```rust trait SomeTrait { type SomeType<'a>; } #[derive(Clone)] 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. <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |