about summary refs log tree commit diff
path: root/doc/tutorial.md
AgeCommit message (Collapse)AuthorLines
2013-08-12Remove unnecessary returnCorey Richardson-1/+1
2013-08-10Merge branch 'master' of https://github.com/MAnyKey/rust into rollupErick Tryzelaar-1/+1
2013-08-10Merge branch 'vec-exh' of https://github.com/stepancheg/rust into rollupErick Tryzelaar-1/+1
2013-08-09typo in tutorialMaxim Kolganov-1/+1
2013-08-08Fix more priv falloutCorey Richardson-2/+2
2013-08-07Fix incorrect non-exhaustive matching for fixed length vecsStepan Koltsov-1/+1
Code like this is fixed now: ``` fn foo(p: [u8, ..4]) { match p { [a, b, c, d] => {} }; } ``` Invalid constructors are not reported as errors yet: ``` fn foo(p: [u8, ..4]) { match p { [_, _, _] => {} // this should be error [_, _, _, _, _, .._] => {} // and this _ => {} } } ``` Issue #8311 is partially fixed by this commit. Fixed-length arrays in let statement are not yet allowed: ``` let [a, b, c] = [1, 2, 3]; // still fails ```
2013-08-06remove `extra::iter`Daniel Micay-1/+1
This module provided adaptors for the old internal iterator protocol, but they proved to be quite unreadable and are not generic enough to handle borrowed pointers well. Since Rust no longer defines an internal iteration protocol, I don't think there's going to be any reuse via these adaptors.
2013-08-03rm obsolete documentation on `for`Daniel Micay-11/+6
it is documented in the container/iterator tutorial, not the basic tutorial
2013-08-02librustc: Introduce a new visitor type based on traits and port syntax to it.Patrick Walton-1/+1
This is preparation for removing `@fn`. This does *not* use default methods yet, because I don't know whether they work. If they do, a forthcoming PR will use them. This also changes the precedence of `as`.
2013-08-01std: Change `Times` trait to use `do` instead of `for`blake2-ppc-1/+1
Change the former repetition:: for 5.times { } to:: do 5.times { } .times() cannot be broken with `break` or `return` anymore; for those cases, use a numerical range loop instead.
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-5/+5
2013-07-29auto merge of #7984 : gifnksm/rust/tutorial-links, r=bstriebors-8/+6
2013-07-26Deny all warnings by default in doc testsAlex Crichton-0/+1
Allow some common ones that are good for examples, however.
2013-07-23tutorial: Remove the sentence about mutable fields.gifnksm-4/+2
2013-07-23tutorial: Fix obsolete namesgifnksm-3/+3
2013-07-23tutorial: Repair broken linksgifnksm-3/+3
2013-07-21Exposed previously hidden 'use' statements in the tutorial's sample code.zslayton-11/+12
2013-07-18auto merge of #7845 : gifnksm/rust/tutorial-remove-dup, r=cmrbors-11/+1
`pandoc` issues warnings. ``` pandoc: Duplicate link reference `[macros]' "source" (line 2151, column 1) pandoc: Duplicate link reference `[tasks]' "source" (line 2150, column 1) pandoc: Duplicate link reference `[wiki-start]' "source" (line 92, column 1) ``` This PR also removes unused link references.
2013-07-17test: Fix tests.Patrick Walton-42/+51
2013-07-17tutorial: remove unused link references.gifnksm-6/+1
2013-07-17tutorial: remove duplicate link references.gifnksm-6/+1
`pandoc` issues warnings. ``` pandoc: Duplicate link reference `[macros]' "source" (line 2151, column 1) pandoc: Duplicate link reference `[tasks]' "source" (line 2150, column 1) pandoc: Duplicate link reference `[wiki-start]' "source" (line 92, column 1) ```
2013-07-09I forgot the changes to the docs as wellJens Nockert-10/+7
Apparently yesterday wasn't my day, and I forgot to add the changes to all the tests apparently, and in the end forgot the docs extra much. Please documentation, forgive me, I really do love you, I hope you forgive me. Next time we'll meet tutorial, I promise to bring cookies and tea. I really want to be best-friends-forever with you, <3. XOXO
2013-07-03auto merge of #7523 : huonw/rust/uppercase-statics-lint, r=cmrbors-2/+2
Adds a lint for `static some_lowercase_name: uint = 1;`. Warning by default since it causes confusion, e.g. `static a: uint = 1; ... let a = 2;` => `error: only refutable patterns allowed here`.
2013-07-02doc: Update links to 0.7 release-0.7 0.7Brian Anderson-5/+5
2013-07-01rustc: add a lint to enforce uppercase statics.Huon Wilson-2/+2
2013-06-28librustc: Remove the broken overloaded assign-ops from the language.Patrick Walton-2/+2
They evaluated the receiver twice. They should be added back with `AddAssign`, `SubAssign`, etc., traits.
2013-06-28add a tutorial on containers and iteratorsDaniel Micay-126/+1
2013-06-25auto merge of #7269 : luqmana/rust/drop, r=thestingerbors-3/+3
Finally rename finalize to drop. Closes #4332.
2013-06-25Change finalize -> drop.Luqman Aden-3/+3
2013-06-25remove `each` from vec, HashMap and HashSetDaniel Micay-13/+44
2013-06-23vec: remove BaseIter implementationDaniel Micay-4/+4
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
2013-06-21Minor doc updates to reflect #[deriving(Zero)], and small release notes ↵Huon Wilson-1/+1
adjustments. The `extra::fileinput` module landed just after 0.6 was released, and there are many more derivable traits.
2013-06-21fix text of tutorialsJoris Rehm-5/+5
2013-06-16Correct tutorial testsNiko Matsakis-3/+5
2013-06-16fix benchmark and the tutorialsDaniel Micay-7/+2
2013-06-12std: remove substr & str::count_*, methodise char_len, implement slice_chars.Huon Wilson-1/+1
The confusing mixture of byte index and character count meant that every use of .substr was incorrect; replaced by slice_chars which only uses character indices. The old behaviour of `.substr(start, n)` can be emulated via `.slice_from(start).slice_chars(0, n)`.
2013-06-08remove deprecated vec::{is_empty, len} functionsDaniel Micay-1/+1
2013-06-07auto merge of #7003 : alco/rust/tutorial-block-expr, r=bstriebors-4/+9
This is something that's only been briefly mentioned in the beginning of the tutorial and all of the closure examples within this subsection include only one expression between { and }.
2013-06-08A reminder that a block is a single expr in closuresAlexei Sholik-4/+9
This is something that's only been briefly mentioned in the beginning of the tutorial and all of the closure examples within this subsection include only one expression between { and }.
2013-06-08Mention `for` in the section on loopsAlexei Sholik-2/+5
The "4.3 Loops" section only describes `while` and `loop`. We then see `for` used in a code sample at the end of the "13. Vectors and strings" section, but it's explained for the first time only in the next section -- "14. Closures". It is worth mentioning it in "4.3 Loops".
2013-06-06tutorial: fix for-loop exampleRamkumar Ramachandra-4/+5
Although in the example function `each` works as expected with rust-0.6 (the latest release), it fails to even compile with `incoming` rust (see test/compile-fail/bad-for-loop-2.rs). Change the function to return a `bool` instead of `()`: this works fine with both versions of rust, and does not misguide potential contributors. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-0/+5
2013-05-23Fix some std/extra language in the tutorialErick Tryzelaar-6/+5
2013-05-23more testing fallout from core->std/std->extra moveTed Horst-58/+58
2013-05-18replace old_iter::repeat with the Times traitDaniel Micay-1/+1
2013-05-16syntax: implement #[deriving(DeepClone)]. Fixes #6514.Huon Wilson-2/+2
2013-05-14Replace shared/unique by managed/owned in the tutorialYoungsoo Son-1/+1
2013-05-13doc: document the #[deriving] attribute.Huon Wilson-0/+21
Closes #4916.
2013-05-10Replace io::println by println as it is now included in prelude.rsOlivier Saut-31/+27
2013-05-03add gitattributes and fix whitespace issuesDaniel Micay-4/+4