Skip to content

Commit 6b36635

Browse files
Discuss #[implementable] in more detail
1 parent af7b7ea commit 6b36635

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

text/3437-implementable-trait-alias.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ Trait aliases are `unsafe` to implement iff the underlying trait is marked `unsa
291291

292292
- The sytactic distance between implementable and non-implementable aliases is short, which might confuse users.
293293
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.
294296
- Adds complexity to the language.
295297
- Many of the motivating use-cases involve language features that are not yet stable, or even merely speculative.
296298
More experience with those features might unearth better alternatives.
@@ -300,8 +302,8 @@ More experience with those features might unearth better alternatives.
300302
- Very lightweight, with no new syntax forms. Compare "trait transformers" proposals, for example—they are generally much heavier.
301303
- Better ergonomics compared to purely proc-macro based solutions.
302304
- 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.
305307

306308
# Prior art
307309

0 commit comments

Comments
 (0)