Skip to content

Commit

Permalink
Merge pull request #4 from pnkfelix/alternatives-to-equals-where
Browse files Browse the repository at this point in the history
Explicitly point out alternatives to `trait Alias = where PREDICATES;`
  • Loading branch information
hadronized authored Apr 13, 2017
2 parents b5ff949 + 80dbc13 commit 2b14c14
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions text/0000-trait-alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,20 @@ constraints, instead of creating an alias for a set of supertraits and predicate
something like `constraint Foo<T> = T: Bar, Vec<T>: Baz;`, used as `fn quux<T>(...) where Foo<T> { ... }`
(i.e. direct substitution). Trait object usage is unclear.

## Syntax for sole `where` clause.

The current RFC specifies that it is possible to use only the `where` clause by leaving the list of traits empty:

```rust
trait DebugDefault = where Self: Debug + Default;
```

This is one of many syntaxes that are available for this construct. Alternatives include:

* `trait DebugDefault where Self: Debug + Default;` (which has been [considered and discarded](https://github.com/rust-lang/rfcs/pull/1733#issuecomment-257993316) because [it might look](https://github.com/rust-lang/rfcs/pull/1733#issuecomment-258495468) too much like a new trait definition)
* `trait DebugDefault = _ where Self: Debug + Default;` (which was [considered and then removed](https://github.com/rust-lang/rfcs/pull/1733/commits/88d3074957276c7201147fc625f18e0ebcecc1b9#diff-ae27a1a8d977f731e67823349151bed5L116) because it is [technically unnecessary](https://github.com/rust-lang/rfcs/pull/1733#issuecomment-284252196))
* `trait DebugDefault = Self where Self: Debug + Default;` (analogous to previous case but not formally discussed)

# Unresolved questions
[unresolved]: #unresolved-questions

Expand Down

0 comments on commit 2b14c14

Please sign in to comment.