Commit Graph

3394 Commits

Author SHA1 Message Date
Ashkan Kiani
7b9b9df309 Update references and borrowing (Fixes #29730)
Fixes #29730
2015-11-12 10:35:53 -08:00
Kevin Butler
5ae1937129 trpl: add a small section outlining doctest configuration 2015-11-12 05:17:11 +00:00
bors
ad3bd1b46d Auto merge of #29726 - petrochenkov:privsan, r=alexcrichton
- Check privacy sanity in all blocks, not only function bodies
- Check all fields, not only named
- Check all impl items, not only methods
- Check default impls
- Move the sanity check in the beginning of privacy checking, so others could rely on it

Technically it's a [breaking-change], but I expect no breakage because, well, it's *sane* privacy visitor, if code is broken it must be insane by definition!
2015-11-11 00:25:08 +00:00
Steve Klabnik
d64195f365 Rollup merge of #29715 - defuz:patch-3, r=alexcrichton
r? @steveklabnik

See #27305
2015-11-10 10:51:48 -05:00
Steve Klabnik
fb2ae896bb Rollup merge of #29420 - efindlay:master, r=steveklabnik
r? @steveklabnik
2015-11-10 10:51:47 -05:00
Vadim Petrochenkov
ef6850643e rustc_privacy: Fix bugs in SanePrivacyVisitor 2015-11-09 21:15:53 +03:00
Ivan Ivaschenko
c618c5f36a Doc: Fix broken link on for-loop.html 2015-11-09 17:49:30 +02:00
bors
00aa3cbecc Auto merge of #29695 - dtrebbien:remove-mention-of-struct_variant-feature, r=sanxiyn
The struct_variant feature was accepted and is no longer feature gated.
See #19122, #19124

§6.1.6 Enumerations shows an example of a struct-like enum variant.
2015-11-09 11:14:26 +00:00
bors
9eb099daa4 Auto merge of #29686 - jrburke:docs-error-handling-search-case, r=BurntSushi
In src/doc/trpl/error-handling.md, in this section:

It mentions three steps, to "convert this to proper error handling", the last one being:

3. Handle the error in main.

However, it is not shown. This pull request adds a code example showing how `main`'s call to `search` should use case analysis. I am still very much new to learning Rust, so this may not be idiomatic. Happy to make changes with guidance.
2015-11-08 20:20:16 +00:00
jrburke
0dd2c1c07d doc: error-handling.md: main case analysis for search 2015-11-08 09:53:21 -08:00
Daniel Trebbien
9f7afd060b reference: Remove struct_variant from Compiler Features
The struct_variant feature was accepted and is no longer feature gated.
See #19122, #19124

§6.1.6 Enumerations shows an example of a struct-like enum variant.
2015-11-08 11:27:40 -05:00
Jake Worth
8a41d1292f Fix double word 'be' 2015-11-08 09:39:01 -06:00
Ryan Scheel (Havvy)
13b7b07075 Add rustc UX guidelines.
See https://github.com/rust-lang/rfcs/pull/1246 for discussion.
2015-11-08 13:23:18 +00:00
Eric Findlay
dda7a3c2a1 Fixed "foo()" in try! example, r=steveklabnik 2015-11-08 11:00:03 +09:00
Eric Findlay
46b30ccd89 Added foo() to rustdoc example, r=steveklabnik
Fixes #29234
2015-11-08 10:05:20 +09:00
Jake Worth
ac19178078 Fix typo 2015-11-07 12:27:58 -06:00
Manish Goregaokar
d9dd67d908 Rollup merge of #29660 - steveklabnik:gh28461, r=brson
Fixes #28461
2015-11-07 06:44:46 +05:30
Manish Goregaokar
be4cd07a7e Rollup merge of #29622 - steveklabnik:gh29621, r=bstrie
Now that thread::sleep is a real thing, let's use it

Fixes #29621

r? @bstrie
2015-11-07 06:44:45 +05:30
Manish Goregaokar
50e8707cc3 Rollup merge of #29617 - steveklabnik:gh29591, r=alexcrichton
Fixes #29591
2015-11-07 06:44:45 +05:30
bors
475f91f46e Auto merge of #29582 - oli-obk:token_tree, r=sfackler 2015-11-06 21:11:06 +00:00
Steve Klabnik
801f83ff65 sleep_ms -> sleep
Now that thread::sleep is a real thing, let's use it

Fixes #29621
2015-11-06 18:00:29 +01:00
Steve Klabnik
586eb3d50f Add multi-line string literals to TRPL
Fixes #29591
2015-11-06 17:58:27 +01:00
Steve Klabnik
5eacf66c48 Make a note about "gigabyte"
Fixes #28461
2015-11-06 17:44:04 +01:00
Oliver Schneider
fcc7067904 remove Tt prefix from TokenType variants
[breaking change]
2015-11-06 14:52:02 +01:00
Ivan Ivaschenko
1ebdb734aa Opps, fix incorrect call 2015-11-06 13:52:17 +02:00
Ivan Ivaschenko
d071bd00bf Removing the hack from error handling chapter, which is does not make sense anymore. 2015-11-06 13:44:42 +02:00
Steve Klabnik
115c223e73 Rollup merge of #29619 - steveklabnik:gh28824, r=alexcrichton
Fixes #28824
2015-11-05 22:28:49 +01:00
Steve Klabnik
15dd4170ff Rollup merge of #29613 - steveklabnik:29506, r=alexcrichton
in favor of just expect()

Fixes #29506
2015-11-05 22:28:49 +01:00
Steve Klabnik
fdccd94269 Rollup merge of #29611 - steveklabnik:gh25918, r=alexcrichton
Originally, this was my 30 minute introduction, and we eventually made
it the opener to the book. But as #25918 has shown, the example I use
here has some issues. The good news is that Rust makes heap allocation
syntatically expensive, but the bad news is that that means showing
equivalent programs from Rust and other languages is difficult. After
thinking about it, I'm not sure this section is pulling its weight, and
since it has problems, I'd rather just pull it than try to re-write it
right now. I think the book is fine without it.

FIxes #25918
2015-11-05 22:28:49 +01:00
Steve Klabnik
58628b3f79 Beef up macro designator docs
Fixes #28824
2015-11-05 16:46:56 +01:00
Steve Klabnik
6d9502d35b Remove .ok().expect()
in favor of just expect()

Fixes #29506
2015-11-05 14:40:50 +01:00
Steve Klabnik
f70f8b4301 Remove short intro from README
Originally, this was my 30 minute introduction, and we eventually made
it the opener to the book. But as #25918 has shown, the example I use
here has some issues. The good news is that Rust makes heap allocation
syntatically expensive, but the bad news is that that means showing
equivalent programs from Rust and other languages is difficult. After
thinking about it, I'm not sure this section is pulling its weight, and
since it has problems, I'd rather just pull it than try to re-write it
right now. I think the book is fine without it.

FIxes #25918
2015-11-05 14:04:39 +01:00
Steve Klabnik
f04e77d598 Rollup merge of #29571 - steveklabnik:gh29322, r=apasel422
Fixes #29322
2015-11-05 12:43:03 +01:00
Steve Klabnik
92eb851f58 Rollup merge of #29567 - Toby-S:patch-1, r=steveklabnik
Reword "Writing the logic" paragraph to prevent `unwrap` being confused for a macro (and other small changes to improve the flow of the paragraph).

cc @steveklabnik
2015-11-05 12:43:02 +01:00
Steve Klabnik
268e360f39 Rollup merge of #29538 - steveklabnik:ch1_edits, r=brson
I did some preliminary editing work with No Starch on the first chapter of the book, and here's some of the results. We're going to want to return to this later when @brson etc's new rustup work is done, so this is mostly just a first pass.

But, we agreed that having separate chapters for each of this bit of intro is a bit excessive. So let's move all of this intro stuff into one chapter.

I'd appreciate a careful review of this, as there was also some confusion about some things, which resulted in me taking one huge markdown file apart and splitting it back up, as well as some editor issues, so I _think_ this looks good, but double checking things matters!

/cc @aturon
2015-11-05 12:43:02 +01:00
Steve Klabnik
7bb193c0ae Fixes as per @brson's review 2015-11-05 09:45:38 +01:00
bors
14db074659 Auto merge of #29528 - amitsaha:rust-inside-other-languages-minor, r=nikomatsakis
When referring to the different shared library extensions, specify the OS explicitly.
2015-11-04 13:24:50 +00:00
Steve Klabnik
0c93e727c2 Mention multiple impl blocks in TRPL
Fixes #29322
2015-11-04 10:35:09 +01:00
Steve Klabnik
2f4fbb2bf5 Merge first three chapters into one.
Conceptually, this makes more sense as one introductory chapter.
2015-11-04 10:06:50 +01:00
Toby Scrace
6fb2333d77 Fix #29542
Reword "Writing the logic" paragraph to prevent `unwrap` being confused
for a macro.
2015-11-04 07:42:54 +00:00
Brian Anderson
48c170df36 doc: Link to cargo docs, not just crates.io 2015-11-03 12:55:03 -08:00
Brian Anderson
6ca0fa9af2 doc: Add the Rustonomicon 2015-11-03 12:52:18 -08:00
Brian Anderson
53fad90608 doc: Remove community info 2015-11-03 12:49:21 -08:00
Brian Anderson
f553292cf6 doc: Remove non-documentation tool links 2015-11-03 12:48:47 -08:00
Brian Anderson
be9afcca89 doc: Remove irrelevant info about rbe 2015-11-03 12:47:57 -08:00
Steve Klabnik
75a6d51750 Make some edits as per No Starch.
Lots of little details and things.
2015-11-03 13:56:06 +01:00
Toby Scrace
d9df16bf61 Fix #29533
This replaces usage of the (missing) `fatal!` macro with `panic!`.
2015-11-03 11:46:05 +00:00
Amit Saha
900f36fde3 Specify Microsoft Windows and Mac OS X explicitly
When referring to the different shared library extensions, specify the OS explicitly.
2015-11-03 10:50:20 +11:00
Kyle Mayes
6e5d78dba3 Minor fix to Rust Book, Macros chapter
Fixes one of the `expr` examples to be a proper expression
2015-11-02 08:52:05 -05:00
bors
7caf54bc0f Auto merge of #29505 - rjbs:docs-where-type, r=steveklabnik
I read this section a few times before even having a guess what
was meant, then consulted IRC for confirmation.  It may be that I
was thick-headed, but I think this is a useful addition.
2015-11-02 08:01:56 +00:00
Ricardo Signes
21a0c40ab3 Attempt to clarify use of `where i32: ConvertTo<T>
I read this section a few times before even having a guess what
was meant, then consulted IRC for confirmation.  It may be that I
was thick-headed, but I think this is a useful addition.
2015-11-01 20:41:22 -05:00
bors
9c2489be0c Auto merge of #29507 - fhartwig:result-expect, r=Manishearth
This fixes part of #29506
These instances of `ok().expect()` have no benefit over using `Result`'s `expect` directly.
2015-11-01 23:22:22 +00:00
Florian Hartwig
f7a61678e3 Replace ok().expect() by Result::expect in trait chapter of trpl 2015-11-01 20:40:20 +01:00
bors
71409184dc Auto merge of #29177 - vadimcn:rtstuff, r=alexcrichton
Note: for now, this change only affects `-windows-gnu` builds.

So why was this `libgcc` dylib dependency needed in the first place?
The stack unwinder needs to know about locations of unwind tables of all the modules loaded in the current process.  The easiest portable way of achieving this is to have each module register itself with the unwinder when loaded into the process.  All modules compiled by GCC do this by calling the __register_frame_info() in their startup code (that's `crtbegin.o` and `crtend.o`, which are automatically linked into any gcc output).
Another important piece is that there should be only one copy of the unwinder (and thus unwind tables registry) in the process.  This pretty much means that the unwinder must be in a shared library (unless everything is statically linked). 

Now, Rust compiler tries very hard to make sure that any given Rust crate appears in the final output just once.   So if we link the unwinder statically to one of Rust's crates, everything should be fine.

Unfortunately, GCC startup objects are built under assumption that `libgcc` is the one true place for the unwind info registry, so I couldn't find any better way than to replace them.  So out go `crtbegin`/`crtend`, in come `rsbegin`/`rsend`!  

A side benefit of this change is that rustc is now more in control of the command line that goes to the linker, so we could stop using `gcc` as the linker driver and just invoke `ld` directly.
2015-11-01 17:15:29 +00:00
bors
cc8d398e28 Auto merge of #29475 - apasel422:drop-in, r=alexcrichton
This is a rebase of #27204.

r? @alexcrichton 
CC @Gankro
2015-10-30 19:06:43 +00:00
Alexis Beingessner
e351595c61 don't use drop_in_place as an intrinsic 2015-10-30 11:24:54 -04:00
Igor Shuvalov
66425568b3 Fixed delete command on Windows 2015-10-30 09:25:55 +03:00
Tshepang Lekhonkhobe
898f3af1ce book: it's just doctests that can't be run on binary files 2015-10-29 22:45:09 +02:00
bors
01fd4d6227 Auto merge of #29450 - defuz:patch-1, r=steveklabnik
r? @steveklabnik
2015-10-29 13:09:12 +00:00
Ivan Ivaschenko
94d9a8bc5f Trying to to be more accurate
r? @steveklabnik
2015-10-29 12:07:11 +02:00
bors
696cd7cf86 Auto merge of #29442 - rjbs:docs-comma-splice, r=steveklabnik
This is two sentences that have been comma spliced, and should
be split with a full stop.  (This error made me stop and re-read,
and I submit this as an actual improvement to readability, not
as a grammar weird-o!)
2015-10-29 09:12:26 +00:00
Ricardo Signes
618d22609e split a run-on sentence
This is two sentences that have been comma spliced, and should
be split with a full stop.  (This error made me stop and re-read,
and I submit this as an actual improvement to readability, not
as a grammar weird-o!)
2015-10-28 20:56:03 -04:00
Eric Findlay
b2c3745229 Added "ignore" to rustdoc example, r=steveklabnik
Fixes #29234
2015-10-29 09:43:54 +09:00
Steve Klabnik
0809eaa7c0 Rollup merge of #29438 - jethrogb:topic/book-rbstrlit, r=alexcrichton
The raw byte string literal syntax in the syntax index was incorrect. Also added links to the reference for raw and/or byte string literals.
2015-10-28 20:27:35 -04:00
Steve Klabnik
f1bc7f558f Rollup merge of #29435 - djrollins:diverging-function-doc, r=Manishearth
I put the reference under the function return operator `->` rather than near the suggested `!` operators as I thought it was more relevant there.

Resolves #29431
2015-10-28 20:27:35 -04:00
Jethro Beekman
14eef41378 Book: Update raw/byte string literal in syntax index
The raw byte string literal syntax in the syntax index was incorrect. Also added links to the reference for raw and/or byte string literals.
2015-10-28 14:38:04 -07:00
Daniel Rollins
90b776e5c7 Add diverging functions -> ! to syntax index
Resolves #29431
2015-10-28 19:56:57 +00:00
Eric Findlay
fdb2826738 Added try! example to documentation.md 2015-10-28 10:39:22 +09:00
Marcell Pardavi
b6f5e7238a Small fix in the book
Fixes #29401.

r? @steveklabnik
2015-10-27 19:02:47 +01:00
bors
eab5ad529b Auto merge of #29326 - Charlotteis:patch-1, r=steveklabnik
The beginning of the work that needs to be done as part of #28835.

☀️
2015-10-27 10:15:00 +00:00
bors
0152a93bb4 Auto merge of #29317 - matklad:clarify-reference, r=steveklabnik
Rust reference is a bit confusing here, because it does not explicitly mention trait objects.

See an example of confusion here https://users.rust-lang.org/t/confusion-about-impls-without-for/3379/2 :)

r? @steveklabnik
2015-10-27 08:27:53 +00:00
bors
996ba1d306 Auto merge of #29309 - rjbs:doc-comment-sections, r=alexcrichton
As displayed before this commit, I found the book confusing in its
explanation of `#`-led comments in `rust` blocks.  Possibly the
biggest confusion was because the many-dashes construct does not
become an HR element in the Markdown translator used, so things were
not being properly set off.

This change should more clearly show the as-rendered content as
rendered, and the as-coded content as code.
2015-10-27 06:40:12 +00:00
Charlotte Spencer
7447457ef8 Remove use of 'just' in trpl/installing-rust.md
The beginning of the work that needs to be done as part of #28835.
2015-10-26 16:29:54 +00:00
bors
c5d650cf74 Auto merge of #29310 - mdinger:book_playpen, r=steveklabnik
Makes rustbook code playpen links follow the style set in https://github.com/rust-lang/rust/pull/28963. This is basically cut and paste from the other one. The link looks better and still works so I assume it's good.

![rustbook](https://cloud.githubusercontent.com/assets/4156987/10717631/7a74f8ae-7b34-11e5-8870-35b5fc2526a4.png)

Fixes https://github.com/rust-lang/rust/issues/29308

r? @steveklabnik
2015-10-26 15:50:45 +00:00
bors
0b9edc77c5 Auto merge of #29280 - Ryman:bad_docattr, r=Manishearth
As is, this attr would lead to the "///" prefix being in the output text.
2015-10-26 13:58:50 +00:00
bors
7de9c4eea8 Auto merge of #29247 - dcarral:missing_word_trpl, r=steveklabnik
I somehow missed a word behind the numbers while going through this section, don't know what the best approach would be though since "**available** addresses" sounds good to me, too".
2015-10-26 12:08:51 +00:00
Aleksey Kladov
32e4ba8f50 reference: clarify impl
Another kind of nominal types in Rust are trait objects, so the following is valid

```rust
trait A {

}

impl A {

}
```
2015-10-26 12:31:17 +03:00
mdinger
a3478e0d16 Update the playpen link for code in the rust book to agree with rustdoc's new style 2015-10-25 16:18:55 -04:00
Ricardo Signes
50611331b4 reformat the docs for hidden code in rust sections
As displayed before this commit, I found the book confusing in its
explanation of `#`-led comments in `rust` blocks.  Possibly the
biggest confusion was because the many-dashes construct does not
become an HR element in the Markdown translator used, so things were
not being properly set off.

This change should more clearly show the as-rendered content as
rendered, and the as-coded content as code.
2015-10-25 16:05:58 -04:00
Kevin Butler
315f76202f Fix docattr to match surrounding text
As is, this attr would lead to the "///" prefix being in the output text
2015-10-24 20:00:58 +01:00
bors
8d86d1a4e1 Auto merge of #29215 - fhahn:issue-28157-bad-semicolon, r=alexcrichton
PR for #28157. At the moment, `rustc` emits a warning when a bare semicolon is encountered (could also be a fail, but I think this is a backwards incompatible change).

Also I am not sure where the best place for a test for that warning would be. Seems run-pass tests do not check warnings.
2015-10-24 18:37:09 +00:00
Florian Hahn
1e62bd2754 Allow bare semicolon in grammar doc, closes #28157 2015-10-24 00:45:18 +02:00
Daniel Carral
2e0e32f4eb Add missing word to TRPL's 'The Heap' section 2015-10-23 12:37:46 +02:00
bors
9a855668fc Auto merge of #29194 - chrisccerami:clarify-headers-in-traits-docs, r=Manishearth
It's possible that there is some meaning I'm not grasping from the headers "Traits bounds for generic functions" and "Traits bounds for generic structs", but they seem to me like they could be clearer and more grammatically correct.
2015-10-23 09:06:24 +00:00
Chris C Cerami
00c1419e32 Define bounds in glossary.md 2015-10-23 00:45:44 -04:00
Steve Klabnik
b51d5e10b2 Rollup merge of #29230 - tsion:fix-nomicon-typo-2, r=steveklabnik
r? @steveklabnik
2015-10-22 12:43:50 -04:00
Steve Klabnik
58fed892c5 Rollup merge of #29207 - ykomatsu:trpl, r=steveklabnik 2015-10-22 12:43:49 -04:00
Steve Klabnik
94326e1916 Rollup merge of #29193 - kini:filename-conventions, r=alexcrichton
When reading this paragraph, the beginning Rust programmer is starting
to write a Hello World program.  We have just told her to name the file
`main.rs`, and immediately afterward, a `hello_world.rs` is mentioned.
I changed this to an unrelated filename (incidentally one that appears
in this repository) to make it clear that this is just an example.
Also, wording it as a declarative sentence rather than an imperative one
further separates it from the Hello World instructions in this section.

r? @steveklabnik 

(Let me know if I'm sending too many PRs -- I can batch up TRPL edits, say, per chapter, if that works better. Or I can just refrain from editing TRPL as I read through it, if these are not sufficiently useful.)
2015-10-22 12:43:49 -04:00
Steve Klabnik
7a16b95d4a Rollup merge of #29170 - kini:curl-sh-disclaimer, r=steveklabnik
The paragraph here seemed confusing, so I reworded it.  Also added
another possible reason why `curl | sh` might be objectionable to users.

r? @steveklabnik
2015-10-22 12:43:48 -04:00
bors
ca998fc2f1 Auto merge of #29018 - tsion:doc-typo, r=steveklabnik
r? @steveklabnik
2015-10-22 13:12:20 +00:00
Scott Olson
6003b479a0 Add missing "to" in Rustonomicon Atomics. 2015-10-22 03:33:47 -06:00
Yoshito Komatsu
f609d17573 Correct a previous patch 2015-10-22 09:17:04 +09:00
bors
ea2dabf6b2 Auto merge of #29138 - ykomatsu:trpl2, r=Manishearth 2015-10-21 14:45:48 +00:00
Yoshito Komatsu
55796c07b8 Fix some typos in TRPL 2015-10-21 22:17:23 +09:00
bors
26c14a488b Auto merge of #29017 - ykomatsu:trpl, r=steveklabnik 2015-10-21 11:13:46 +00:00
bors
4aec7c7d61 Auto merge of #29055 - alexcrichton:tiers, r=steveklabnik
This commit expands the "supported platforms" section of the book to include
documentation on the tiers that Rust currently has as well as organizing all
supported platforms into these various tiers. Infrastructure improvements over
the next few months are likely to change the location of may of these platforms
over, but for now this should faithfully represent what we've got today!
2015-10-21 07:45:48 +00:00
Chris C Cerami
509bec89fa Change headers in Traits section of the book 2015-10-20 21:21:44 -04:00
Keshav Kini
79102e327c Remove reference to hello_world.rs in TRPL §2.2
When reading this paragraph, the beginning Rust programmer is starting
to write a Hello World program.  We have just told her to name the file
`main.rs`, and immediately afterward, a `hello_world.rs` is mentioned.
I changed this to an unrelated filename (incidentally one that appears
in this repository) to make it clear that this is just an example.
Also, wording it as a declarative sentence rather than an imperative one
further separates it from the Hello World instructions in this section.
2015-10-20 16:58:43 -05:00
bors
97ba52ec37 Auto merge of #29148 - petrochenkov:noshow, r=alexcrichton
Closes https://github.com/rust-lang/rust/issues/29145

[breaking-change], needs a crater run.
2015-10-20 19:02:27 +00:00
Alex Crichton
93e419cab6 doc: Clarify supported platforms and tiers
This commit expands the "supported platforms" section of the book to include
documentation on the tiers that Rust currently has as well as organizing all
supported platforms into these various tiers. Infrastructure improvements over
the next few months are likely to change the location of may of these platforms
over, but for now this should faithfully represent what we've got today!
2015-10-20 10:13:32 -07:00
Steve Klabnik
2fb3b856c5 Rollup merge of #29175 - durka:patch-8, r=Gankro
Yay, markdown isn't standardized and rustbook's parser has subtle incompatibilities with Github's! So in the Github preview you don't see that this list fails to separate from the previous paragraph. I think this should fix it, but I didn't check.
2015-10-20 09:43:47 -04:00
Steve Klabnik
53c4b4d412 Rollup merge of #29162 - tsion:fix-nomicon-typo, r=alexcrichton
r? @steveklabnik
2015-10-20 09:43:47 -04:00
Vadim Chugunov
adce670e75 Fix up tests and docs. 2015-10-19 18:54:38 -07:00
Alex Burka
f1e06db8c2 fix markdown in nomicon/dropck 2015-10-19 20:14:38 -04:00
Keshav Kini
968d17a3eb Replace -- with — 2015-10-19 16:18:20 -05:00
Steve Klabnik
2f2d8df534 Rollup merge of #29169 - apasel422:spell, r=steveklabnik
r? @steveklabnik
2015-10-19 17:14:08 -04:00
Steve Klabnik
ea3bf79bac Rollup merge of #29168 - aarzee:master, r=steveklabnik
Remove leading newlines; replace lines containing only whitespace with empty lines; replace multiple trailing newlines with a single newline; remove trailing whitespace in lines.

This PR was created semiautomatically.
2015-10-19 17:14:08 -04:00
Andrew Paseltiner
9431f3cc7b Correct spelling in docs 2015-10-19 13:48:42 -04:00
Keshav Kini
d142a4eed0 Reword curl | sh disclaimer in TRPL §2.1
The paragraph here seemed confusing, so I reworded it.  Also added
another possible reason why `curl | sh` might be objectionable to users.
2015-10-19 12:05:52 -05:00
Carlos Liam
f9d056f1b7 Clean whitespace
Remove leading newlines; replace lines containing only whitespace with empty lines; replace multiple trailing newlines with a single newline; remove trailing whitespace in lines
2015-10-19 11:16:31 -04:00
Irving A.J. Rivas Z.
e2ecf279b6 Made the example capable of consistent deadlocking
To augment the didactic effect, made placed the thread::sleep_ms call in the last example, so that there will be time for the other locks to happen; without this, I was unable to observe the deadlock in over 1,000 runs when there was no left-handed philosopher.
2015-10-19 10:02:46 -04:00
Scott Olson
8222970f79 Fix minor syntax error in example. 2015-10-19 01:43:48 -06:00
Yoshito Komatsu
5a15144b95 Change to avoid repeated "is" 2015-10-19 14:23:51 +09:00
Vadim Petrochenkov
025cf75864 Remove #[derive(Show)] 2015-10-18 19:12:09 +03:00
Yoshito Komatsu
5122a6d936 Fix some typos 2015-10-18 16:07:00 +09:00
bors
206af38e74 Auto merge of #29105 - billpmurphy:master, r=alexcrichton
Change the spacing/order of lines in the final pointer conversion example to make it more clear.

Very small change, can be rolled up.
2015-10-17 17:53:53 +00:00
bors
971856d0ec Auto merge of #29089 - kickinbahk:edit-testing-docs, r=steveklabnik
When going through the docs, it is not clear that binary files cannot be tested. Additionally, it is hard to find the proper structure of a Rust crate and it took me several hours of looking through the docs to find the crates and modules section. I think we can link to it from here and it will be beneficial to those who are coming to the language.
2015-10-17 15:10:07 +00:00
bors
be91042913 Auto merge of #29082 - DenisKolodin:patch-3, r=alexcrichton 2015-10-16 20:35:51 +00:00
kickinbahk
cf926f1c18 Update the testing doc to be more clear and include dynamic link
Fixed some typos and changed the link to the link to crates-and-modules to be dynamic.
2015-10-16 11:45:22 -07:00
DenisKolodin
5736c1d90a Update explanation about offset method 2015-10-16 19:10:01 +03:00
billpmurphy
348cbe0cb9 book: Change raw pointer conversion example
Change the spacing/order of lines in the final pointer conversion example to make it more clear.
2015-10-16 11:42:27 -04:00
bors
05cfd72ed1 Auto merge of #29086 - fhahn:book-update-lint-plugin-example, r=alexcrichton 2015-10-16 11:33:01 +00:00
bors
beeaea4a70 Auto merge of #28957 - GuillaumeGomez:patch-5, r=Manishearth
cc @nagisa
2015-10-16 09:49:50 +00:00
Guillaume Gomez
a3f9fc69d6 Change error message in rustbook 2015-10-16 10:59:04 +02:00
kickinbahk
1468b190ac Add to Testing docs to make more clear
When going through the docs, it is not clear that binary files cannot be tested. Additionally, it is hard to find the proper structure of a Rust crate and it took me several hours of looking through the docs to find the crates and modules section. I think we can link to it from here and it will be beneficial to those who are coming to the language.
2015-10-15 17:44:21 -07:00
Florian Hahn
ac097f1a5e Update lint plugin example in book to work with recent master 2015-10-15 23:53:05 +02:00
Ryan Scheel (Havvy)
48c90a38c1 Remove outdated Changing directory. 2015-10-15 19:35:39 +00:00
Manish Goregaokar
7be7ec300e Rollup merge of #29066 - dcarral:fix_issue_29063, r=steveklabnik
Regarding [#29063 _[Docs] Terminology inconsistency between 'iterator adapters' and 'iterator adaptors'_](https://github.com/rust-lang/rust/issues/29063) :

This PR replaces 'iterator adapters' appearances (in TRPL book) to 'iterator adaptors', thus embracing the terminology used along the API docs and achieving consistency between both sources.
2015-10-15 13:41:33 +05:30
Manish Goregaokar
677a9895a8 Rollup merge of #29062 - rgardner:rgardner-fix-book-comp-warning, r=alexcrichton
Before this commit, the first "A Rust library" code sample produced
the following compilation warning:
```
test.rs:7:22: 7:36 warning: unnecessary parentheses around `for` head
expression, #[warn(unused_parens)] on by default
test.rs:7             for _ in (0..5_000_000) {
```

This commit just removes the parens around the range 0..5_000_000 thereby removing the compilation warning.
2015-10-15 13:41:33 +05:30
Manish Goregaokar
596338b8ef Rollup merge of #29060 - tshepang:consistency, r=nikomatsakis 2015-10-15 13:41:33 +05:30
Manish Goregaokar
bcbad7ba8c Rollup merge of #29059 - tshepang:typo, r=nikomatsakis 2015-10-15 13:41:32 +05:30
Manish Goregaokar
2172d2a4ec Rollup merge of #29058 - tshepang:rename, r=steveklabnik
Shoud have been part of commit 0b13ee0ced
2015-10-15 13:41:32 +05:30
Manish Goregaokar
d90f8f912b Rollup merge of #29022 - apasel422:spell, r=steveklabnik
r? @steveklabnik
2015-10-15 13:41:32 +05:30
Manish Goregaokar
ad5159d52f Rollup merge of #28906 - tshepang:link, r=nikomatsakis 2015-10-15 13:41:31 +05:30
Daniel Carral
6bff154b57 Replace 'adapters' to 'adaptors' in TRPL book
Regarding #29063: Replace 'iterator adapters' appearances to
'iterator adaptors', thus embracing the terminology used along the
API docs and achieving consistency between both sources.
2015-10-15 02:13:20 +02:00
Tshepang Lekhonkhobe
18fa6d8dbc book: be consistent with preceding example 2015-10-15 00:19:47 +02:00
Tshepang Lekhonkhobe
5d5e62d7d8 book: fix typo 2015-10-15 00:16:13 +02:00
Tshepang Lekhonkhobe
ea37fadebb reference: 'struct' is more common that 'structure'
Shoud have been part of commit 0b13ee0ced
2015-10-15 00:09:08 +02:00
Tshepang Lekhonkhobe
0dbc2ef8a1 reference: add link to the symbols 2015-10-14 23:48:26 +02:00
Robert Gardner
c8b6c125d4 Resolve unused_parens compilation warning
Before this commit, the first "A Rust library" code sample produced
the following compilation warning:
```
test.rs:7:22: 7:36 warning: unnecessary parentheses around `for` head
expression, #[warn(unused_parens)] on by default
test.rs:7             for _ in (0..5_000_000) {
```

This commit just removes the parens around the range 0..5_000_000.
2015-10-14 17:38:56 -04:00
Manish Goregaokar
570756face Rollup merge of #29028 - Seeker14491:patch-1, r=Manishearth
Having this code section hidden is misleading because it makes it look like implementing Circle for Foo automatically makes Foo implement Shape.
2015-10-14 12:50:57 +05:30
Manish Goregaokar
5dc2955f91 Rollup merge of #29013 - chrisccerami:fix_broken_lifetime_elision_link, r=alexcrichton
This link was added in #28842 but doesn't work at https://doc.rust-lang.org/nightly/book/lifetimes.html. What works in my markdown preview doesn't work live, and vice versa.
2015-10-14 12:50:55 +05:30
bors
293966694c Auto merge of #28816 - petrochenkov:unistruct, r=nrc
This patch uses the same data structures for structs and enum variants in AST and HIR. These changes in data structures lead to noticeable simplification in most of code dealing with them.
I didn't touch the top level, i.e. `ItemStruct` is still `ItemStruct` and not `ItemEnum` with one variant, like in the type checker.
As part of this patch, structures and variants get the `kind` field making distinction between "normal" structs, tuple structs and unit structs explicit instead of relying on the number of fields and presence of constructor `NodeId`. In particular, we can now distinguish empty tuple structs from unit structs, which was impossible before! Comprehensive tests for empty structs are added and some improvements to empty struct feature gates are made. Some tests don't pass due to issue https://github.com/rust-lang/rust/issues/28692 , they are still there for completeness, but are commented out.
This patch fixes issue mentioned in https://github.com/rust-lang/rust/issues/16819#issuecomment-139509861, now emptiness of tuple structs is checked after expansion.
It also touches https://github.com/rust-lang/rust/issues/28750 by providing span for visit_struct_def
cc https://github.com/rust-lang/rust/pull/28336

r? @nrc
2015-10-14 04:21:58 +00:00
Seeker14491
12224bec21 Unhide some code from the Traits section
Having this code section hidden is misleading because it makes it look like implementing Circle for Foo automatically makes Foo implement Shape.
2015-10-13 13:45:10 -05:00
Steve Klabnik
1537545133 Rollup merge of #29015 - dripton:master, r=alexcrichton
Just a single-character typo fix.
2015-10-13 13:09:53 -04:00
Steve Klabnik
53bec74bc5 Rollup merge of #29007 - dnwade:patch-2, r=alexcrichton
r? @steveklabnik
2015-10-13 13:09:53 -04:00
Andrew Paseltiner
1162b3752c Correct spelling in docs 2015-10-13 09:44:11 -04:00
Vadim Petrochenkov
8a12c19171 Test and gate empty structures and variants better 2015-10-13 15:19:20 +03:00
Scott Olson
0d3d6e40fd Fix typo in custom allocator docs. 2015-10-13 01:23:42 -06:00
Yoshito Komatsu
6ee31347b3 Fix some typos 2015-10-13 15:59:59 +09:00