remove reliance on a trait solver inference bug (#18840)
The parameter `In` of `call_inner` is completely unconstrained by its arguments and return type. We are only able to infer it by assuming that the only associated type equal to `In::Param<'_>` is `In::Param<'_>` itself. It could just as well be some other associated type which only normalizes to `In::Param<'_>`. This will change with the next-generation trait solver and was encountered by a crater run https://github.com/rust-lang/rust/pull/133502- cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/168 I couldn't think of a cleaner alternative here. I first tried to just provide `In` as an explicit type parameter. This is also kinda ugly as I need to provide a variable number of them and `${ignore(..)}` is currently still unstable https://github.com/rust-lang/rust/issues/83527. Sorry for the inconvenience. Also fun that this function exists to avoid a separate solver bug in the first place 😅
This commit is contained in:
parent
495798c00b
commit
2a2ce6e0ba
@ -284,6 +284,7 @@ macro_rules! impl_exclusive_system_function {
|
||||
// without using this function. It fails to recognize that `func`
|
||||
// is a function, potentially because of the multiple impls of `FnMut`
|
||||
fn call_inner<In: SystemInput, Out, $($param,)*>(
|
||||
_: PhantomData<In>,
|
||||
mut f: impl FnMut(In::Param<'_>, &mut World, $($param,)*) -> Out,
|
||||
input: In::Inner<'_>,
|
||||
world: &mut World,
|
||||
@ -292,7 +293,7 @@ macro_rules! impl_exclusive_system_function {
|
||||
f(In::wrap(input), world, $($param,)*)
|
||||
}
|
||||
let ($($param,)*) = param_value;
|
||||
call_inner(self, input, world, $($param),*)
|
||||
call_inner(PhantomData::<In>, self, input, world, $($param),*)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -972,6 +972,7 @@ macro_rules! impl_system_function {
|
||||
#[inline]
|
||||
fn run(&mut self, input: In::Inner<'_>, param_value: SystemParamItem< ($($param,)*)>) -> Out {
|
||||
fn call_inner<In: SystemInput, Out, $($param,)*>(
|
||||
_: PhantomData<In>,
|
||||
mut f: impl FnMut(In::Param<'_>, $($param,)*)->Out,
|
||||
input: In::Inner<'_>,
|
||||
$($param: $param,)*
|
||||
@ -979,7 +980,7 @@ macro_rules! impl_system_function {
|
||||
f(In::wrap(input), $($param,)*)
|
||||
}
|
||||
let ($($param,)*) = param_value;
|
||||
call_inner(self, input, $($param),*)
|
||||
call_inner(PhantomData::<In>, self, input, $($param),*)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user