summary refs log tree commit diff
path: root/doc/rust.md
AgeCommit message (Collapse)AuthorLines
2013-04-01docs: Xfail test, it's just for illustration anywayTim Chevalier-2/+2
2013-04-01docs: Document language items, as per #3342Tim Chevalier-1/+99
2013-03-29librustc: Remove `fail_unless!`Patrick Walton-4/+4
2013-03-29auto merge of #5583 : jbclements/rust/docfix-for-block-comment-grammar, ↵bors-4/+4
r=jbclements ... by adding Kleene '+' in two places, and changing a "non-slash" into "non_slash_or_star". Closes #1588
2013-03-28added defn of non_slash_or_starJohn Clements-2/+2
2013-03-28fix another subtle bug in comment regexJohn Clements-2/+2
2013-03-27fixes stated grammar for block comments, by adding Kleene '+' in two places.John Clements-2/+2
Closes #1588
2013-03-26test: Fix testsPatrick Walton-3/+3
2013-03-26librustc: Modify all code to use new lifetime binder syntaxPatrick Walton-1/+1
2013-03-26doc: Remove mentions of oldmap::HashMapAlex Crichton-3/+3
2013-03-26Updated to reflect alpha-rename of constant/static items section.Felix S. Klock II-4/+2
2013-03-26Miscellaneous documentation additions.Felix S. Klock II-1/+33
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-25docs: update to avoid mention of const.Graydon Hoare-15/+17
2013-03-22libcore: Fix obsolete syntax in extfmtPatrick Walton-10/+10
2013-03-22docs: Copyedit my randomly assigned sections of the manualTim Chevalier-132/+143
2013-03-18librustc: Make the compiler ignore purity.Patrick Walton-41/+4
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-13test: Fix tests. rs=testsPatrick Walton-19/+19
2013-03-13librustc: Don't accept `as Trait` anymore; fix all occurrences of it.Patrick Walton-1/+1
2013-03-11Remove uses of logBrian Anderson-63/+10
2013-03-11librustc: Lint the old `drop` destructor notation offPatrick Walton-6/+6
2013-03-07librustc: Convert all uses of `assert` over to `fail_unless!`Patrick Walton-16/+5
2013-03-06Add manual &self/ and &static/ and /&self declarations thatNiko Matsakis-9/+10
are currently inferred. New rules are coming that will require them to be explicit. All add some explicit self declarations.
2013-03-02librustc: Forbid chained imports and fix the logic for one-level renaming ↵Patrick Walton-1/+1
imports
2013-03-02auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakisbors-95/+14
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-02auto merge of #5188 : ben0x539/rust/doc-call-generic-fn, r=catamorphismbors-1/+8
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-02Remove REC, change related tests/docsJihyun Yu-95/+14
2013-03-02doc/rust.md: Demonstrate the `f::<T>()` syntax more oftenBenjamin Herr-1/+8
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-02docs/rust.md: Mention unit-like structs along with other struct typesBenjamin Herr-3/+21
2013-02-27auto merge of #5106 : pnkfelix/rust/fix-docs, r=graydonbors-1/+1
...s. I freely admit I have not run a "make check" on this (trivial) change.
2013-02-26Fix unused imports in the tutorialsAlex Crichton-1/+0
2013-02-26doc: Remove references to mut fields. rs=demutingPatrick Walton-2/+2
2013-02-25Fix typo in grammar: underscore, not minus, can appear amongst hex digits.Felix S. Klock II-1/+1
2013-02-19auto merge of #5029 : mcpherrinm/rust/master, r=catamorphismbors-0/+1
Added a newline to make header be a header. (re-did pull request because I screwed up the last one)
2013-02-18Missing newline causing title to not be a titleMatthew McPherrin-0/+1
2013-02-18Fixed a typo in the documentation that points to the wrong macro ↵Armin Ronacher-1/+1
(ident_to_str -> stringify)
2013-02-15tests/tutorials: Get rid of `move`.Luqman Aden-1/+1
2013-02-14remove die definition and use in doc testsNick Desaulniers-9/+9
2013-02-13update tutorial and manual to use new `impl Trait for Type` syntaxChris Peterson-12/+12
2013-02-13removed reference to crate file keywordsJohn Clements-7/+1
2013-02-04Merge remote-tracking branch 'bstrie/rimov' into incomingBrian Anderson-9/+5
Conflicts: src/libsyntax/parse/parser.rs src/test/bench/graph500-bfs.rs src/test/bench/sudoku.rs src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs src/test/run-pass/empty-mutable-vec.rs src/test/run-pass/foreach-nested.rs src/test/run-pass/swap-2.rs
2013-02-03Merge remote-tracking branch 'thestinger/old_map' into incomingBrian Anderson-2/+2
Conflicts: src/test/bench/core-map.rs
2013-02-03Fixed `fmt!`, tests, doc-tests.Marvin Löbel-4/+4
2013-02-03rename map -> oldmap and mark it as deprecatedDaniel Micay-2/+2
LinearMap is quite a bit faster, and is fully owned/sendable without requiring copies. The older std::map also doesn't use explicit self and relies on mutable fields.
2013-02-01Merge remote-tracking branch 'nickdesaulniers/issue4524' into nocomm1Brian Anderson-25/+12
2013-02-01Remove fail keyword from lexer & parser and clean up remaining calls toNick Desaulniers-25/+12
fail Fix merge conflicts - Issue 4524
2013-01-31test cases, cleanupJohn Clements-0/+3
2013-01-31Finalize moves-based-on-type implementation.Niko Matsakis-1/+1
Changes: - Refactor move mode computation - Removes move mode arguments, unary move, capture clauses (though they still parse for backwards compatibility) - Simplify how moves are handled in trans - Fix a number of illegal copies that cropped up - Workaround for bug involving def-ids in params (see details below) Future work (I'll open bugs for these...): - Improve error messages for moves that are due to bindings - Add support for moving owned content like a.b.c to borrow check, test in trans (but I think it'll "just work") - Proper fix for def-ids in params Def ids in params: Move captures into a map instead of recomputing. This is a workaround for a larger bug having to do with the def-ids associated with ty_params, which are not always properly preserved when inlining. I am not sure of my preferred fix for the larger bug yet. This current fix removes the only code in trans that I know of which relies on ty_param def-ids, but feels fragile.
2013-01-31Repair RIMOV damage to doc testsBen Striegel-5/+4
2013-01-30RIMOV, round 11Ben Striegel-9/+6
Last bit of mut removal, manually cleaning up outliers
2013-01-25doc typoJohn Clements-1/+1