Skip to content

Commit 8e258de

Browse files
committed
Update docs
1 parent c344473 commit 8e258de

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎docs/src/codegen/types/classes.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ behind pointers, is emitted at the end of the file as an empty
9090

9191
A constructor becomes an associated function named after the class. It opens
9292
with `let mut this = Self { ... }`, one field per member initializer, then runs
93-
the C++ body and returns `this`. Only implicit or defaulted copy and move
94-
constructors are supported: a user-defined one stops the translation, and the
95-
implicit copy is what the `Clone` impl represents.
93+
the C++ body and returns `this`. Copy and move constructors become `copy_from`
94+
and `move_from` (see [Naming](./naming.md)); the `Clone` impl calls `copy_from`
95+
when the copy constructor is user-defined.
9696

9797
Methods take `&self` when `const` and `&mut self` otherwise in the unsafe model.
9898
In the refcount model they always take `&self`, since mutation goes through the

‎docs/src/codegen/types/naming.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ name unless they are overloaded, in which case the parameter types are appended
2727
(`method_i32`, `method_i32_const`). `operator<` is emitted as `lt`; comparison
2828
operators additionally produce the corresponding trait impls (`PartialOrd`,
2929
`Ord`, `PartialEq`).
30+
31+
Copy and move constructors are named `copy_from` and `move_from`, and copy and
32+
move assignment operators `copy_assign` and `move_assign`, as long as the class
33+
has only one member of that kind and no method already uses the name; otherwise
34+
they get the overloaded form.

0 commit comments

Comments
 (0)