Uh oh!
There was an error while loading. Please reload this page.
Grammar: Functions, methods, impl, traits, extern. - #430
Conversation
Question: Would it be clearer if Also, I missed the 2015/2018 difference of trait functions taking optional named parameters. I'm thinking of documenting the 2015 behavior with a dagger (or something) that links to the section that describes that it is no longer allowed. Thoughts? |
matthewjasper
left a comment
There was a problem hiding this comment.
This looks great, left a few small comments
| > _BlockWithInnerAttributes_ :\ | ||
| > `{`\ | ||
| > [_InnerAttribute_]<sup>\*</sup>\ | ||
| > [_Statement_]<sup>\*</sup>\ |
There was a problem hiding this comment.
Missing an optional expression
| ## Unsafe traits | ||
| Traits that begin with the `unsafe` keyword indicate that *implementing* the |
There was a problem hiding this comment.
I think this would be clearer as "Trait items that..."
| Traits that begin with the `unsafe` keyword indicate that *implementing* the | ||
| trait may be [unsafe]. It is safe to use a correctly implemented unsafe trait. | ||
| The [trait implementation] must also include the `unsafe` keyword. |
There was a problem hiding this comment.
"include" should be "start with" or "begin with"
matthewjasper
commented
Sep 30, 2018
I'm not sure how arbitrary self types changes anything here. It would probably be slightly better for methods to only include things with |
ehuss
commented
Oct 1, 2018
Thanks for taking a look. I've done some updates to fix a bunch of things and specify functions and methods separately. I added some detail about pattern limitations for parameters. |
These all are intertwined with the "function" definition. Updates grammar for: - Functions and methods - Extern blocks - Implementation - Traits
- Review comments. - Separate Function and Method in impl. - Move _Method_ grammar to the section discussing methods. - Be a little more explicit about `self` types. - Fix block ending with expression for functions. - Fix extern blocks not supporting patterns. - Fix trait functions/methods having optional patterns, and the pattern restrictions.
ehuss
commented
Oct 2, 2018
I attempted to explain the 2018 edition changes for trait parameter patterns. |
matthewjasper
commented
Oct 3, 2018
Thanks! |
These all are intertwined with the "function" definition. Updates grammar for: