Commit graph

311 commits

Author SHA1 Message Date
Corey Richardson
acf920fe4b Add static_assert doc blurb 2013-05-22 13:13:29 -04:00
John Clements
b71a1ecea2 added and rewrote text for 'do' and 'for' loops 2013-05-20 11:49:21 -07:00
Huon Wilson
cd2eb4701f syntax: implement #[deriving(DeepClone)]. Fixes #6514. 2013-05-16 22:55:08 +10:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
bors
3abc5b3ffb auto merge of #6417 : pcwalton/rust/exprs-in-patterns, r=pcwalton
r? @graydon
2013-05-13 13:25:42 -07:00
Huon Wilson
d43908a3a7 doc: document the #[deriving] attribute.
Closes #4916.
2013-05-13 20:04:03 +10:00
Patrick Walton
06ef889cdc libsyntax: Remove extern mod foo { ... } from the language. 2013-05-12 16:33:15 -07:00
Alex Crichton
63c7e2f991 Remove the '<->' operator from the language 2013-05-10 22:51:06 -04:00
Daniel Micay
86efd97a10 add gitattributes and fix whitespace issues 2013-05-03 20:01:42 -04:00
Brendan Zabarauskas
ee26c7c433 Revert rename of Div to Quot 2013-05-01 15:40:05 +10:00
Jed Davis
4701716b56 Revert "doc: XFAIL mysterious failure on bots"
This reverts commit 2c6dae081b.
2013-04-30 12:07:10 -07:00
Patrick Walton
2c6dae081b doc: XFAIL mysterious failure on bots 2013-04-29 14:30:57 -07:00
Patrick Walton
670ab8ac36 librustc: Change labels to use the lifetime notation '. 2013-04-29 14:30:57 -07:00
Marvin Löbel
3759b5711d Fixed typo... And a billion other things. 2013-04-24 22:28:02 +02:00
Brendan Zabarauskas
01eb5e8ad3 Rename Div operator trait to Quot and Modulo operator trait to Rem 2013-04-22 01:58:53 +10:00
zofrex
ac9e694d59 Update manual for single-element tuple types 2013-04-07 22:08:40 +01:00
zofrex
d1e2d295f8 Update manual for single-element tuples 2013-04-07 22:08:34 +01:00
bors
21de574625 auto merge of #5703 : steveklabnik/rust/add_log_docs, r=thestinger
Closes #5699.
2013-04-04 00:18:45 -07:00
Steve Klabnik
a7f0bfbda6 One more typo: dubug -> debug 2013-04-03 16:59:13 -07:00
Steve Klabnik
3044f5e2b6 typo fix: na -> an 2013-04-03 12:44:41 -07:00
Steve Klabnik
d79b22474c Add information about logging macros to the tutorial.
Closes #5699.
2013-04-03 11:40:23 -07:00
Daniel Micay
cc148b58ff rename Linear{Map,Set} => Hash{Map,Set} 2013-04-03 10:30:36 -04:00
Daniel Micay
44029a5bbc hashmap: rm linear namespace 2013-04-03 10:30:18 -04:00
Tim Chevalier
ce09645591 docs: Xfail test, it's just for illustration anyway 2013-04-01 15:21:22 -07:00
Tim Chevalier
dbeea18fc5 docs: Document language items, as per #3342 2013-04-01 14:05:03 -07:00
Patrick Walton
1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
bors
706ed6dd53 auto merge of #5583 : jbclements/rust/docfix-for-block-comment-grammar, r=jbclements
... by adding Kleene '+' in two places, and changing a "non-slash" into "non_slash_or_star".

Closes #1588
2013-03-29 09:39:43 -07:00
John Clements
dcb8fa8f35 added defn of non_slash_or_star 2013-03-28 10:23:20 -07:00
John Clements
81d30ade61 fix another subtle bug in comment regex 2013-03-28 10:19:08 -07:00
John Clements
48cb50af13 fixes stated grammar for block comments, by adding Kleene '+' in two places.
Closes #1588
2013-03-27 10:17:37 -07:00
Patrick Walton
b07b36bbf3 test: Fix tests 2013-03-26 22:45:22 -07:00
Patrick Walton
8b56a8380b librustc: Modify all code to use new lifetime binder syntax 2013-03-26 21:30:17 -07:00
Alex Crichton
31f6e64324 doc: Remove mentions of oldmap::HashMap 2013-03-26 19:20:02 -04:00
Felix S. Klock II
e1dccf9a73 Updated to reflect alpha-rename of constant/static items section. 2013-03-26 14:36:01 +01:00
Felix S. Klock II
5b10f4e117 Miscellaneous documentation additions.
Added notes explaining how [expr, ..expr] form is used, targeted at
individuals like me who thought it was more general and handled
dynamic repeat expressions.  (I left a TODO for this section in a
comment, but perhaps that is bad form for the manual...)

Added example of `do` syntax with a function of arity > 1; yes, one
should be able to derive this from the text above it, but it is still
a useful detail to compare and contrast against the arity == 1 case.

Added example of using for expression over a uint range, since someone
who is most used to write `for(int i; i < lim; i++) { ... }` will
likely want to know how to translate that form (regardless of whether
it happens to be good style or not for their use-case).

Added note about the semi-strange meaning of "fixed size" of vectors
in the vector type section.
2013-03-26 14:18:48 +01:00
Graydon Hoare
b481829306 docs: update to avoid mention of const. 2013-03-25 15:53:02 -07:00
Patrick Walton
28efc234f4 libcore: Fix obsolete syntax in extfmt 2013-03-22 23:09:15 -07:00
Tim Chevalier
ab2a397ae7 docs: Copyedit my randomly assigned sections of the manual 2013-03-22 14:45:16 -07:00
Patrick Walton
e78f2e2ac5 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 17:21:16 -07:00
Patrick Walton
58f248d923 test: Fix tests. rs=tests 2013-03-13 20:08:35 -07:00
Patrick Walton
b1c699815d librustc: Don't accept as Trait anymore; fix all occurrences of it. 2013-03-13 20:07:09 -07:00
Brian Anderson
82f190355b Remove uses of log 2013-03-11 23:19:42 -07:00
Patrick Walton
08c840205e librustc: Lint the old drop destructor notation off 2013-03-11 09:36:00 -07:00
Patrick Walton
d7e74b5e91 librustc: Convert all uses of assert over to fail_unless! 2013-03-07 22:37:57 -08:00
Niko Matsakis
3168fe06ff Add manual &self/ and &static/ and /&self declarations that
are currently inferred.  New rules are coming that will require
them to be explicit.  All add some explicit self declarations.
2013-03-06 15:12:57 -05:00
Patrick Walton
a3f728238b librustc: Forbid chained imports and fix the logic for one-level renaming imports 2013-03-02 16:49:30 -08:00
bors
5aca7d6aef auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakis
The fix is straight-forward, but there are several changes
while fixing the issue.

1) disallow `mut` keyword when making a new struct

In code base, there are following code,

```rust
struct Foo { mut a: int };
let a = Foo { mut a: 1 };
```

This is because of structural record, which is
deprecated corrently (see issue #3089) In structural
record, `mut` keyword should be allowd to control
mutability. But without structural record, we don't
need to allow `mut` keyword while constructing struct.

2) disallow structural records in parser level
This is related to 1). With structural records, there
is an ambiguity between empty block and empty struct
To solve the problem, I change parser to stop parsing
structural records. I think this is not a problem,
because structural records are not compiled already.

Misc. issues

There is an ambiguity between empty struct vs. empty match stmt.
with following code,

```rust
match x{} {}
```

Two interpretation is possible, which is listed blow

```rust
match (x{}) {} //  matching with newly-constructed empty struct
(match x{}) {}  //  matching with empty enum(or struct) x
                //  and then empty block
```

It seems that there is no such code in rust code base, but
there is one test which uses empty match statement:
https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/issue-3037.rs

All other cases could be distinguished with look-ahead,
but this can't be. One possible solution is wrapping with
parentheses when matching with an uninhabited type.

```rust
enum what { }
fn match_with_empty(x: what) -> ~str {
    match (x) { //use parentheses to remove the ambiguity
    }
}
```
2013-03-02 04:21:38 -08:00
bors
10faa521ae auto merge of #5188 : ben0x539/rust/doc-call-generic-fn, r=catamorphism
I have seen a few people confused on how to explicitly instantiate generic functions, since the syntax differs from C++'s and C#'s, which is probably where most people asking questions about generic functions are coming from. The only use of the `::<T>` syntax in the reference right now is in the section on paths, which is possibly not where someone trying to find out about generic functions is going to start looking. The tutorial doesn't mention it at all, but I think it's all right to make the reference a tiny bit more redundant and avoid stuffing the tutorial with syntax details.

----

The "Generic functions" subsection mentions that generic functions are instantiated based on context, so let's also mention right away (with a link to the #paths section) that an explicit form is available.

This also adds an example that explicitly instantiates a generic function to the function call expression section.
2013-03-02 01:00:41 -08:00
Jihyun Yu
95bc9ea26d Remove REC, change related tests/docs 2013-03-02 12:57:05 +09:00
Benjamin Herr
382143abd8 doc/rust.md: Demonstrate the f::<T>() syntax more often
The "Generic functions" subsection mentions that generic functions are
instantiated based on context, so let's also mention right away (with a
link to the #paths section) that an explicit form is available.

This also adds an example to the function call expression section that
explicitly instantiates a generic function.
2013-03-02 01:07:01 +01:00