mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Corrects order of identifier and type in arguments list in 7.3.3 Constraints example. Fixes #1613
This commit is contained in:
parent
a88c0847c2
commit
c42b52b3fd
18
doc/rust.md
18
doc/rust.md
@ -190,7 +190,7 @@ with any other legal whitespace element, such as a single space character.
|
|||||||
## Tokens
|
## Tokens
|
||||||
|
|
||||||
~~~~~~~~ {.ebnf .gram}
|
~~~~~~~~ {.ebnf .gram}
|
||||||
simple_token : keyword | reserved | unop | binop ;
|
simple_token : keyword | reserved | unop | binop ;
|
||||||
token : simple_token | ident | literal | symbol | whitespace token ;
|
token : simple_token | ident | literal | symbol | whitespace token ;
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ from the source file name, with the `.rs` extension removed.
|
|||||||
## Crate files
|
## Crate files
|
||||||
|
|
||||||
~~~~~~~~ {.ebnf .gram}
|
~~~~~~~~ {.ebnf .gram}
|
||||||
crate : attribute [ ';' | attribute* directive ]
|
crate : attribute [ ';' | attribute* directive ]
|
||||||
| directive ;
|
| directive ;
|
||||||
directive : view_item | dir_directive | source_directive ;
|
directive : view_item | dir_directive | source_directive ;
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
@ -730,7 +730,7 @@ independently declared with [`use` declarations](#use-declarations).
|
|||||||
|
|
||||||
Imports support a number of "convenience" notations:
|
Imports support a number of "convenience" notations:
|
||||||
|
|
||||||
* Importing as a different name than the imported name, using the
|
* Importing as a different name than the imported name, using the
|
||||||
syntax `import x = p::q::r;`.
|
syntax `import x = p::q::r;`.
|
||||||
* Importing a list of paths differing only in final element, using
|
* Importing a list of paths differing only in final element, using
|
||||||
the glob-like brace syntax `import a::b::{c,d,e,f};`
|
the glob-like brace syntax `import a::b::{c,d,e,f};`
|
||||||
@ -1153,7 +1153,7 @@ An _implementation item_ provides an implementation of an
|
|||||||
|
|
||||||
~~~~
|
~~~~
|
||||||
type circle = {radius: float, center: point};
|
type circle = {radius: float, center: point};
|
||||||
|
|
||||||
impl circle_shape of shape for circle {
|
impl circle_shape of shape for circle {
|
||||||
fn draw(s: surface) { do_draw_circle(s, self); }
|
fn draw(s: surface) { do_draw_circle(s, self); }
|
||||||
fn bounding_box() -> bounding_box {
|
fn bounding_box() -> bounding_box {
|
||||||
@ -1313,7 +1313,7 @@ declaring a function-local item.
|
|||||||
|
|
||||||
~~~~~~~~{.ebnf .gram}
|
~~~~~~~~{.ebnf .gram}
|
||||||
let_decl : "let" pat [':' type ] ? [ init ] ? ';' ;
|
let_decl : "let" pat [':' type ] ? [ init ] ? ';' ;
|
||||||
init : [ '=' | '<-' ] expr ;
|
init : [ '=' | '<-' ] expr ;
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
@ -1941,7 +1941,7 @@ for e: foo in v {
|
|||||||
~~~~~~~~{.ebnf .gram}
|
~~~~~~~~{.ebnf .gram}
|
||||||
if_expr : "if" expr '{' block '}'
|
if_expr : "if" expr '{' block '}'
|
||||||
[ "else" else_tail ] ? ;
|
[ "else" else_tail ] ? ;
|
||||||
|
|
||||||
else_tail : "else" [ if_expr
|
else_tail : "else" [ if_expr
|
||||||
| '{' block '} ] ;
|
| '{' block '} ] ;
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
@ -2331,11 +2331,11 @@ introduced inline in source code using the `macro` extension, may be used. The
|
|||||||
current built-in syntax extensions are:
|
current built-in syntax extensions are:
|
||||||
|
|
||||||
|
|
||||||
* `fmt` expands into code to produce a formatted string, similar to
|
* `fmt` expands into code to produce a formatted string, similar to
|
||||||
`printf` from C.
|
`printf` from C.
|
||||||
* `env` expands into a string literal containing the value of that
|
* `env` expands into a string literal containing the value of that
|
||||||
environment variable at compile-time.
|
environment variable at compile-time.
|
||||||
* `concat_idents` expands into an identifier which is the
|
* `concat_idents` expands into an identifier which is the
|
||||||
concatenation of its arguments.
|
concatenation of its arguments.
|
||||||
* `ident_to_str` expands into a string literal containing the name of
|
* `ident_to_str` expands into a string literal containing the name of
|
||||||
its argument (which must be a literal).
|
its argument (which must be a literal).
|
||||||
@ -2750,7 +2750,7 @@ A _constraint_ is a predicate applied to specific slots.
|
|||||||
For example, consider the following code:
|
For example, consider the following code:
|
||||||
|
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
pure fn is_less_than(int a, int b) -> bool {
|
pure fn is_less_than(a: int, b: int) -> bool {
|
||||||
ret a < b;
|
ret a < b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user