Uh oh!
There was an error while loading. Please reload this page.
Sema: @memcpy changes - #22631
Conversation
xdBronch
commented
Jan 28, 2025
closes #21748 |
| /// * for `[]T`, returns `T` | ||
| /// * for `[*]T`, returns `T` | ||
| /// * for `[*c]T`, returns `T` | ||
| pub fn indexablePtrElem(ty: Type, zcu: *const Zcu) Type { |
There was a problem hiding this comment.
Is this not just elemType2? (surely we don't have too many helpers)
There was a problem hiding this comment.
elemType2 does do this, but I try to avoid using that helper because it's far too general (it does several unrelated things). I'll hopefully kill it soon :P
There was a problem hiding this comment.
Okay, yeah, I suspect that most (if not all) of the usages of elemType2 really just want indexablePtrElem. But that function also implements these extra cases:
?T->std.meta.Child(T)(its doc comment is a lie; e.g. it does?*[n]T->[n]T)anyframe->T->T(of course, that's unused right now)[n]T->T@Vector(n, T)->T
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as off-topic.
This comment was marked as off-topic.
* The langspec definition of `@memcpy` has been changed so that the source and destination element types must be in-memory coercible, allowing all such calls to be raw copying operations, not actually applying any coercions. * Implement aliasing check for comptime `@memcpy`; a compile error will now be emitted if the arguments alias. * Implement more efficient comptime `@memcpy` by loading and storing a whole array at once, similar to how `@memset` is implemented.
dweiller
left a comment
There was a problem hiding this comment.
The langref should be updated as well. It contains language about allowing different ABI sizes
mlugg
commented
Jan 29, 2025
Oh, you're right. I'm going to merge this as-is, but will put up another PR straight after with the langref changes. |
@memcpyhas been changed so that the source and destination element types must be in-memory coercible, allowing all such calls to be raw copying operations, not actually applying any coercions.@memcpy; a compile error will now be emitted if the arguments alias.@memcpyby loading and storing a whole array at once, similar to how@memsetis implemented.This is a breaking change because while the old coercion behavior triggered a Sema TODO at runtime, it did actually work at comptime.