about summary refs log tree commit diff
path: root/src/doc/guide.md
AgeCommit message (Collapse)AuthorLines
2014-11-10Rogue 'panic' -> 'fail' in guide.Jeff Parsons-1/+1
Should refer to handling panicking tasks like any other computation that may _fail_, not any other computation that may _panic_.
2014-11-08Reword &str coercion into viewingmdinger-2/+2
2014-11-06rollup merge of #18708 : qwitwa/masterAlex Crichton-2/+2
2014-11-0614.3 - helpfully implied code sample is brokenqwitwa-2/+2
As a new user, I spent a while confused when flycheck told me the code sample I'd typed in was invalid. I ended up figuring out some of what comes after the code sample more painfully by myself because there was no indication that it was broken in the text beforehand. This one line change makes it clear that the code following it is an experiment that may not work rather than something to assume just works.
2014-11-06Update guide.mdtshakah-1/+1
Corrected singular/plural reference to enums
2014-11-05Update the guide examples and try not to leave user hanging as to whatNiko Matsakis-3/+7
this `&x` sigil is all about.
2014-11-04auto merge of #18338 : chastell/rust/guide_pointer_fixes, r=alexcrichtonbors-8/+8
This removes some leftover line-numbering cruft from elided error examples and brings some minor clarifications. I’m not super happy about the ‘we cannot have two mutable pointers that point to the same memory’ wording (to the best of my understanding we can’t even have one mutable and one immutable), but other attempts to word this were derailing the flow a bit too much.
2014-11-04Guide: drop line-number cruft from elided error examplesPiotr Szotkowski-5/+5
2014-11-04Guide: minor clarifications for the Pointers partPiotr Szotkowski-3/+3
2014-11-04auto merge of #18497 : gamazeps/rust/enumsmatch, r=steveklabnikbors-21/+50
Closes #18169
2014-11-04Guide: explains the enum/match relationshipgamazeps-21/+50
Closes #18169
2014-11-03rollup merge of #18355 : chastell/guide_iterators_macros_unsafe_fixesAlex Crichton-20/+21
2014-11-02Convert some notes to help messagesP1start-1/+1
Closes #18126.
2014-10-30auto merge of #18339 : chastell/rust/guide_pattern_fixes, r=nikomatsakisbors-8/+8
I think it helps to show that the variables introduced in match blocks are indeed independent from the matched variable `x` (especially when `x` is still reachable inside those blocks and might be useful), so this renames them accordingly. Maybe some linter (or language-level warning?) will eventually warn about shadowing `x` in such cases. ;) I’m not super happy about the matching-on-range example, as it’s too contrived (`e` and `x` are exactly the same here), but I couldn’t come up with something both simple and non-redundant.
2014-10-30auto merge of #18377 : steveklabnik/rust/fix_wording_about_errors, ↵bors-2/+2
r=nikomatsakis see https://github.com/rust-lang/rust/pull/18176#discussion_r19374679 /cc @eddyb @huonw @nikomatsakis
2014-10-29Rename fail! to panic!Steve Klabnik-8/+8
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-29auto merge of #18340 : chastell/rust/guide_closures_fixes, r=steveklabnikbors-12/+12
Some minor wording fixes to the Closures chapter; my brain tripped a few times when reading it, so I tried to come up with something a bit smoother. I’m not a native speaker, so please do review this critically.
2014-10-28Guide: Iterators: …are always lazy + rewrap as per requestPiotr Szotkowski-5/+6
2014-10-28auto merge of #18273 : gamazeps/rust/issue18218, r=steveklabnikbors-3/+4
Closes #18218
2014-10-27rollup merge of #18347 : cakebaker/ffiAlex Crichton-3/+3
2014-10-27rollup merge of #18321 : chastell/guide_refresh_testing_outputAlex Crichton-58/+75
2014-10-27rollup merge of #18320 : chastell/guide_simplify_formattingAlex Crichton-7/+7
2014-10-27rollup merge of #18309 : cakebaker/fix_off_by_oneAlex Crichton-1/+1
2014-10-27rollup merge of #18231 : cakebaker/fix_greater_than_forty_two_closureAlex Crichton-1/+1
2014-10-27Fix some wording about errorsSteve Klabnik-2/+2
see https://github.com/rust-lang/rust/pull/18176#discussion_r19374679
2014-10-26Guide: motivate Box and Rc pointers with need, uses, benefits, and examples.John Kleint-44/+78
Explain that Rust has different pointer types because there is a tradeoff between flexibility and efficiency. Motivate boxes as fixed-size containers of variable-sized objects. Clarify that Box and Rc are pointer types that you deref with * just like references. Stick to explaining the semantics and avoid implementation details. Scope isn't the most accurate framework to think about deallocation (since you return boxes and otherwise move values out of scopes); it's more "when the value is done being used," i.e., lifetime. Provide a connection between Rust's pointer types by locating them on a flexibiltiy / performance scale. Explain the compiler can't statically analyze lifetimes with multiple owners; hence the need for (runtime) reference counting.
2014-10-26Guide: Iterators, Macros and Unsafe wording fixesPiotr Szotkowski-16/+16
2014-10-26Guide: Closures fix suggested by @cakebakerPiotr Szotkowski-1/+1
2014-10-26Guide: Add link to FFI explanationDaniel Hofstetter-3/+3
2014-10-26Guide: Closures: minor wording fixesPiotr Szotkowski-12/+12
2014-10-26Guide: Patterns: use non-x variables in match blocksPiotr Szotkowski-8/+8
2014-10-25Guide: update Testing output and fix contents to matchPiotr Szotkowski-49/+66
2014-10-25Guide: Cargo now adds bang and drops the semicolon for ‘Hello, world’Piotr Szotkowski-9/+9
2014-10-25Guide: drop :d formatting where unnecessaryPiotr Szotkowski-7/+7
2014-10-25Guide: Fix off-by-one errorDaniel Hofstetter-1/+1
2014-10-25auto merge of #18176 : jkleint/rust/guide-borrow-wording, r=steveklabnikbors-15/+18
Explain the primary disadvantage of garbage collection is runtime overhead and unpredictable pauses. Elucidate where the name "race condition" comes from. Emphasize that Rust can guarantee your code is free of race conditions and other memory errors, with no runtime overhead. cc @steveklabnik
2014-10-24Changes a little the description of take in the guidegamazeps-3/+4
Closes #18218
2014-10-24Add a lint for not using field pattern shorthandsP1start-0/+3
Closes #17792.
2014-10-22Guide: Change >= to > in closureDaniel Hofstetter-1/+1
2014-10-22Guide: Adapt range values to variable nameDaniel Hofstetter-2/+2
2014-10-21Guide: articulate the advantages of ownership over garbage collection.John Kleint-15/+18
Explain the primary disadvantage of garbage collection is runtime overhead and unpredictable pauses. Elucidate where the name "race condition" comes from. Emphasize that Rust can guarantee your code is free of race conditions and other memory errors, with no runtime overhead.
2014-10-20auto merge of #18186 : cakebaker/rust/fix_test_count, r=alexcrichtonbors-2/+2
2014-10-20Guide: Fix test countDaniel Hofstetter-2/+2
2014-10-20Guide: Fix typo in pathDaniel Hofstetter-4/+4
2014-10-19auto merge of #18139 : JelteF/rust-1/patch-1, r=steveklabnikbors-2/+2
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
2014-10-19auto merge of #18135 : EduardoBautista/rust/fix-misaligned-carot, r=steveklabnikbors-1/+1
2014-10-18Fix fold explanation in the guideJelte Fennema-2/+2
The explanation of fold talks about three elements that should be summed, but it uses different values in the provided code.
2014-10-18Fix misaligned carot in guideEduardo Bautista-1/+1
2014-10-17Use match expression directly in guide.mdjrincayc-8/+6
Use a match expression directly in the println statement, instead of creating a second variable.
2014-10-14Guide: develop the exposition of arrays, vectors, and slices.John Kleint-50/+65
The array is the fundamental concept; vectors are growable arrays, and slices are views into either. Show common array ops up front: length and iteration. Mention arrays are immutable by default. Highlight definite initialization and bounds-checking as safety features. Show that you only need a type suffix on one element of initializers. Explain that vectors are a value-add library type over arrays, not a fundamental type; show they have the same "interface." Motivate slices as efficient views into arrays; explain you can slice vectors, Strings, &str because they're backed by arrays.