-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #89341 - audunhalland:derive-type-params-with-bound-gen…
…eric-params, r=jackh726 Deriving: Include bound generic params in type parameters for where clause Fixes #89188. The `derive` macro ignored the `for<'s>` needed with the `Fn` trait in that code example. edit: I'm unsure if this might cause regressions. I'm not an experienced compiler developer so I'm not used to thinking about unwanted side effects code changes like this might have.
- Loading branch information
Showing
2 changed files
with
79 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// check-pass | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
trait CallWithShim: Sized { | ||
type Shim<'s> | ||
where | ||
Self: 's; | ||
} | ||
|
||
#[derive(Clone)] | ||
struct ShimMethod<T: CallWithShim + 'static>(pub &'static dyn for<'s> Fn(&'s mut T::Shim<'s>)); | ||
|
||
trait CallWithShim2: Sized { | ||
type Shim<T>; | ||
} | ||
|
||
struct S<'s>(&'s ()); | ||
|
||
#[derive(Clone)] | ||
struct ShimMethod2<T: CallWithShim2 + 'static>(pub &'static dyn for<'s> Fn(&'s mut T::Shim<S<'s>>)); | ||
|
||
trait Trait<'s, 't, 'u> {} | ||
|
||
#[derive(Clone)] | ||
struct ShimMethod3<T: CallWithShim2 + 'static>( | ||
pub &'static dyn for<'s> Fn( | ||
&'s mut T::Shim<dyn for<'t> Fn(&'s mut T::Shim<dyn for<'u> Trait<'s, 't, 'u>>)>, | ||
), | ||
); | ||
|
||
trait Trait2 { | ||
type As; | ||
} | ||
|
||
#[derive(Clone)] | ||
struct ShimMethod4<T: Trait2 + 'static>(pub &'static dyn for<'s> Fn(&'s mut T::As)); | ||
|
||
pub fn main() {} |