You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/3437-implementable-trait-alias.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -291,6 +291,8 @@ Trait aliases are `unsafe` to implement iff the underlying trait is marked `unsa
291
291
292
292
- The sytactic distance between implementable and non-implementable aliases is short, which might confuse users.
293
293
In particular, the fact that `trait Foo = Bar + Send;` means something different than `trait Foo = Bar where Self: Send;` will likely be surprising to many.
294
+
- On the other hand, the rules mirror those of `impl` blocks, which Rust programmers already understand.
295
+
- Ideally, we would collect user feedback before stabilizing this feature.
294
296
- Adds complexity to the language.
295
297
- Many of the motivating use-cases involve language features that are not yet stable, or even merely speculative.
296
298
More experience with those features might unearth better alternatives.
@@ -300,8 +302,8 @@ More experience with those features might unearth better alternatives.
300
302
- Very lightweight, with no new syntax forms. Compare "trait transformers" proposals, for example—they are generally much heavier.
301
303
- Better ergonomics compared to purely proc-macro based solutions.
302
304
- One alternative is to allow marker traits or auto traits to appear in `+` bounds of implementable aliases.
303
-
(For example, `trait Foo = Bar + Send;` could be made implementable). However, I suspect that the complexity would not be worthwhile.
304
-
- Another possibility is to require an attribute on implmenentable aliase; e.g. `#[implementable] trait Foo = ...`. Again, I don't think that the complexity is warranted.
305
+
(For example, `trait Foo = Bar + Send;` could be made implementable). However, this would arguably make implementability rules less intuitive, as the symmetry with `impl` blocks would be broken.
306
+
- Another possibility is to require an attribute on implmenentable aliase; e.g. `#[implementable] trait Foo = ...`. This would make the otherwise-subtle implementability rules explicit, but at the cost of cluttering the attribute namespace and adding more complexity to the language.
0 commit comments