Skip to content

Commit 5bc42e8

Browse files
committed
Clarify that where clauses cannot yet appear on trait methods.
1 parent 74a21a3 commit 5bc42e8

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

active/0000-where.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,9 @@ your mileage may vary. - nmatsakis
345345
### Where can where clauses appear?
346346

347347
Where clauses can be added to anything that can be parameterized with
348-
type/lifetime parameters: `impl` declarations, `fn` declarations, and
349-
`trait` and `struct` definitions. They appear as follows:
348+
type/lifetime parameters with the exception of trait method
349+
definitions: `impl` declarations, `fn` declarations, and `trait` and
350+
`struct` definitions. They appear as follows:
350351

351352
impl Foo<A,B>
352353
where ...
@@ -356,6 +357,13 @@ type/lifetime parameters: `impl` declarations, `fn` declarations, and
356357
where ...
357358
{ }
358359

360+
impl Foo<A,B> for C
361+
{
362+
fn foo<A,B> -> C
363+
where ...
364+
{ }
365+
}
366+
359367
fn foo<A,B> -> C
360368
where ...
361369
{ }
@@ -367,10 +375,15 @@ type/lifetime parameters: `impl` declarations, `fn` declarations, and
367375
trait Foo<A,B> : C
368376
where ...
369377
{ }
370-
371-
While in the motivation I mentioned the possibility of embedding where
372-
clauses into object types, I do not propose that as part of this
373-
RFC. That would come with some sort of associated items RFC.
378+
379+
#### Where clauses cannot (yet) appear on trait methods
380+
381+
Note that trait method definitions were specifically excluded from the
382+
list above. The reason is that including where clauses on a trait
383+
method raises interesting questions for what it means to implement the
384+
trait. Using where clauses it becomes possible to define methods that
385+
do not necessarily apply to all implementations. We intend to enable
386+
this feature but it merits a second RFC to delve into the details.
374387

375388
### Where clause grammar
376389

0 commit comments

Comments
 (0)