about summary refs log tree commit diff
path: root/src/doc/guide-lifetimes.md
AgeCommit message (Collapse)AuthorLines
2014-11-26Lifetime guide -> ownership guideSteve Klabnik-565/+0
2014-11-17Switch to purely namespaced enumsSteven Fackler-10/+10
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-0/+1
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-10-28Guide: Fix use of sqrt() in exampleDaniel Hofstetter-1/+1
2014-10-02I am bad at mathSteve Klabnik-1/+1
2014-10-01:fire: τSteve Klabnik-6/+2
Fixes #17674
2014-07-31Remove incorrect exampleSteve Klabnik-30/+0
This now works because of elision. Fixes #16117
2014-07-25fix small typo in guide-lifetimesMichael Matuzak-1/+1
2014-07-17librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,Patrick Walton-5/+4
except where trait objects are involved. Part of issue #15349, though I'm leaving it open for trait objects. Cross borrowing for trait objects remains because it is needed until we have DST. This will break code like: fn foo(x: &int) { ... } let a = box 3i; foo(a); Change this code to: fn foo(x: &int) { ... } let a = box 3i; foo(&*a); [breaking-change]
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-1/+1
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-12auto merge of #14809 : zzmp/rust/patch-2, r=alexcrichtonbors-2/+4
Previously, the type system's restrictions on borrowing were summarized as > The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory. This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read > The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one. This adds more general information for the experienced reader as well, to offer a more complete understanding.
2014-06-10Update description to reflect language changesZach Pomerantz-2/+4
Previously, the type system's restrictions on borrowing were summarized as > The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read > The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one. This adds more general information for the experienced reader as well, to offer a more complete understanding.
2014-06-10Removed doubled wording.Zach Pomerantz-1/+1
The guide previously stated: > The compiler will automatically convert a box box point to a reference like &amp;point. This fixes the doubled word `box`, so the statement reads > The compiler will automatically convert a box point to a reference like &amp;point. The code it is referring to is `compute_distance(&on_the_stack, on_the_heap);`, so a single `box` is appropriate.
2014-06-04Fixed weird grammar in lifetimes guide.Jonathan Reem-3/+3
2014-06-02docs: Stop using `notrust`Florian Gilcher-4/+4
Now that rustdoc understands proper language tags as the code not being Rust, we can tag everything properly. This change tags examples in other languages by their language. Plain notations are marked as `text`. Console examples are marked as `console`. Also fix markdown.rs to not highlight non-rust code.
2014-05-31Fix example in lifetime guideChristoph Burgdorf-4/+5
This rewrites the example to also be more aligned with the same example given in the main tutorial.
2014-05-24fix mostly grammar per PR commentsAlan Andrade-20/+18
2014-05-24get over bold text madness, changes per PR, brought the "returning pointers" ↵Alan Andrade-16/+14
section back to pointers guide
2014-05-23Cleanup lifetime guideAlan Andrade-156/+69
Clean pointers guide
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-35/+35
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-01Fix a/an typosJorge Aparicio-2/+2
2014-04-21auto merge of #13587 : adrientetar/rust/more-docs, r=brsonbors-2/+2
- Use Fira Sans for headlines, Heuristica for the body (Adobe Utopia derivative). Both are licensed under the SIL OFL license. (I didn't include BoldItalic because it is sparingly used.) - Split TOC into 2 columns for the docs except manual (too tall, too wide to be readable). - Some fixes to rustdoc, bring styles in coherency with eachother - A few tweaks Two examples: [modified tutorial](http://adrientetar.legtux.org/cached/rust-docs/tutorial.htm) and [modified manual](http://adrientetar.legtux.org/cached/rust-docs/manual.htm). Rustdoc got some fixes, here is [modified `enum.FileType`](http://adrientetar.legtux.org/cached/rust-docs/enum.FileType.htm), [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm). #13484, #13485 follow-up. cc @brson
2014-04-20Fix spelling mistakes in documentation and code.Joseph Crail-1/+1
2014-04-19doc: add webfonts and tweak the styles accordinglyAdrien Tétar-2/+2
2014-03-24Added suggested notesnoam-2/+7
* Note on while loop not supporting named breaks. * Note on hygienic macros (and example of such within loops)
2014-03-23docs: named lifetimesnoam-3/+22
* Include tip given by Leo Testard in mailing list about labeled `break` and `continue`: https://mail.mozilla.org/pipermail/rust-dev/2014-March/009145.html * cross-reference named lifetimes in tutorial -> lifetimes guide * Broke named lifetimes section into two sub-sections. * Added mention of `'static` lifetime.
2014-03-09docs: adjust code blocks to pass with rustdoc.Huon Wilson-4/+4
The changes are basically just because rustdoc runs tests/rendering on more snippets by default (i.e. everything without a `notrust` tag), and not anything significant.
2014-02-02Move doc/ to src/doc/Alex Crichton-0/+663
We generate documentation into the doc/ directory, so we shouldn't be intermingling source files with generated files