-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Fold to take by value #642
Comments
Should the impl<I: Interner, TI: TargetInterner<I>> Fold<I, TI> for Const<I> {
type Result = Const<TI>;
fn fold_with<'i>(
&self,
folder: &mut dyn Folder<'i, I, TI>,
outer_binder: DebruijnIndex,
) -> Fallible<Self::Result>
where
I: 'i,
TI: 'i,
{
folder.fold_const(self /* <-- this */, outer_binder)
}
}
|
Yes, because |
Sorry for the noob questions, but is it all right to add |
You mean the calls like this?
|
I tried to make this work, but couldn't manage. I left some notes in #644 (comment) and the branch is up, in case someone else wants to try. |
Currently, the
Folder
trait takes folded values by reference. As part of the shared type library plan, the fold traits should take their folded values by value, to match theTypeFolder
trait in rustc.For example, this
should be changed to this:
Same thing with the other folding functions.
Lastly, code that calls folding functions should pass the values by value, instead of by reference.
The text was updated successfully, but these errors were encountered: