Commit Graph

3885 Commits

Author SHA1 Message Date
Alexander Stocko
e79b672a88 Fixed links in book/compiler-plugins.md 2016-06-19 16:11:43 -04:00
吴冉波
d0a0befb54 Traits where syntax's extra usage example more clearly
r? @steveklabnik
2016-06-17 22:54:06 +08:00
Alexander Merritt
565474aadd Correct use of 'nul' 'null' and capitalization
r? @steveklabnik
2016-06-15 22:43:49 -04:00
Alex Burka
b54afbee1f include list of characters 2016-06-15 16:42:36 -04:00
Alex Burka
523dbfc312 update reference for #29734 2016-06-15 16:35:03 -04:00
Liigo Zhuang
4dcebd2fa9 reference: link to proper ffi attributes 2016-06-14 10:50:48 +08:00
Florian Berger
4e0fd65d96 doc: Fix typo 2016-06-13 21:35:37 +03:00
bors
5b09f2a1a6 Auto merge of #34238 - jpreiss:master, r=steveklabnik
fix typo in primitive-types section on slices
2016-06-12 00:05:47 -07:00
James Alan Preiss
c0c43b1e27 typo fix in loops.md 2016-06-11 20:46:23 -07:00
James Alan Preiss
77aeb7b6f1 fix typo in primitive-types section on slices 2016-06-11 20:31:01 -07:00
bors
4c45d26a82 Auto merge of #34132 - AtheMathmo:no-stdlib, r=steveklabnik
Note warning of default features on libc

The default features of libc include libstd. This should be noted on this page.
2016-06-11 19:57:47 -07:00
Seo Sanghyeon
b2581974a3 Rollup merge of #34129 - jviide:from-string-box-error, r=steveklabnik
Remove a gotcha from book/error-handling.md

The book's "Error handling with `Box<Error>`" section talks about `Box<Error>`. In the actual example `Box<Error + Send + Sync>` is used instead so that the corresponding From impls could be used to convert a plain string to an error type. Rust 1.7 added support for conversion from `&str`/`String` to
`Box<Error>`, so this gotcha and later references to it can now be removed.

r? @steveklabnik
2016-06-10 21:16:44 +09:00
bors
0740a93cc2 Auto merge of #33895 - AndrewBrinker:master, r=steveklabnik
Rewrote "How Safe and Unsafe Interact" Nomicon chapter.

The previous version of the chapter covered a lot of ground, but was a little meandering and hard to follow at times. This draft is intended to be clearer and more direct, while still providing the same information as the previous version.

r? @steveklabnik
2016-06-09 07:13:34 -07:00
bors
bb4b3fb7f9 Auto merge of #32202 - arielb1:slice-patterns, r=nikomatsakis
Implement RFC495 semantics for slice patterns

non-MIR translation is still not supported for these and will happily ICE.

This is a [breaking-change] for many uses of slice_patterns.

[RFC 495 text](https://github.com/rust-lang/rfcs/blob/master/text/0495-array-pattern-changes.md)
2016-06-08 19:30:33 -07:00
Ariel Ben-Yehuda
5cf4139d21 fix tests 2016-06-09 00:38:38 +03:00
Andrew Brinker
af33b30bc6 Fixed based on feedback from steveklabnik 2016-06-07 18:09:24 -04:00
James Lucas
8844fd4e8a Adding sections and brief explanation of libc
Have included an example of a Cargo.toml file containing the libc dependency.

The file has been reformatted to use sections. The note on the default features warning is part of the _Using libc_ section but is in bold.
2016-06-07 10:59:47 -07:00
Steve Klabnik
a0bf3b8b47 Rollup merge of #34138 - hoodie:bug/bool_colors, r=steveklabnik
Bug/bool colors

This is actually #33661 @steveklabnik, sorry about this, github ate my homework
2016-06-07 10:43:58 -04:00
Steve Klabnik
3ff22ccd40 Rollup merge of #34125 - MichaelNecio:book_addition, r=steveklabnik
Noted that shadowing never destroys a value

Fixes issue #33887

r? @steveklabnik
2016-06-07 10:43:58 -04:00
Steve Klabnik
a41de7f8da Rollup merge of #34099 - markrcote:functions-copyedit, r=steveklabnik
Add missing space before parenthesis.
2016-06-07 10:43:57 -04:00
Steve Klabnik
31ddf966f5 Rollup merge of #34094 - abenga:doc_changes_variable_bindings, r=steveklabnik
Minor changes to variable bindings chapter

* In "*... name as another binding, that's currently in scope, will ...*", *"
  that's currently in scope"* is not a parenthetical element, and the commas
  can be omitted.

* Other minor changes.
2016-06-07 10:43:57 -04:00
Steve Klabnik
46de8f750b Rollup merge of #34070 - chriskrycho:update-reference-deprecated-attribute, r=steveklabnik
Update reference to indicate stabilization of `deprecated` attribute.

None
2016-06-07 10:43:57 -04:00
Steve Klabnik
ee78a02aec Rollup merge of #34060 - JDemler:master, r=steveklabnik
Improved documentation for tests/ directory

This ambigouity problem was already discussed in the [forums](https://users.rust-lang.org/t/problem-using-external-modules-inside-integration-test-submodule/5312/6).
2016-06-07 10:43:56 -04:00
Horace Abenga
b014039197 Minor changes to variable bindings chapter
* In "... name as another binding, that's currently in scope, will ...", ",
  that's currently in scope, " is not a parenthetical element, and the commas
  can be omitted.

* Other minor changes.
2016-06-07 09:38:15 +03:00
James Lucas
299a1a0699 Note warning of default features on libc
The default features of libc include libstd. This should be noted on this page.
2016-06-06 23:09:55 -07:00
Joachim Viide
75fc40c668 Remove a gotcha from book/error-handling.md
The book's "Error handling with Box<Error>" section talks about Box<Error>.
In the actual example Box<Error + Send + Sync> is used instead so that the
corresponding From impls could be used to convert a plain string to an error
type. Rust 1.7 added support for conversion from &str/String to
Box<Error>, so this gotcha and later references to it can now be removed.
2016-06-07 02:48:20 +03:00
Michael Necio
f07aa35549 Noted that shadowing never destroys a value 2016-06-06 18:13:20 -04:00
Mark Côté
fb0d9acf36 Add missing space before parenthesis. 2016-06-05 14:41:42 -04:00
Chris Krycho
2745d3e3d2 Update reference to indicate stabilization of deprecated attribute. 2016-06-05 11:52:47 -04:00
Steven Burns
e9f6c0f83a Book: diagram takes less space and it's more symmetric. 2016-06-04 14:04:17 -06:00
Steven Burns
b1605fe8f7 Book: fixed syntax coloring 2016-06-04 14:03:34 -06:00
bors
c81c75076c Auto merge of #33803 - WiSaGaN:feature/rename-main-thread, r=alexcrichton
Rename main thread from "<main>" to "main".

Fix issue #33789

We may need to discuss whether this counts as a breaking change since code may check the main thread name against "\<main\>". Discussion is in #33789
2016-06-03 19:36:32 -07:00
Jakob Demler
c26703b77b document of shared modules for integration tests 2016-06-03 12:16:07 +02:00
Jakob Demler
d71f9f614c Fixed ambiguous explanaiton of tests/ directory 2016-06-03 11:43:42 +02:00
Guillaume Gomez
2c1da5b650 Rollup merge of #34021 - ollie27:book_links_offline, r=steveklabnik
Fix a few links in the book

Links to directories and direct links to doc.rust-lang.org don't work properly
when viewing the docs offline so fix them.

r? @steveklabnik
2016-06-02 13:47:08 +02:00
Andrew Brinker
00e77d7489 Rewrote "How Safe and Unsafe Interact" Nomicon chapter.
The previous version of the chapter covered a lot of ground, but was a little
meandering and hard to follow at times. This draft is intended to be clearer
and more direct, while still providing the same information as the previous
version.
2016-06-01 16:13:44 -04:00
Oliver Middleton
658253d30c Fix a few links in the book
Links to directories and direct links to doc.rust-lang.org don't work properly
when viewing the docs offline so fix them.
2016-06-01 16:53:14 +01:00
Manish Goregaokar
b0e88279c7 Rollup merge of #33385 - cheercroaker:doc-correction, r=brson
Mention initial year of publication only for the documentation copyright

I have corrected the "copyright expiration year" that was still 2015 in the documentation copyright notice.

According to #31007 it seems that we could go one step further and simplify the copyright notice to only mention the year of original publication ("Copyright &copy; 2011" in this case).

Let me know if you would prefer this copyright notice to only mention the year of original publication (please make sure that it is really 2011 as stated in the current version of the documentation, and not 2010 like Rust's code) and I'll make the simplification.
2016-06-01 12:57:40 +05:30
Vadim Petrochenkov
d69aeaf662 Implement .. in tuple (struct) patterns 2016-05-26 11:11:58 +03:00
cheercroaker
c4ed094ef2 Mention initial copyright year only
As stated in #31007 the copyright notice should reflect the year of original publication, thus avoiding useless updates every year.
2016-05-24 21:52:32 +02:00
Guillaume Gomez
46138352e6 Rollup merge of #33810 - tmr232:patch-1, r=Manishearth
Fixed link in Rust Book (no-stdlib)

Closes #33806
2016-05-24 12:58:19 +02:00
Guillaume Gomez
66faadaf33 Rollup merge of #33759 - aakloxu:patch-2, r=steveklabnik
Fix references links

There are duplicate link references in the article and just remove one of them.
2016-05-24 12:58:17 +02:00
Tamir Bahar
bb94e6a739 Fixed link in Rust Book (no-stdlib)
Fix a broken link in the rust book.
2016-05-23 14:42:47 +03:00
Wangshan Lu
226bcdf7d1 Rename main thread from "<main>" to "main".
Fix issue #33789
2016-05-22 22:42:10 +08:00
Aaklo Xu
4c7b963862 src/doc: Keep the original style of links 2016-05-21 14:40:57 +08:00
Manish Goregaokar
197aa52de3 Rollup merge of #33750 - alx741:fix_typo, r=Manishearth
book: ownership: fix typo

The sentence ends there, so a comma is required.

See:
http://english.stackexchange.com/questions/1469/when-ending-a-list-with-etc-should-there-be-a-comma-before-etc
2016-05-21 09:08:10 +05:30
Manish Goregaokar
f262bb899c Rollup merge of #33747 - postmodern:patch-2, r=Manishearth
Clarify the English translation of `?Sized`

* It wasn't clear whether `?Sized` meant "not `Sized`" or "`Sized` or not `Sized`". According to #rust IRC, it does indeed mean "`Sized` or not `Sized`".
* Use the same language as [Trait std::marker::Sized](https://doc.rust-lang.org/std/marker/trait.Sized.html) about how `Sized` is implicitly bound.
* Refer to the syntax as `?Sized`, since it's currently the only allowed trait that can follow `?`.
2016-05-21 09:08:10 +05:30
Manish Goregaokar
0c949d8cc3 Rollup merge of #33743 - royalstream:royalstream-stack-doc, r=steveklabnik
Book: small improvement to a table to make it clearer

This table is used as an example of four heap values where two of them got deallocated leaving a gap.
It also has stack variables.
Instead of four stack variables I propose three, that way there's no misleading connection between the number of stack variables and heap variables.
But more importantly: three of the four stack variables had the same name (**y**) which could be confusing to a beginner, I changed this as well.
2016-05-21 09:08:10 +05:30
Postmodern
71af58accf Wording changes
* Use "special bound syntax" instead of "special syntax". `?Sized` is technically a "bound", but `?Sized` is specialized syntax that _only_ works with `Sized`, and no other Trait.
* Replace "constant size" with "sized".
2016-05-20 17:47:34 -07:00
Aaklo Xu
01da14b149 Fix references links
There are Duplicate link references in the article and the format is incorrect.
2016-05-20 21:55:19 +08:00
Guillaume Gomez
4a3ba87d82 Rollup merge of #33745 - postmodern:patch-1, r=steveklabnik
Clarify wording in `transmute` example

* Change "four eights" to "four u8s"
* Change "a 32" to "a u32"
2016-05-20 15:49:53 +02:00
Daniel Campoverde [alx741]
e614bb70c2 book: ownership: fix typo 2016-05-19 20:14:29 -05:00
Postmodern
d8c086b085 Grammar change 2016-05-19 17:27:04 -07:00
Postmodern
d021d7d7cf Keep line-width within 80 columns 2016-05-19 17:17:17 -07:00
Postmodern
2fd4e604a4 Clarify the English translation of ?Sized
* It wasn't clear whether `?Sized` meant "not `Sized`" or "`Sized` or not `Sized`". According to #rust IRC, it does indeed mean "`Sized` or not `Sized`".
* Use the same language as [Trait std::marker::Sized](https://doc.rust-lang.org/std/marker/trait.Sized.html) about how `Sized` is implicitly bound.
2016-05-19 17:07:29 -07:00
Postmodern
345626f088 Clarify wording in transmute example
* Change "four eights" to "four u8s"
* Change "a 32" to "a u32"
2016-05-19 13:12:11 -07:00
Steven Burns
519cc8280c Book: small improvement to a table to make it clearer 2016-05-19 11:05:13 -06:00
Manish Goregaokar
5928d49aa0 Rollup merge of #33721 - royalstream:royalstream-doc-highlights, r=Manishearth
Rust syntax coloring for some ignore, should-panic and no-run snippets.

In the book, some code blocks were missing the `rust` specifier which is needed for them to highlight correctly.
2016-05-19 21:21:07 +05:30
Manish Goregaokar
f6f5cdfcec Rollup merge of #33720 - mark-summerfield:patch-1, r=steveklabnik
Clarified that `let(mut x, y) =` only makes x mutable, not y

Closes #33716
2016-05-19 21:21:07 +05:30
Manish Goregaokar
e4f33d5ae7 Rollup merge of #33611 - vvanders:master, r=steveklabnik
Add a note about Higher-Ranked Trait Bounds in docs on Closures.

I hit a snag with lifetimes a few days ago and it wasn't until @birkenfeld pointed out Higher-Ranked Trait Bounds that I was able to solve the issue involving lifetimes on closure traits. This adds a small section in the book so that other users can find it.

r? @steveklabnik
2016-05-19 21:21:05 +05:30
Steven Burns
c9517189d7 Rust syntax coloring for some ignore, should-panic and no-run snippets. 2016-05-18 11:30:50 -06:00
mark-summerfield
98f1c35c77 Clarified that let(mut x, y) = only makes x mutable, not y 2016-05-18 17:43:22 +01:00
Hendrik Sollich
1d43497bda renamed last boolval to bool-val 2016-05-17 09:28:08 +02:00
Florian Berger
92abda02c4 Update link to license 2016-05-15 19:59:45 +03:00
Val Vanderschaegen
64feba03d7 Updated based on CR feedback. 2016-05-13 12:01:45 -07:00
Val Vanderschaegen
7da9ea0af4 Add a note about Higher-Ranked Trait Bounds in docs on Closures.
When using closures that take references with explicit lifetimes sometimes
it's required to use where F: for<..> ... syntax to express the right
lifetimes. This adds a quick note to the docs so other users can discover
it as well.
2016-05-12 18:56:20 -07:00
Guillaume Gomez
10f9f30139 Rollup merge of #33558 - bnewbold:trivial-book-tweaks, r=steveklabnik
trivial tweaks to documentation (book)

These are small things I found while reading through The Book. The `<hash>` and `panic!` lines are simply to improve readability, while I believe the proceeding/following distinction is a bug (but might be a English dialect distinction?).

I've read `rust/CONTRIBUTING`, i'm not sure if there is anything I need to do other than submit this PR.

r? @steveklabnik
2016-05-11 21:30:20 +02:00
bnewbold
8e8f3911aa trivial fixes to documentation (book) 2016-05-11 11:53:25 -04:00
Steve Klabnik
8c6796f0a7 Rollup merge of #33524 - briangreenery:briangreenery-fast-and-loose, r=steveklabnik
doc: Fix tiny typo in vec-alloc.md

Change `fast an loose` to `fast and loose`.
2016-05-11 09:27:44 -04:00
bors
80ec1b9f10 Auto merge of #33512 - birkenfeld:issue-25944, r=sanxiyn
rustdoc: remove artificial indentation of doctest code

The indentation makes the examples look nicer when printed (when is this done?), but breaks tests using multi-line string literals.

Fixes: #25944
2016-05-10 20:14:46 -07:00
Manish Goregaokar
35cc6b0c2c
Rollup merge of #33480 - birkenfeld:issue-33422, r=steveklabnik
book: fixup code in error handling tutorial

A few oversights happened while porting the example from docopt to getopts.  I retraced all the steps, fixing code and description as necessary.

Fixes: #33422
2016-05-09 14:59:40 -07:00
Brian Green
9d2c45d0e7 doc: Fix tiny typo in vec-alloc.md
Change `fast an loose` to `fast and loose`.
2016-05-09 14:28:42 -07:00
Georg Brandl
5606b42981 rustdoc: remove artificial indentation of doctest code
This makes the examples look nicer when printed (when is this
done?), but breaks tests using multi-line string literals.

Fixes: #25944
2016-05-09 22:46:40 +02:00
Amanieu d'Antras
04835ea5ec Add #[cfg(target_has_atomic)] to get atomic support for the current target 2016-05-09 13:31:47 +01:00
bors
ebe6da34ff Auto merge of #33414 - Nercury:master, r=alexcrichton
Add armv7-linux-androideabi target

This PR adds `armv7-linux-androideabi` target that matches `armeabi-v7a` Android ABI, ~~downscales `arm-linux-androideabi` target to match `armeabi` Android ABI~~ (TBD later if needed).

This should allow us to get the best performance from every [Android ABI level](http://developer.android.com/ndk/guides/abis.html).

Currently existing target `arm-linux-androideabi` started gaining features out of the supported range of [android `armeabi`](http://developer.android.com/ndk/guides/abis.html). While android compiler does not use a different target for later supported `armv7` architecture, it has distinct ABI name `armeabi-v7a`. We decided to add rust target `armv7-linux-androideabi` to match it.

Note that `NEON`, `VFPv3-D32`, and `ThumbEE` instruction sets are not added, because not all android devices are guaranteed to support all or some of these, and [their availability should be checked at runtime](http://developer.android.com/ndk/guides/abis.html#v7a).

~~This reduces performance of existing `arm-linux-androideabi` and may make it _much_ slower (we are talking more than order of magnitude in some random ad-hoc fp benchmark that I did).~~

Part of #33278.
2016-05-08 09:13:19 -07:00
Nerijus Arlauskas
b6fc4abe44 Add armv7-linux-androideabi target. 2016-05-07 13:29:57 +03:00
Georg Brandl
d75c079cde book: fixup code in error handling tutorial
A few oversights happened while porting the example from docopt to
getopts.  I retraced all the steps, fixing code and description as
necessary.

Fixes: #33422
2016-05-07 11:23:49 +02:00
Brian Anderson
2912bfb2b9 doc: Update reference with better description of target_env
The definition of this value recently changed slightly. It no
longer corresponds directly to the target triple.

Also shuffled things around to make the order of cfg descriptions more
logical and added text related them to the target triple.

cc #33403
2016-05-05 18:23:52 +00:00
cheercroaker
5635084e52 Bump copyright year in documentation footer 2016-05-03 19:57:23 +02:00
Stephen Mather
018c595574 doc/book/getting-started.md: Removed references to creating a new executable from 'Converting to Cargo'. 2016-05-01 19:45:38 +01:00
Stephen Mather
538098c7a4 doc/book/getting-started.md: Corrected spelling of 'Internet'. 2016-05-01 19:15:33 +01:00
Manish Goregaokar
3a0efffc9d Rollup merge of #33253 - ergenekonyigit:master, r=alexcrichton
rustdoc: fixed some RFCs

r? @alexcrichton
2016-04-29 19:17:58 +05:30
Alex Burka
56f24d7c19 add link to match section 2016-04-28 11:47:03 -04:00
Alex Burka
e1e4fbd2a2 s/than/instead of/ 2016-04-28 10:47:19 -04:00
Alex Burka
beec630863 "equal" -> "same type" 2016-04-28 10:32:08 -04:00
Steve Klabnik
b9dd8aa4c2 Rollup merge of #33234 - TomasHubelbauer:TomasHubelbauer-patch-1, r=GuillaumeGomez
Fix use of the `move` command in the Windows shell

`move` works both in `cmd` and in Powershell. `mv` works only in Powershell and the book says nothing about which shell is recommended so this could confuse beginners.

Closes #33219.
2016-04-28 09:51:44 -04:00
Steve Klabnik
32db236342 Rollup merge of #33095 - xogeny:xogeny-patch-1, r=steveklabnik
Tweaks to sections related to Ownership

Reading through these sections, I thought the intro text could be improved slightly.  So
here is a PR that addresses what was bugging me about it. :-)

Main issue was the wording of the opening sentence ("guide" is not clearly defined and the
wording was a bit too terse in my opinion).  I also took issue with the term "one of the most
unique".  Uniqueness is a `bool`, not an `f64`. :-)

r? @steveklabnik
2016-04-28 09:51:44 -04:00
Steve Klabnik
3c14116f64 Rollup merge of #32991 - kindlychung:patch-2, r=steveklabnik
make the borrowing example more concrete
2016-04-28 09:51:43 -04:00
Ergenekon Yigit
0e698ed2c6 update features RFC 2016-04-28 11:22:54 +03:00
Ergenekon Yigit
9ec051d3b3 update comments RFC and code snippets 2016-04-28 11:22:11 +03:00
Alex Burka
a14df5cc64 fix Point destructuring example 2016-04-28 01:20:54 -04:00
Alex Burka
993f13a2cf update documentation of tuple/unit structs
I made the "tuple structs are useless" editorializing a bit weaker and moved it to the end. Feel free to overrule me on that.

I also added an example of how to unpack a tuple struct with dot notation, because it came up on IRC.

`braced_empty_structs` is stable now, so I updated the example for unit-like structs to use that syntax. Should we show both ways?

cc @ubsan
r? @steveklabnik or @GuillameGomez
2016-04-27 23:29:49 -04:00
Tomáš Hübelbauer
e6b9760df2 Fix use of the move command in the Windows shell
`move` work both in `cmd` and in Powershell. `mv` works only in Powershell and the book says nothing about which shell is recommended so this could confuse beginners.

Closes #33219.
2016-04-27 10:56:35 +02:00
Kaiyin Zhong
10abb666e4 Update references-and-borrowing.md
add as 2nd example.
2016-04-26 17:40:59 +02:00
bors
253b7c1e1a Auto merge of #33120 - tclfs:patch-2, r=Manishearth
docs: Highlight a keyword
2016-04-24 20:17:08 -07:00
bors
91aea5cf87 Auto merge of #33163 - c4rlo:patch-2, r=Manishearth
subtyping.md: typo fix
2016-04-24 10:10:50 -07:00
bors
f01bb5ed24 Auto merge of #33092 - alexcrichton:rustbuild-docs, r=brson
rustbuild: Run all markdown documentation tests

This commit adds support to rustbuild to run all documentation tests, basically
running `rustdoc --test` over all our documentation.
2016-04-23 05:36:28 -07:00
c4rlo
abf00c65c2 subtyping.md: typo fix 2016-04-23 11:58:58 +01:00
Tang Chenglong
77145b3923 docs: Highlight a keyword 2016-04-21 09:53:30 +08:00
bors
a0c3259803 Auto merge of #32968 - alexcrichton:update-suport, r=brson
doc: Update our tier support

This modifies our listing of tiered platforms a few ways:

* All lists are alphabetized based on target now
* Lots of targets are moved up to "Tier 2" as we're gating on all these builds
  and official releases are provided (and installable via rustup).
* A few targets now list having a compiler + cargo now as well.

No more platforms have been moved up to Tier 1 at this time, however. The only
real candidate is ``x86_64-unknown-linux-musl`, but that's not *quite* to a tier
1 level of quality just yet so let's hold off for another release or so to iron
it out a bit.
2016-04-20 12:28:34 -07:00