Commit Graph

494 Commits

Author SHA1 Message Date
Anton Löfgren
5ca437078b guide-runtime.md: Fix a typo 2014-05-25 21:11:54 +02:00
bors
489f470886 auto merge of #14370 : cmr/rust/design-faq, r=brson
This indends to help quell frequently answered questions about the language
design in a single, authoritative place.
2014-05-25 03:01:20 -07:00
Corey Richardson
11c0f77107 doc: add a new language design faq
This indends to help quell frequently answered questions about the language
design in a single, authoritative place.
2014-05-25 02:53:53 -07:00
Alex Crichton
bd339ced36 doc: Document the new #[doc(no_inline)] attribute 2014-05-25 01:18:37 -07:00
Richo Healey
553074506e core: rename strbuf::StrBuf to string::String
[breaking-change]
2014-05-24 21:48:10 -07:00
Alan Andrade
0cae849595 fix mostly grammar per PR comments 2014-05-24 17:08:00 -07:00
Steven Fackler
864c5016ae Get "make check" to work with unused-attribute
There's a fair number of attributes that have to be whitelisted since
they're either looked for by rustdoc, in trans, or as needed. These can
be cleaned up in the future.
2014-05-24 16:49:46 -07:00
Alan Andrade
99744653d5 get over bold text madness, changes per PR, brought the "returning pointers" section back to pointers guide 2014-05-24 13:15:48 -07:00
Alan Andrade
64dad2cb03 Cleanup lifetime guide
Clean pointers guide
2014-05-23 18:52:06 -07:00
bors
33c3eddd11 auto merge of #14362 : zecozephyr/rust/docfixes, r=cmr
extra::arc -> alloc::arc
2014-05-23 00:31:27 -07:00
bors
a0960a1223 auto merge of #14348 : alexcrichton/rust/doc.rust-lang.org, r=huonw 2014-05-22 16:56:23 -07:00
Alex Crichton
711f531b65 doc: Touch up the unsafe guide
* Change ~ references to Box
* Rewrite examples so they can be compiled an run
* Mention libcore
* Update wording about compiler-required functions
2014-05-22 15:14:23 -07:00
Patrick Walton
e878721d70 libcore: Remove all uses of ~str from libcore.
[breaking-change]
2014-05-22 14:42:02 -07:00
Jonathan Bailey
12240e5b9e Fixed incorrect module path
extra::arc -> sync::arc
2014-05-22 13:46:52 -07:00
Richo Healey
e5d883101c docs: Add win64 calling convention 2014-05-22 00:05:56 -07:00
Alex Crichton
799ddba8da Change static.rust-lang.org to doc.rust-lang.org
The new documentation site has shorter urls, gzip'd content, and index.html
redirecting functionality.
2014-05-21 19:55:39 -07:00
bors
1edb0e5364 auto merge of #14324 : zecozephyr/rust/docfix, r=luqmana 2014-05-21 06:21:25 -07:00
Jonathan Bailey
e549601bc8 Updated doc with correct type. 2014-05-21 02:48:23 -07:00
bors
4afc15e30c auto merge of #14259 : alexcrichton/rust/core-mem, r=brson
Excluding the functions inherited from the cast module last week (with marked
stability levels), these functions received the following treatment.

* size_of - this method has become #[stable]
* nonzero_size_of/nonzero_size_of_val - these methods have been removed
* min_align_of - this method is now #[stable]
* pref_align_of - this method has been renamed without the
  `pref_` prefix, and it is the "default alignment" now. This decision is in line
  with what clang does (see url linked in comment on function). This function
  is now #[stable].
* init - renamed to zeroed and marked #[stable]
* uninit - marked #[stable]
* move_val_init - renamed to overwrite and marked #[stable]
* {from,to}_{be,le}{16,32,64} - all functions marked #[stable]
* swap/replace/drop - marked #[stable]
* size_of_val/min_align_of_val/align_of_val - these functions are marked
  #[unstable], but will continue to exist in some form. Concerns have been
  raised about their `_val` prefix.
2014-05-20 23:31:30 -07:00
Alex Crichton
19dc3b50bd core: Stabilize the mem module
Excluding the functions inherited from the cast module last week (with marked
stability levels), these functions received the following treatment.

* size_of - this method has become #[stable]
* nonzero_size_of/nonzero_size_of_val - these methods have been removed
* min_align_of - this method is now #[stable]
* pref_align_of - this method has been renamed without the
  `pref_` prefix, and it is the "default alignment" now. This decision is in line
  with what clang does (see url linked in comment on function). This function
  is now #[stable].
* init - renamed to zeroed and marked #[stable]
* uninit - marked #[stable]
* move_val_init - renamed to overwrite and marked #[stable]
* {from,to}_{be,le}{16,32,64} - all functions marked #[stable]
* swap/replace/drop - marked #[stable]
* size_of_val/min_align_of_val/align_of_val - these functions are marked
  #[unstable], but will continue to exist in some form. Concerns have been
  raised about their `_val` prefix.

[breaking-change]
2014-05-20 23:06:54 -07:00
bors
84320a4f4b auto merge of #14277 : pczarn/rust/manual-grammar, r=alexcrichton
The grammar for use declarations was outdated. Corrected some other mistakes.
2014-05-20 10:11:20 -07:00
Piotr Czarnecki
6674913c02 Correct EBNF grammar in the manual
The grammar for use declarations was outdated.
2014-05-20 15:50:03 +02:00
Piotr Jawniak
cea63ecfb1 Minor doc fixes in various places 2014-05-19 15:41:06 +02:00
bors
20b502b241 auto merge of #14247 : Ryman/rust/minor_ptr_nit, r=alexcrichton
Not too hot on the second change, welcome a better suggestion/wording.
2014-05-17 02:41:20 -07:00
Patrick Walton
b84c0dc2d6 doc: Remove all uses of ~str from the documentation. 2014-05-16 11:41:27 -07:00
Kevin Butler
6bfe361de2 guide-pointers: minor nits 2014-05-16 15:40:21 +01:00
bors
d92926ca3b auto merge of #14235 : Ryman/rust/simplify_arcs_doc, r=alexcrichton 2014-05-16 01:06:25 -07:00
bors
84406d438c auto merge of #14213 : kballard/rust/str_from_utf8_result, r=cmr
Change `str::from_utf8_owned()` and `StrBuf::from_utf8()` to return `Result`.

This allows the vector to be recovered when it contains invalid UTF-8.
2014-05-15 21:41:29 -07:00
Kevin Butler
5f4de7197f guide-tasks: Simplify Arc usage to match Arc docs. 2014-05-16 02:32:35 +01:00
Alex Crichton
a7bee7b05d Add a crate for missing stubs from libcore
The core library in theory has 0 dependencies, but in practice it has some in
order for it to be efficient. These dependencies are in the form of the basic
memory operations provided by libc traditionally, such as memset, memcmp, etc.
These functions are trivial to implement and themselves have 0 dependencies.

This commit adds a new crate, librlibc, which will serve the purpose of
providing these dependencies. The crate is never linked to by default, but is
available to be linked to by downstream consumers. Normally these functions are
provided by the system libc, but in other freestanding contexts a libc may not
be available. In these cases, librlibc will suffice for enabling execution with
libcore.

cc #10116
2014-05-15 13:50:37 -07:00
Huon Wilson
19f9181654 test: allow the test filter to be a regex.
This is fully backwards compatible, since test names are Rust
identifiers + `:`, and hence not special regex characters.

Fixes #2866.
2014-05-15 23:04:09 +10:00
Kevin Ballard
d0f3cb05df Change str::from_utf8_owned() to return Result
This allows the original vector to be recovered in the event that it is
not valid UTF-8.

[breaking-change]
2014-05-14 17:35:55 -07:00
Zooko Wilcox-O'Hearn
0004953c3a add a line to the example to clarify semantics
This is to clarify that match construct doesn't define a new variable, since I
observed a person reading the Rust tutorial who seemed to incorrectly think
that it did. Fixes https://github.com/mozilla/rust/issues/13571 .
2014-05-13 17:24:08 -07:00
Richo Healey
ef23fa17c3 docs: Add a not found page 2014-05-13 17:24:07 -07:00
Adolfo Ochagavía
a390b5dd03 Replaced ~T by Box<T> in manual 2014-05-13 17:24:07 -07:00
Derek Chiang (Enchi Jiang)
5518071019 Remove reference to MutexArc 2014-05-12 19:52:29 -07:00
Alex Crichton
e798b97ce9 doc: Update the linkage documentation
After allowing mixing rlibs and dylibs in #13892, the documentation was not
updated accordingly to reflect this new capability.
2014-05-12 19:52:29 -07:00
Piotr Jawniak
06ea9893d5 doc: updates rust manual (loop to continue)
Keyword for continue expressions was changed from loop to continue, but the
manual was not updated.
2014-05-12 19:52:29 -07:00
Brian Anderson
c1da4f875f Add the patch number to version strings. Closes #13289 2014-05-12 19:52:29 -07:00
bors
f483aa3a91 auto merge of #14102 : moonglum/rust/slice-clarification-in-readme, r=kballard
There are no arrays in Rust, they are slices. Especially in the tutorial beginners should not be confused with wrong terminology. It helps to know the right names for things when you want to find something in the documentation.

@erickt explained that today to me and it helped me a lot when getting started 😉 Maybe we should also explain what a slice and what a vector is in the tutorial. If you like that, I will try to do that and attach that to the pull request 😉
2014-05-11 14:51:46 -07:00
bors
032510bae2 auto merge of #14103 : alan-andrade/rust/manual-smallfix, r=alexcrichton
Hi,

I believe the word "managed" doesn't make sense here anymore. It's just a box.
2014-05-11 08:01:43 -07:00
Alex Crichton
f94d671bfa core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.

* transmute - This function was moved to `mem`, but it is now marked as
              #[unstable]. This is due to planned changes to the `transmute`
              function and how it can be invoked (see the #[unstable] comment).
              For more information, see RFC 5 and #12898

* transmute_copy - This function was moved to `mem`, with clarification that is
                   is not an error to invoke it with T/U that are different
                   sizes, but rather that it is strongly discouraged. This
                   function is now #[stable]

* forget - This function was moved to `mem` and marked #[stable]

* bump_box_refcount - This function was removed due to the deprecation of
                      managed boxes as well as its questionable utility.

* transmute_mut - This function was previously deprecated, and removed as part
                  of this commit.

* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
                         can be achieved with an `as` in safe code, so it was
                         removed.

* transmute_lifetime - This function was removed because it is likely a strong
                       indication that code is incorrect in the first place.

* transmute_mut_lifetime - This function was removed for the same reasons as
                           `transmute_lifetime`

* copy_lifetime - This function was moved to `mem`, but it is marked
                  `#[unstable]` now due to the likelihood of being removed in
                  the future if it is found to not be very useful.

* copy_mut_lifetime - This function was also moved to `mem`, but had the same
                      treatment as `copy_lifetime`.

* copy_lifetime_vec - This function was removed because it is not used today,
                      and its existence is not necessary with DST
                      (copy_lifetime will suffice).

In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.

    transmute - #[unstable]
    transmute_copy - #[stable]
    forget - #[stable]
    copy_lifetime - #[unstable]
    copy_mut_lifetime - #[unstable]

[breaking-change]
2014-05-11 01:13:02 -07:00
moonglum
1895ad269c Clarification of Slice, Vector and Array
Especially in the tutorial beginners should not be confused with
wrong terminology. It helps to know the right names for things
when you want to find something in the documentation.
2014-05-10 18:02:02 -07:00
Alan Andrade
4e1f239721 remove the word managed from the trait explanation 2014-05-10 17:30:59 -07:00
bors
e850316408 auto merge of #14068 : alexcrichton/rust/rustdoc-xcrate-links, r=brson
This should improve the libcore experience quite a bit when looking at the
libstd documentation.
2014-05-10 03:36:30 -07:00
Alex Crichton
620b4352f2 doc: Fix some broken links 2014-05-09 14:42:12 -07:00
bors
65205652b8 auto merge of #14043 : sanxiyn/rust/attr-reference, r=alexcrichton
Attribute grammar in reference manual allowed `#[foo, bar]`, which does not match parser behavior.

Also rename nonterminals to match parser code.

Fix #13825.
2014-05-09 04:36:33 -07:00
Kevin Ballard
9fb8741b2e Handle breakage after libcore split
API Changes:

- &[T] and ~[T] no longer support the addition operator (+)
2014-05-08 12:08:01 -07:00
Kevin Ballard
eab6bb2ece Handle fallout in documentation
Tweak the tutorial's section on vectors and strings, to slightly clarify
the difference between fixed-size vectors, vectors, and slices.
2014-05-08 12:06:22 -07:00
Seo Sanghyeon
a4b7b8df40 Correct attribute grammar in reference manual 2014-05-09 01:45:44 +09:00
bors
574cbe5b07 auto merge of #13986 : alexcrichton/rust/box-keyword, r=thestinger
This keyword is about to be used much more often than it was a few weeks ago,
it's time to tell editors about the new keyword.
2014-05-08 03:06:37 -07:00
Alex Crichton
07caa22450 Test fixes and rebase conflicts 2014-05-07 11:03:12 -07:00
bors
ef6daf9935 auto merge of #13958 : pcwalton/rust/detilde, r=pcwalton
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.

r? @brson or @alexcrichton or whoever
2014-05-07 05:16:48 -07:00
bors
4a5d39001b auto merge of #13914 : alexcrichton/rust/pile-o-rustdoc-fixes, r=brson
Lots of assorted things here and there, all the details are in the commits.

Closes #11712
2014-05-07 03:21:47 -07:00
Patrick Walton
090040bf40 librustc: Remove ~EXPR, ~TYPE, and ~PAT from the language, except
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-06 23:12:54 -07:00
bors
df621acf5f auto merge of #13960 : brandonw/rust/master, r=alexcrichton
Update the example to make the usage of `pub mod foo;` much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.
2014-05-06 15:06:52 -07:00
Alex Crichton
948526134b etc: Add box as a keyword to editor configs
This keyword is about to be used much more often than it was a few weeks ago,
it's time to tell editors about the new keyword.
2014-05-06 10:49:35 -07:00
Brandon Waskiewicz
949143e17a Update multiple file use statement example
Update the example to make the usage of `pub mod foo;` much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.
2014-05-06 11:11:52 -04:00
bors
5c16cf975d auto merge of #13939 : richo/rust/docs/composability, r=thestinger
While there are various references to the work compositionality on the web, I can't find any reference to it being an actual word. My understanding is that composability is what's actually meant here anyway.
2014-05-05 22:46:35 -07:00
bors
a1ca57237b auto merge of #13946 : pnkfelix/rust/fsk-cleanup-proc-comment-in-guide-tasks, r=alexcrichton
Followup to some recent feedback in PR #13676.
2014-05-05 19:56:33 -07:00
Mike Boutin
055cbdeee0 doc: Corrected example in 17.8 Deriving implementations for traits
Corrected example to to use Rand trait referenced in preceding
description and included an example using the Show trait to print ABC.
2014-05-05 11:25:16 -04:00
Mike Boutin
e65aea522c doc: Minor example formatting in 11 References 2014-05-05 11:24:00 -04:00
Mike Boutin
81bc32d975 doc: Clarified 4.2 Pattern matching
Combined redundant paragraphs about the match expression and removed a
redundant example.
2014-05-05 11:24:00 -04:00
Felix S. Klock II
0fb1f3fd38 Cleanup proc comment in guide-tasks.md. 2014-05-05 13:24:54 +02:00
bors
8895f25241 auto merge of #13942 : JamesLaverack/rust/master, r=luqmana
Version changed due to a newer requirement in LLVM.
2014-05-05 03:06:37 -07:00
bors
3179cd50ae auto merge of #13924 : gmjosack/rust/master, r=alexcrichton
Most of the links I've removed are for types that don't exist anymore with the exception of `SendReceiver` though I'm not sure how useful it is to link to that without the accompanying `Receiver` and `Sender` and I don't know how useful those links are when they're discussed below and `channel`/`sync_channel` is on the `std::comm` page already linked.
2014-05-04 20:51:43 -07:00
James Laverack
72f478f0e8 Update minimum g++ version in documentation
Version changed due to a newer requirement in LLVM.
2014-05-05 03:03:00 +01:00
bors
028159ead4 auto merge of #13676 : mdinger/rust/tutorial_doc, r=pnkfelix
Improve tutorial discussion of closures, e.g. with respect to type inference and variable capture.

Fix #13621 

---- original description follows

I'd like this pulled to master if possible but if not I'd appreciate comments on what I need to change.  I found the closures difficult to understand as they were so I tried to explain it so I would've had an easier time understanding it.  I think it's better at least, somewhat.

I don't know that everyone liked the `-> ()` I included but I thought explicit is best to aid understanding.  I thought it was much harder to understand than it should have been.

[EDIT] - Clicked too early.
This doesn't `make check` without errors on my Xubuntu on Virtualbox machine.  Not sure why.  I don't think I changed anything problematic.  I'll try `make check` on master tomorrow.

Opened https://github.com/mozilla/rust/issues/13621 regarding this.
2014-05-04 14:21:52 -07:00
Richo Healey
6201d6d0d9 docs: change compositionality to composability 2014-05-04 14:17:47 -07:00
Gary M. Josack
9246682b06 Remove/Update dead links on Tasks guide. 2014-05-03 18:39:52 -07:00
Alex Crichton
4d2877c189 doc: Remove latex math documentation
This hasn't worked since pandoc stopped being used. We can get by well enough
with the superscript extension for these equations.

Closes #12989
2014-05-03 17:36:20 -07:00
Alex Crichton
15856139e4 rustdoc: Enable the footnote markdown extension
This enables hoedown's footnote extension, and fixes all footnotes in the
reference manual to use the new syntax.
2014-05-03 17:36:20 -07:00
Alex Crichton
9306e840f5 rustdoc: Migrate from sundown to hoedown
This primary fix brought on by this upgrade is the proper matching of the ```
and ~~~ doc blocks. This also moves hoedown to a git submodule rather than a
bundled repository.

Additionally, hoedown is stricter about code blocks, so this ended up fixing a
lot of invalid code blocks (ending with " ```" instead of "```", or ending with
"~~~~" instead of "~~~").

Closes #12776
2014-05-03 17:36:20 -07:00
Kevin Butler
74392246ff Remove comment about semicolons for inner attributes from docs and adjust comments. 2014-05-03 21:24:06 +01:00
Alex Crichton
9ac9245564 rustdoc: Have no_run imply no_trans
This allows writing code examples which pass all analysis of the compiler, but
don't actually link. A good example is examples that use extern {} blocks.

Closes #12903
2014-05-03 02:09:30 -07:00
Alex Crichton
1547caf748 rustdoc: Fix inclusion of the new fonts
These fonts were moved into place by rust's makefiles, but rustdoc is widely
used outside of rustc itself. This moves the fonts into the rustdoc binary,
similarly to the other static assets, and writes them to the output location
whenever rustdoc generates documentation.

Closes #13593
Closes #13787
2014-05-03 02:09:29 -07:00
Jorge Aparicio
e4bf643b99 Fix a/an typos 2014-05-01 20:02:11 -05:00
bors
fb72d7cfea auto merge of #13881 : aochagavia/rust/pr, r=alexcrichton 2014-05-01 13:31:59 -07:00
Adolfo Ochagavía
b537028116 Fixed outdated note in the tutorial 2014-05-01 17:52:17 +02:00
Justin Noah
000667158b rustdoc tutorial: grammar change in list comments 2014-05-01 01:16:30 -07:00
bors
9f484e616e auto merge of #13648 : gereeter/rust/removed-rev, r=alexcrichton
In the process, `Splits` got changed to be more like `CharSplits` in `str` to present the DEI interface.

Note that `treemap` still has a `rev_iter` function because it seems like it would be a significant interface change to expose a DEI - the iterator would have to gain an extra pointer, the completion checks would be more complicated, and it isn't easy to check that such an implementation is correct due to the use of unsafety to subvert the aliasing properties of `&mut`.

This fixes #9391.
2014-04-30 15:46:47 -07:00
Felix S. Klock II
636f7d2364 Suggested revisions to PR 13676.
Most important: distinguish function decl sugar for omitting `-> ()`
from type inference on closures.  I also tried to add a couple more
examples to further emphasize this distinction.  Note that this sugar
(of omitting `-> ()`) is actually already briefly mentioned in an
earlier section, so it is a little tricky deciding whether to put more
material here, or to move it up to the previous section.

Other drive-by fixes:

 * Fix the line length of the code blocks to fit in the width provided
   in the rendered HTML

 * Some minor revisions to wording (e.g. try to clarify in some cases
   where a type mismatch is arising).
2014-04-30 18:34:43 +02:00
mdinger
f79571f513 Remove extra semicolons 2014-04-30 09:29:53 -04:00
mdinger
af0dd16b1b Fix typo 2014-04-30 09:10:15 -04:00
bors
cbf113182c auto merge of #13776 : adrientetar/rust/rustdoc-fix, r=brson
- Closes #13591. Relevant example: http://adrientetar.legtux.org/cached/rust-docs/struct.CChars.htm
(Had to use `!important` to override CSS selector precedence, namely matching over parent class.)
- Implement changes from #13780 feedback, namely:
  * Changed font-size from 18px to 15px
  * Reintroduced gray background for code samples
  * Tightened up the margins
- Fix point 1 and point 4 of #13804.

Samples:

- [enum.FileType](http://adrientetar.legtux.org/cached/rust-docs/enum.FileType.htm)
- [struct.CChars](http://adrientetar.legtux.org/cached/rust-docs/struct.CChars.htm)
- [std](http://adrientetar.legtux.org/cached/rust-docs/std.htm)
- [std::io](http://adrientetar.legtux.org/cached/rust-docs/io.htm).

r? @brson
2014-04-29 18:26:44 -07:00
Jonathan S
03609e5a5e Deprecate the rev_iter pattern in all places where a DoubleEndedIterator is provided (everywhere but treemap)
This commit deprecates rev_iter, mut_rev_iter, move_rev_iter everywhere (except treemap) and also
deprecates related functions like rsplit, rev_components, and rev_str_components. In every case,
these functions can be replaced with the non-reversed form followed by a call to .rev(). To make this
more concrete, a translation table for all functional changes necessary follows:

* container.rev_iter() -> container.iter().rev()
* container.mut_rev_iter() -> container.mut_iter().rev()
* container.move_rev_iter() -> container.move_iter().rev()
* sliceorstr.rsplit(sep) -> sliceorstr.split(sep).rev()
* path.rev_components() -> path.components().rev()
* path.rev_str_components() -> path.str_components().rev()

In terms of the type system, this change also deprecates any specialized reversed iterator types (except
in treemap), opting instead to use Rev directly if any type annotations are needed. However, since
methods directly returning reversed iterators are now discouraged, the need for such annotations should
be small. However, in those cases, the general pattern for conversion is to take whatever follows Rev in
the original reversed name and surround it with Rev<>:

* RevComponents<'a> -> Rev<Components<'a>>
* RevStrComponents<'a> -> Rev<StrComponents<'a>>
* RevItems<'a, T> -> Rev<Items<'a, T>>
* etc.

The reasoning behind this change is that it makes the standard API much simpler without reducing readability,
performance, or power. The presence of functions such as rev_iter adds more boilerplate code to libraries
(all of which simply call .iter().rev()), clutters up the documentation, and only helps code by saving two
characters. Additionally, the numerous type synonyms that were used to make the type signatures look nice
like RevItems add even more boilerplate and clutter up the docs even more. With this change, all that cruft
goes away.

[breaking-change]
2014-04-28 16:45:36 -05:00
Michael Pratt
bc330063d8 doc: Remove out-of-place debug! note
As of cc6ec8df, the Owned closures example uses println! instead of
debug!, making a note about seeing debug seem out-of-place in this
section.

Since debug! is not used elsewhere in the tutorial, remove the note
entirely.
2014-04-27 18:27:40 -04:00
Emanuel Rylke
107da87996 Fix link to hashmap.rs and json.rs in sample code FAQ 2014-04-27 14:17:06 +02:00
Adrien Tétar
b7dba3300e doc: perform some 80-chars wrappings 2014-04-27 11:56:29 +09:00
bors
a5d203579b auto merge of #13758 : sodaplayer/rust/patch-1, r=alexcrichton
Rustdoc doesn't seem like it's converting the old format to a table as we can see here:
http://static.rust-lang.org/doc/master/complement-cheatsheet.html#ffi-(foreign-function-interface)
This new format should fix that and it's also rendered by Github's markdown preview.
2014-04-25 23:31:25 -07:00
bors
35f3f7a74b auto merge of #13748 : hjr3/rust/guide-container-update, r=alexcrichton 2014-04-25 20:06:32 -07:00
bors
395d8857d6 auto merge of #13744 : adrientetar/rust/derp, r=brson
- Serve webfonts locally
- Style changes around `blockquote` and `code`
- Minor adjustments from previous changes

Bringing back updated examples: [modified tutorial](http://adrientetar.legtux.org/cached/rust-docs/tutorial.htm) and [modified manual](http://adrientetar.legtux.org/cached/rust-docs/manual.htm).
And for rustdoc, [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).
2014-04-25 18:26:33 -07:00
John Fresco
e7ca1d1c67 Update FFI signature table to use pipe format
Rustdoc doesn't seem like it's converting the old format to a table as we can see here:
http://static.rust-lang.org/doc/master/complement-cheatsheet.html#ffi-(foreign-function-interface)
This new format should fix that and it's also rendered by Github's markdown preview.
2014-04-25 13:07:30 -06:00
Herman J. Radtke III
87f2e21e18 doc: Update modules for containers 2014-04-25 08:17:18 -07:00
Michael Fairley
3124057101 Fix variable name in prose to match code it's describing 2014-04-25 10:15:47 -05:00
Adrien Tétar
b3577a10f3 rustdoc: bring it inline 2014-04-25 18:04:59 +09:00
Adrien Tétar
c9d995d384 doc,rustdoc: store webfonts locally
- Avoids cross-domain requests restrictions
- Better availability of content
- No HTML queries needed for an offline build
2014-04-25 17:05:56 +09:00
Adrien Tétar
14654835fc doc: slight design refresh 2014-04-25 16:59:04 +09:00
Adrien Tétar
22160014a4 rustdoc: fixes 2014-04-25 16:56:39 +09:00
Andrew Gallant
b8b7484703 Add a regex crate to the Rust distribution.
Also adds a regex_macros crate, which provides natively compiled
regular expressions with a syntax extension.

Closes #3591.

RFC: 0007-regexps
2014-04-25 00:27:24 -04:00
bors
30fe55066a auto merge of #13597 : bjz/rust/float-api, r=brson
This pull request:

- Merges the `Round` trait into the `Float` trait, continuing issue #10387.
- Has floating point functions take their parameters by value.
- Cleans up the formatting and organisation in the definition and implementations of the `Float` trait.

More information on the breaking changes can be found in the commit messages.
2014-04-22 22:01:32 -07:00
bors
3ec3c092ee auto merge of #13683 : aochagavia/rust/pr, r=alexcrichton
Replaced "len" by "length", to match the given code example.
2014-04-22 17:26:33 -07:00
bors
1e3358903d auto merge of #13673 : bmac/rust/utorial-fix, r=alexcrichton
This pr updates the "Additional tutorials" link in the scope section to match the "What next?" link in the table of contents.
2014-04-22 14:21:35 -07:00
mdinger
f7d2d5876c Some more closure changes 2014-04-22 14:11:46 -04:00
Adolfo Ochagavía
f495723733 Fixed typo in tutorial
Replaced "len" by "length", to match the given code example.
2014-04-22 14:46:54 +01:00
bors
e6c8c7c9c6 auto merge of #13587 : adrientetar/rust/more-docs, r=brson
- 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-21 21:46:38 -07:00
Brendan McLoughlin
78cdec0951 Update the "Additional tutorials" link 2014-04-21 21:47:22 -04:00
Gary M. Josack
c54a78314f Fix call order to be the same as definition order 2014-04-20 18:02:21 -07:00
Adrien Tétar
c494a06064 doc: unifying with rustdoc
Conflicts:
	src/doc/rust.md
2014-04-20 21:11:44 +09:00
bors
a27dc534e4 auto merge of #13640 : jbcrail/rust/spelling-updates, r=alexcrichton 2014-04-20 03:06:29 -07:00
Joseph Crail
ae555e3830 Fix spelling mistakes in documentation and code. 2014-04-20 01:35:14 -04:00
Nick Cameron
ff04aa8e38 Allow inheritance between structs.
No subtyping, no interaction with traits. Partially addresses #9912.
2014-04-20 13:41:18 +12:00
mdinger
36f98fb0bb Demonstrate accessing external variable in first example 2014-04-19 14:36:53 -04:00
Adrien Tétar
fb9ea2eaca doc: add webfonts and tweak the styles accordingly 2014-04-19 21:25:35 +09:00
mdinger
b5809644ad Give more explanation when introducing closures 2014-04-19 03:21:01 -04:00
mdinger
ad0cdd7081 Be more clear about what this lambda expression does 2014-04-18 21:43:29 -04:00
Brendan Zabarauskas
bed70a42ec Have floating point functions take their parameters by value.
Make all of the methods in `std::num::Float` take `self` and their other parameters by value.

Some of the `Float` methods took their parameters by value, and others took them by reference. This standardises them to one convention. The `Float` trait is intended for the built in IEEE 754 numbers only so we don't have to worry about the trait serving types of larger sizes.

[breaking-change]
2014-04-19 10:44:08 +10:00
Richo Healey
919889a1d6 Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
Alex Crichton
675b82657e Update the rest of the compiler with ~[T] changes 2014-04-18 10:57:10 -07:00
Brandon Waskiewicz
58ae1e7c62 Remove rule that is confusing
The original text stated that one should only return a unique or managed pointer if you were given one in the first place. This makes it sound as if the function *should* return a unique pointer if it were given a unique pointer. The rest of the section goes on to describe why this is bad, and the example of bad code does exactly what the rule just said to do.

I reworded the original rule into a reference to the more concise rule mentioned at the bottom of the section, which helps add emphasis (a la 'it bears repeating').
2014-04-17 16:59:58 -04:00
Kang Seonghoon
010c107ca5 doc: Removed all definition lists as Sundown doesn't support them.
Closes #13561. Please revert this commit when Sundown (or any
replacement) gets a support for definition lists in the future.
2014-04-17 02:48:28 +09:00
bors
72869b6579 auto merge of #13547 : alexcrichton/rust/remove-priv, r=huonw
See [RFC 6](e0c741f1c6/active/0006-remove-priv.md)
2014-04-16 08:16:35 -07:00
Alex Crichton
5cfbc0e7ae rustc: Remove private enum variants
This removes the `priv` keyword from the language and removes private enum
variants as a result. The remaining use cases of private enum variants were all
updated to be a struct with one private field that is a private enum.

RFC: 0006-remove-priv

Closes #13535
2014-04-16 08:12:43 -07:00
bors
349d66af94 auto merge of #13532 : alexcrichton/rust/rollup, r=alexcrichton 2014-04-15 23:36:58 -07:00
Mihnea Dobrescu-Balaur
ca5babea5f Update GitHub's Rust projects page. 2014-04-15 19:45:00 -07:00
Tobias Bucher
a5dcbc66db Remove RUST_LOG="::help" from the docs
This feature is no longer present in the current version, it was removed along
with the crate map.
2014-04-15 19:45:00 -07:00
bors
b400a4d272 auto merge of #13498 : johnsoft/rust/fix-transmute-fn-names, r=alexcrichton
Regions were renamed to lifetimes a while back, so these functions should probably be renamed as well.
2014-04-15 19:21:57 -07:00
bors
189584e792 auto merge of #13489 : JustAPerson/rust/crate-file-name, r=alexcrichton
Before, the `--crate-file-name` flag only checked crate attributes for
possible crate types. Now, if any type is specified by one or more
`--crate-type` flags, only the filenames for those types will be
emitted, and any types specified by crate attributes will be ignored.
2014-04-15 11:02:03 -07:00
bors
8a4ffbf625 auto merge of #13416 : brson/rust/30min, r=alexcrichton
This is intended to be the first thing somebody new to the language reads about Rust. It is supposed to be simple and intriguing, to give the user an idea of whether Rust is appropriate for them, and to hint that there's a lot of cool stuff to learn if they just keep diving deeper.

I'm particularly happy with the sequence of concurrency examples.
2014-04-15 06:02:06 -07:00
Brian Anderson
d1eb0e393f doc: Address feedback about intro 2014-04-14 20:49:29 -07:00
JustAPerson
0162f8e6e1 Only check --crate-type flags if present.
Before, normal compilation and the --crate-file-name flag would
generate output based on both #![crate_type] attributes and
--crate-type flags. Now, if one or more flag is specified by command
line, only those will be used.

Closes #11573.
2014-04-14 16:53:06 -05:00
bors
e2e754810c auto merge of #13477 : Manishearth/rust/newattr, r=brson
See #13476
2014-04-14 07:11:53 -07:00
John Simon
133834084e Replace 'region' with 'lifetime' in a few transmute function names 2014-04-13 17:42:00 -04:00
Alex Crichton
f862e1256d doc: Un-ignore lots of guide-ffi tests
Using some strategically-placed `#` markers most of the examples are testable
(and their contents are nontrivial).

Closes #13445
2014-04-12 12:18:45 -07:00
Manish Goregaokar
d0aed0995b Update tutorials to use new attribute syntax (#13476) 2014-04-12 09:03:39 +05:30
Liigo Zhuang
408f484b66 libtest: rename BenchHarness to Bencher
Closes #12640
2014-04-11 17:31:13 +08:00
bors
9ff08119e3 auto merge of #13451 : cmr/rust/doc-ffi, r=brson
Closes #8748
2014-04-10 22:51:40 -07:00
Corey Richardson
eabf78c7b9 Document the nullable pointer optimization in the FFI guide
Closes #8748
2014-04-10 20:29:09 -04:00
Patrick Walton
d8e45ea7c0 libstd: Implement StrBuf, a new string buffer type like Vec, and
port all code over to use it.
2014-04-10 22:10:10 +10:00
Brian Anderson
6bacbcc32e doc: Edit intro 2014-04-09 18:53:13 -07:00
Brian Anderson
ad66f56afd doc: Add "A 30-minute Introduction to Rust"
By Steve Klabnik.
2014-04-09 17:43:26 -07:00
Alex Crichton
c3ea3e439f Register new snapshots 2014-04-08 00:03:11 -07:00
Alex Crichton
c83afb9719 doc: Document flavorful variations of paths
Closes #4293
2014-04-08 00:03:11 -07:00
bors
e4779b5050 auto merge of #13165 : sfackler/rust/io-vec, r=alexcrichton
`Reader`, `Writer`, `MemReader`, `MemWriter`, and `MultiWriter` now work with `Vec<u8>` instead of `~[u8]`. This does introduce some extra copies since `from_utf8_owned` isn't usable anymore, but I think that can't be helped until `~str`'s representation changes.
2014-04-06 23:36:38 -07:00
Steven Fackler
49a8081095 De-~[] Mem{Reader,Writer} 2014-04-06 15:40:01 -07:00
bors
d73bd64f44 auto merge of #13345 : bjz/rust/irc, r=alexcrichton
This adds links to `#rust-gamedev`, `#rust-internals`, and `#rust-osdev`.
2014-04-06 08:26:34 -07:00
bors
f1f50565a1 auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,me
Rebasing of #12526 with a very obscure bug fixed on windows.
2014-04-06 02:56:39 -07:00
Alex Crichton
d1c584e41b syntax: Tweak parsing lifetime bounds on closures
In summary these are some example transitions this change makes:

    'a ||       => ||: 'a
    proc:Send() => proc():Send

The intended syntax for closures is to put the lifetime bound not at the front
but rather in the list of bounds. Currently there is no official support in the
AST for bounds that are not 'static, so this case is currently specially handled
in the parser to desugar to what the AST is expecting. Additionally, this moves
the bounds on procedures to the correct position, which is after the argument
list.

The current grammar for closures and procedures is:

    procedure := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')'
                        [ ':' bound-list ] [ '->' type ]
    closure := [ 'unsafe' ] ['<' lifetime-list '>' ] '|' arg-list '|'
                        [ ':' bound-list ] [ '->' type ]
    lifetime-list := lifetime | lifetime ',' lifetime-list
    arg-list := ident ':' type | ident ':' type ',' arg-list
    bound-list := bound | bound '+' bound-list
    bound := path | lifetime

This does not currently handle the << ambiguity in `Option<<'a>||>`, I am
deferring that to a later patch. Additionally, this removes the support for the
obsolete syntaxes of ~fn and &fn.

Closes #10553
Closes #10767
Closes #11209
Closes #11210
Closes #11211
2014-04-06 00:08:21 -07:00
Brendan Zabarauskas
f94453cc3d Mention more IRC channels on the documentation homepage
This adds links to `#rust-gamedev`, `#rust-internals`, and `#rust-osdev`.
2014-04-06 06:01:42 +10:00
bors
2dcdc75c6c auto merge of #13332 : mbrubeck/rust/doc-edit, r=huonw
Also add the new `proc` keyword to the documentation.
2014-04-05 07:21:36 -07:00
bors
3bfa05021d auto merge of #13329 : ckendell/rust/remmanaged_tutorial, r=brson
Fixes #13287
Completes work started in #13298

Removed all reference to and sample code using managed boxes/pointers.
2014-04-05 03:21:34 -07:00
Matt Brubeck
fbba696a46 Remove references to obsolete do keyword
Also add the new `proc` keyword to the documentation.
2014-04-04 17:33:20 -07:00
Christopher Kendell
dab5de268d Removed all instance of @ in code examples. 2014-04-04 16:26:33 -07:00
Christopher Kendell
51ea4fb17f Small change to example to make variable values more sensible. 2014-04-04 16:25:52 -07:00
Timothée Ravier
73b0186290 Fix inner attribute syntax from #[foo]; to #![foo]
From the 0.10 changelog:
 * The inner attribute syntax has changed from `#[foo];` to `#![foo]`.
2014-04-04 13:22:57 -07:00
Corey Richardson
0459ee77d0 Fix fallout from std::libc separation 2014-04-04 09:31:44 -07:00
bors
46e6194ee1 auto merge of #13298 : ckendell/rust/remove_managed_pointers_from_tutorial, r=cmr
Work on #13287 

This is not ready for a merge yet, but I wanted to get some eyes on what I have done so far.

As of right now, all references in the text to managed boxes or pointers are removed. Code associated with those specific sections of text have likewise been altered. I also removed all references to managed closures.

There is a small change I would like to add to the work done in 3137cd5, on the new lines 1495 and 1496, I would like to change those values to 10 and 20. I did the same in a later change on lines 1596 and 1508.

There are still bits of sample code that use managed pointers and the sigil @. Those are next on my list to remove, but I wanted to have the outstanding changes reviewed first. The uses of @ in the code samples are a bit more embedded, and I will need to be more careful changing them as to not change the purpose of the code examples.

I ensured that make check still passes, although I'm not sure if that actually tests the code in tutorial.md.

One issues I ran into, and tried to avoid, was that `tutorial.md` is formatted with a nice column limit. I was unsure how this was enforced, so wherever I edited a line, I did my best to keep edits on the line they previously existed on. As such, the plain text of `tutorial.md` looks a bit strange as I've left it, and I will clean that up as suggested. The rendered markdown output should not be affected.
2014-04-04 07:26:51 -07:00
Corey Richardson
b727bb7feb manual: fix a broken example 2014-04-04 04:08:13 -04:00
Corey Richardson
838a57ba9e manual: refine ECMA-335 reference for attributes 2014-04-04 02:10:22 -04:00
Corey Richardson
d2648cc23f manual: further attribute clarifications
- Sort attributes lexicographically
- Use new attribute syntax consistently
- Fix wording describing new attribute syntax
- Expand section on `repr`
2014-04-04 02:09:49 -04:00
Corey Richardson
a86d6b4cc9 manual: fix attribute ebnf 2014-04-04 02:08:53 -04:00
Corey Richardson
13ac12db1c manual: update style 2014-04-04 02:08:50 -04:00
Corey Richardson
2eccb1d0c2 manual: many fixes
Mostly around attributes and language items.
2014-04-04 00:52:41 -04:00
Corey Richardson
a410833a7f manual: update the note about reserved attributes 2014-04-04 00:52:41 -04:00
bors
2a2d0dce87 auto merge of #13296 : brson/rust/0.11-pre, r=alexcrichton
This also changes some of the download links in the documentation
to 'nightly'.
2014-04-03 19:56:45 -07:00
bors
e7fe207229 auto merge of #13290 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13285 (rustc: Stop using LLVMGetSectionName)
Closes #13280 (std: override clone_from for Vec.)
Closes #13277 (serialize: add a few missing pubs to base64)
Closes #13275 (Add and remove some ignore-win32 flags)
Closes #13273 (Removed managed boxes from libarena.)
Closes #13270 (Minor copy-editing for the tutorial)
Closes #13267 (fix Option<~ZeroSizeType>)
Closes #13265 (Update emacs mode to support new `#![inner(attribute)]` syntax.)
Closes #13263 (syntax: Remove AbiSet, use one Abi)
2014-04-03 17:17:02 -07:00
Brian Anderson
0875ffcbff Bump version to 0.11-pre
This also changes some of the download links in the documentation
to 'nightly'.
2014-04-03 16:28:46 -07:00
Christopher Kendell
be07cab2cf Removed all references to managed closures. 2014-04-03 15:48:32 -07:00
Christopher Kendell
3137cd5af6 Removed references to managed boxes/pointers from the tutorial text. Code
examples in relevant sections were similarly altered.
2014-04-03 15:38:19 -07:00
bors
bb31cb8d2e auto merge of #13286 : alexcrichton/rust/release, r=brson
Merging the 0.10 release into the master branch.
2014-04-03 13:52:03 -07:00
Matt Brubeck
1ac8b34ccd Minor spelling/grammar/usage fixes.
Note: "different to" is not exactly incorrect, but "different from" is more
commonly accepted in both US and Commonwealth English, and also more
consistent with other usage within this tutorial.
2014-04-03 13:43:24 -07:00
Matt Brubeck
544516ac63 Fix reference to "these two traits."
There are actually three traits listed.
2014-04-03 13:43:24 -07:00
Matt Brubeck
c1e52c71ca extern crate and mod are not easily confused
Remove some statements that used to refer to similarities between `mod` and
`extern mod`, before the latter was renamed to `extern crate`.
2014-04-03 13:43:24 -07:00
Benjamin Herr
78af0f7636 doc: Remove dated "libgreen is default" statement. 2014-04-02 16:56:31 +02:00
bors
b06b3667af auto merge of #13235 : klutzy/rust/doc-faq-win, r=alexcrichton 2014-04-01 22:41:42 -07:00
bors
1217cfb9e7 auto merge of #13225 : thestinger/rust/num, r=cmr
The `Float` trait methods will be usable as functions via UFCS, and
we came to a consensus to remove duplicate functions like this a long
time ago.

It does still make sense to keep the duplicate functions when the trait
methods are static, unless the decision to leave out the in-scope trait
name resolution for static methods changes.
2014-04-01 13:26:49 -07:00
klutzy
e481ced80f doc: Update windows status on FAQ 2014-04-01 14:42:04 +09:00
Alex Crichton
37a3131640 doc: Update with changes in field privacy 2014-03-31 15:47:37 -07:00
Daniel Micay
8ca5caf4d9 num: rm wrapping of Float methods as functions
The `Float` trait methods will be usable as functions via UFCS, and
we came to a consensus to remove duplicate functions like this a long
time ago.

It does still make sense to keep the duplicate functions when the trait
methods are static, unless the decision to leave out the in-scope trait
name resolution for static methods changes.
2014-03-31 17:41:52 -04:00
Alex Crichton
a5681d2590 Bump version to 0.10 2014-03-31 14:40:44 -07:00
Brian Anderson
ee052198c5 Rename from_iterator to from_iter for consistency. 2014-03-30 21:45:55 -07:00
Marvin Löbel
c356e3ba6a Removed deprecated functions map and flat_map for vectors and slices. 2014-03-30 03:47:04 +02:00
bors
8610e4a7a0 auto merge of #13168 : jankobler/rust/verify-grammar-02, r=brson
This fixes some problems  with

     make verify-grammar

llnextgen still reports a lot of errors

FYI: My build directory /my-test/build is different from the source directory /my-test/rust.
cd  /my-test/build
/my-test/rust/configure --prefix=/my-test/bin
make
make install
make verify-grammar
2014-03-28 23:01:43 -07:00
Flavio Percoco
81ec1f3c18 Rename Pod into Copy
Summary:
So far, we've used the term POD "Plain Old Data" to refer to types that
can be safely copied. However, this term is not consistent with the
other built-in bounds that use verbs instead. This patch renames the Pod
kind into Copy.

RFC: 0003-opt-in-builtin-traits

Test Plan: make check

Reviewers: cmr

Differential Revision: http://phabricator.octayn.net/D3
2014-03-28 10:34:02 +01:00
Alex Crichton
8d0be731f5 doc: Update the tutorial about bounds for traits 2014-03-27 13:08:48 -07:00
Jan Kobler
fdfb9ebcf6 verify-grammar llnextgen
When calling

    make verify-grammar

a lot of errors are reported by llnextgen.

Only simple errors like:

  missing semicolons,
  missing single quotes,
  usage of parentheses instead of squared brackets or
  usage of single quote instead of double quote

are fixed by this patch.

This can only be tested, when llnextgen is installed.

Signed-off-by: Jan Kobler <eng1@koblersystems.de>
2014-03-27 11:19:06 +01:00
Jan Kobler
2b05263bc3 verify-grammar keyword crate
When calling

   make verify-grammar

or when llnextgen is not installed:

   python2.7 src/etc/extract_grammar.py <src/doc/rust.md

an error is reported by extract_grammar.py that the

keyword "crate" is not defined.

This patch adds the keyword "crate" to the grammar in rust.md.

Signed-off-by: Jan Kobler <eng1@koblersystems.de>
2014-03-27 11:18:02 +01:00
bors
de85948ac0 auto merge of #13117 : alexcrichton/rust/no-crate-map, r=brson
This can be done now that logging has been moved out and libnative is the default (not libgreen)
2014-03-26 01:41:57 -07:00
bors
e28f081cc2 auto merge of #13106 : CLUSTERfoo/rust/docs/labelled_breaks, r=brson
* 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-25 21:51:58 -07:00
bors
6bf3fca8ff auto merge of #12900 : alexcrichton/rust/rewrite-sync, r=brson
* Remove clone-ability from all primitives. All shared state will now come
  from the usage of the primitives being shared, not the primitives being
  inherently shareable. This allows for fewer allocations for stack-allocated
  primitives.
* Add `Mutex<T>` and `RWLock<T>` which are stack-allocated primitives for purely
  wrapping a piece of data
* Remove `RWArc<T>` in favor of `Arc<RWLock<T>>`
* Remove `MutexArc<T>` in favor of `Arc<Mutex<T>>`
* Shuffle around where things are located
  * The `arc` module now only contains `Arc`
  * A new `lock` module contains `Mutex`, `RWLock`, and `Barrier`
  * A new `raw` module contains the primitive implementations of `Semaphore`,
    `Mutex`, and `RWLock`
* The Deref/DerefMut trait was implemented where appropriate
* `CowArc` was removed, the functionality is now part of `Arc` and is tagged
  with `#[experimental]`.
* The crate now has #[deny(missing_doc)]
* `Arc` now supports weak pointers

This is not a large-scale rewrite of the functionality contained within the
`sync` crate, but rather a shuffling of who does what an a thinner hierarchy of
ownership to allow for better composability.
2014-03-24 18:11:51 -07:00
Alex Crichton
5163a26d30 test: Update all tests with the sync changes 2014-03-24 17:17:46 -07:00
Alex Crichton
e2ae458548 doc: Update the runtime guide with green changes
This updates a few code examples about booting libgreen/libnative and also
spells out how the event loop factory is required.
2014-03-24 11:19:28 -07:00
Felix S. Klock II
57ac379a63 Correct overly broad definition of 'static kind bound.
While double-checking my understanding of the meaning of `'static`,
I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg
acceptable` variant of `bar` compiles successfully, showing that the
`'static` kind bound only disallows non-`static` references, not *all*
references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is
necessary; it did not suffice for me to just write `let d = &'static
c;`.  That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.
2014-03-24 13:03:43 +01:00
noam
4b224af72a Added suggested notes
* Note on while loop not supporting named breaks.
* Note on hygienic macros (and example of such within loops)
2014-03-24 00:43:43 -04:00
noam
7dfa4b2982 docs: named lifetimes
* 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-23 18:29:58 -04:00
bors
6f430c4426 auto merge of #13084 : Havvy/rust/master, r=alexcrichton
The indentation looks off in the guide because the main() function is not shown, so I'm dedenting the visible function.
2014-03-22 14:16:50 -07:00
bors
7e7a5e3d3e auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichton
This PR removes the `Freeze` kind and the `NoFreeze` marker completely.

Fixes #12577

cc @nikomatsakis r?
2014-03-22 13:01:52 -07:00
Ryan Scheel (Havvy)
a73d2c70d4 Unindent stringifier() in tasks guide 2014-03-22 11:54:19 -07:00
Flavio Percoco
a1cb2f5d8c doc: Remove Freeze / NoFreeze from docs 2014-03-22 15:47:34 +01:00
Matt Brubeck
8da5ed2026 Copy-edit a sentence about borrowing references 2014-03-21 14:36:06 -07:00