Skip to content

Commit 384e749

Browse files
committed
Talk about default associated types
1 parent dbd5c75 commit 384e749

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

text/0000-api-evolution.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,17 @@ arise at all often in downstream code, it would be advisable to explore a
302302
different choice of names. More guidelines for the standard library are given
303303
later on.
304304

305-
Finally, if the new item would change the trait from object safe to non-object
306-
safe, it is considered a major change.
305+
There are two circumstances when adding a defaulted item is still a major change:
306+
307+
* The new item would change the trait from object safe to non-object safe.
308+
* The trait has a defaulted associated type and the item being added is a
309+
defaulted function/method. In this case, existing impls that override the
310+
associated type will break, since the function/method default will not
311+
apply. (See
312+
[the associated item RFC](https://github.com/rust-lang/rfcs/blob/master/text/0195-associated-items.md#defaults)).
313+
* Adding a default to an existing associated type is likewise a major change if
314+
the trait has defaulted methods, since it will invalidate use of those
315+
defaults for the methods in existing trait impls.
307316

308317
#### Minor change: adding a defaulted type parameter.
309318

0 commit comments

Comments
 (0)