Commit Graph

42752 Commits

Author SHA1 Message Date
Steve Klabnik
7f74212906 Rollup merge of #25607 - peferron:doc-macros-assert-fix, r=steveklabnik
"Truth passes, success `panic!`s" seems to be a typo. The closest fix would be something like "Success passes, failure `panic!`s" but to me a "comparison failure" suggests that we couldn't compare the two values at all, not that we could successfully compare them and that the result was non-equality. So I opted to rewrite the paragraph a bit. If there's a better alternative please let me know.

r? @steveklabnik
2015-05-19 18:38:54 -04:00
Steve Klabnik
1d961fde2d Rollup merge of #25604 - skeuomorf:docs-lifetime, r=steveklabnik
r? @steveklabnik
2015-05-19 18:38:53 -04:00
Steve Klabnik
6fc93b85bc Rollup merge of #25602 - parkr:patch-1, r=alexcrichton
Padding and alignment are often not implemented by types and can cause confusion in the user.  Per discussion with @alexcrichton, here is my PR.

/cc https://github.com/rust-lang/time/issues/98
2015-05-19 18:38:53 -04:00
Steve Klabnik
1bcfe5e5ad Rollup merge of #25585 - sferik:change-default-gender, r=steveklabnik
The paper from which this example was taken made the mistake of assuming that all five philosophers are men. This it is a hypothetical example—there are no actual philosophers eating 🍝—so there is no good reason to make this assumption. Since women make up about half of the human population, all things being equal, women should represent about half of the philosophers. However, because this mistake has stood since 1985, I have changed *all* of the pronouns to be female, to make up for lost time. If someone would like to revert this patch or switch to neutral pronouns after 30 years, feel free to set your alarm clock for 2045.

r? @steveklabnik, since this is a documentation change and was created after reading http://words.steveklabnik.com/ouroboros, where I noticed this mistake.
2015-05-19 18:38:53 -04:00
Steve Klabnik
07c25d4ca0 Rollup merge of #25583 - steveklabnik:gh25517, r=alexcrichton
Fixes #25517
2015-05-19 18:38:53 -04:00
Erik Michaels-Ober
b748c2e90d Change default gender in the dining philosophers project
The paper from which this example was taken made the mistake of assuming
that all five philosophers are men. This is a hypothetical
example--there are no actual philosophers eating spaghetti--so there is
no good reason to make this assumption. Since women make up about half
of the human population, all things being equal, women should represent
about half of the philosophers. However, because this mistake has stood
since 1985, I have changed *all* of the pronouns to be female, to make
up for lost time. If someone would like to revert this patch or switch
to neutral pronouns after 30 years, feel free to set your alarm clock
for 2045.
2015-05-19 22:38:24 +02:00
bors
f34ff7af73 Auto merge of #25495 - alexcrichton:process-pid, r=aturon
This commits adds a method to the `std::process` module to get the process
identifier of the child as a `u32`. On Windows the underlying identifier is
already a `u32`, and on Unix the type is typically defined as `c_int` (`i32` for
almost all our supported platforms), but the actually pid is normally a small
positive number.

Eventually we may add functions to load information about a process based on its
identifier or the ability to terminate a process based on its identifier, but
for now this function should enable this sort of functionality to exist outside
the standard library.
2015-05-19 19:20:20 +00:00
bors
aca207a65c Auto merge of #25605 - Manishearth:rollup, r=Manishearth
- Successful merges: #25452, #25512, #25551, #25556, #25562, #25575, #25576, #25580, #25587, #25590, #25591
- Failed merges: #25585
2015-05-19 16:44:52 +00:00
peferron
afbe15d103 Fix description of assert! 2015-05-19 07:56:29 -07:00
Manish Goregaokar
3bb54a3362 Rollup merge of #25591 - rick68:patch-2, r=alexcrichton
fixed a mistake.
2015-05-19 18:47:16 +05:30
Manish Goregaokar
9d5e621c6d Rollup merge of #25590 - michaelsproul:enum-struct-diagnostics, r=Manishearth
Part of #24407.

This covers various errors to do with struct and enum patterns.
2015-05-19 18:47:15 +05:30
Manish Goregaokar
f3896621b9 Rollup merge of #25587 - bluss:rustdoc-type-margin, r=alexcrichton
rustdoc: Fix left margin for type aliases

Fixes #24655

Margin for associated types was applied to type aliases (in return
value) by mistake.
2015-05-19 18:47:15 +05:30
Manish Goregaokar
b613ef552d Rollup merge of #25580 - killercup:trpl/unify-code-blocks, r=steveklabnik
This adds strictly more information to the source files and reduces the need for customized tooling to render the book. (While this should not change the output of _rustbook_, it is very useful when rendering the sources with external tools like Pandoc.)

This only adds the language marker to "first level" code blocks (and not to code blocks in comments inside of code examples).

r? @steveklabnik
2015-05-19 18:47:15 +05:30
Manish Goregaokar
cc50fd6f31 Rollup merge of #25576 - mbrubeck:pathext-doc, r=steveklabnik
This has been a frequently-asked question on IRC, and it isn't obvious where to
look for the fix.  r? @steveklabnik
2015-05-19 18:47:15 +05:30
Manish Goregaokar
02b79c4763 Rollup merge of #25575 - clatour:patch-2, r=steveklabnik
Looks like this was an issue in the source material. I've let the editor know and he has told me he is correcting it there as well.

r? @steveklabnik
2015-05-19 18:47:14 +05:30
Manish Goregaokar
f83fe6ec1e Rollup merge of #25562 - svetlyak40wt:patch-1, r=alexcrichton
That way old versions won't be a subsections of the 1.0.0 release.
2015-05-19 18:47:14 +05:30
Manish Goregaokar
5dc886b8ad Rollup merge of #25556 - mdinger:patch-1, r=alexcrichton 2015-05-19 18:47:14 +05:30
Manish Goregaokar
1e53218902 Rollup merge of #25551 - cllns:add-active-class-to-rustbook-toc, r=alexcrichton
Currently the table of contents for `rustbook` doesn't signify which page you are on.

This PR adds an 'active' class to the link for the current page, and defines the CSS rule for that class to make the link underlined and bold.

Not sure about two things:
1) Is `current_page` is a good name for the function parameter? At first I thought `current_item` would be good, but then in the `walk_item` function, you'd have `item` and `current_item`.

2) For the CSS, is both bold and underline too much? At first I had it just be underlined, but that's also how the links look when they're hovered over.
2015-05-19 18:47:14 +05:30
Manish Goregaokar
392576b6d8 Rollup merge of #25512 - peferron:doc-traits-error-fix, r=alexcrichton
The source code snippet uses `"whatever".as_bytes()` but the compilation error message uses `b"whatever"`. Both should be consistent with each other.

r? @steveklabnik
2015-05-19 18:47:13 +05:30
Manish Goregaokar
fddd89319d Rollup merge of #25452 - jimblandy:master, r=steveklabnik
Minor tweak: the text explaining the Borrow trait talks about slices, but the example immediately following just uses a simple reference; there are no slices involved.

r? @steveklabnik
2015-05-19 18:47:13 +05:30
Mohammed Attia
aa570bce3e Fix lifetimes trpl typo 2015-05-19 14:38:54 +02:00
Parker Moore
733e7eea5c fmt.rs: add note about lack of padding support for some types 2015-05-19 19:21:52 +07:00
bors
9c47ebb00a Auto merge of #25550 - sfackler:derive-debug-unsized, r=alexcrichton
Closes #25394
2015-05-19 07:38:24 +00:00
bors
b301e02f37 Auto merge of #25548 - sfackler:debug-builders-by-ref, r=alexcrichton
Based on feedback from https://internals.rust-lang.org/t/final-comment-period-for-debug-builders-stabilization/2007/2
2015-05-19 05:39:29 +00:00
Wei-Ming Yang
b460e4516d Update iter.rs
fixed a mistake.
2015-05-19 12:40:01 +08:00
Michael Sproul
eccb72e85b Explain E0023, E0024, E0025, E0026, E0027, E0033. 2015-05-19 14:16:18 +10:00
Steven Fackler
e87b353d65 Fix debug builder examples examples 2015-05-18 20:57:11 -07:00
bors
eeaf2ba489 Auto merge of #25496 - alexcrichton:stabilize-cloned, r=aturon
The method was stabilized but the structure was forgotten to be stabilized.

Closes #25480
2015-05-19 03:41:23 +00:00
bors
8dbc369921 Auto merge of #25441 - alexcrichton:debug-panic-neg, r=aturon
Debug overflow checks for arithmetic negation landed in #24500, at which time
the `abs` method on signed integers was changed to using `wrapping_neg` to
ensure that the function never panicked. This implied that `abs` of `INT_MIN`
would return `INT_MIN`, another negative value. When this change was back-ported
to beta, however, in #24708, the `wrapping_neg` function had not yet been
backported, so the implementation was changed in #24785 to `!self + 1`. This
change had the unintended side effect of enabling debug overflow checks for the
`abs` function. Consequently, the current state of affairs is that the beta
branch checks for overflow in debug mode for `abs` and the nightly branch does
not.

This commit alters the behavior of nightly to have `abs` always check for
overflow in debug mode. This change is more consistent with the way the standard
library treats overflow as well, and it is also not a breaking change as it's
what the beta branch currently does (albeit if by accident).

cc #25378
2015-05-19 01:08:54 +00:00
Alex Crichton
5f39ceb729 std: Make abs() panic on overflow in debug mode
Debug overflow checks for arithmetic negation landed in #24500, at which time
the `abs` method on signed integers was changed to using `wrapping_neg` to
ensure that the function never panicked. This implied that `abs` of `INT_MIN`
would return `INT_MIN`, another negative value. When this change was back-ported
to beta, however, in #24708, the `wrapping_neg` function had not yet been
backported, so the implementation was changed in #24785 to `!self + 1`. This
change had the unintended side effect of enabling debug overflow checks for the
`abs` function. Consequently, the current state of affairs is that the beta
branch checks for overflow in debug mode for `abs` and the nightly branch does
not.

This commit alters the behavior of nightly to have `abs` always check for
overflow in debug mode. This change is more consistent with the way the standard
library treats overflow as well, and it is also not a breaking change as it's
what the beta branch currently does (albeit if by accident).

cc #25378
2015-05-18 17:51:23 -07:00
Ulrik Sverdrup
24b1d2150d rustdoc: Fix left margin for type aliases
Fixes #24655

Margin for associated types was applied to type aliases (in return
value) by mistake.
2015-05-19 01:44:04 +02:00
bors
2e7d7bc05d Auto merge of #25337 - bleibig:update-grammar, r=nikomatsakis
* Correctly lex CRLF in string literals
* Update `extern CRATE as NAME` syntax
* Allow leading `::` in view paths
* Allow TySums in type ascriptions and impls
* Allow macros to have visibility and attributes
* Update syntax for qualified path types and expressions
* Allow block expressions to be called () and indexed []
2015-05-18 23:29:26 +00:00
Steve Klabnik
1254c34032 Add example for from_str_radix
Fixes #25517
2015-05-18 17:13:59 -04:00
bors
4daa62a55f Auto merge of #25230 - rayglover:patch-bitset, r=Gankro
Some modest running-time improvements to `std::collections::BitSet` on bit-sets of varying set-membership densities. This is work originally from [here](https://github.com/rayglover/alt_collections). (Benchmarks copied below)
```
std::collections::BitSet / alt_collections::BitSet

copy_dense         ... 3.08x
copy_sparse        ... 4.22x
count_dense        ... 11.01x
count_sparse       ... 8.11x
from_bytes         ... 1.47x
intersect_dense    ... 6.54x
intersect_sparse   ... 4.37x
union_dense        ... 5.53x
union_sparse       ... 5.60x
```

The exception is `from_bytes`, which I've left unaltered since the optimization is rather obscure.

Compiling with the cpu feature `popcnt` gave a further ~10% improvement on my machine, but this wasn't factored in to the benchmarks above.

Similar improvements could be made to `BitVec`, although that would probably require more substantial changes.

criticism welcome!
2015-05-18 19:54:24 +00:00
Pascal Hertleif
f3adea5ce9 TRPL: Normalize rust Code Block Markers
`{rust,ignore}` -> `rust,ignore
2015-05-18 21:10:00 +02:00
Pascal Hertleif
6f69cd6387 TRPL: Add rust Marker to Some Code Block
This adds strictly more information to the source files and reduces the
need for customized tooling to render the book.

(While this should not change the output of _rustbook_, it is very
useful when rendering the sources with external tools like Pandoc.)
2015-05-18 20:56:00 +02:00
Matt Brubeck
b0e3fe9247 [doc] Add a reference from PathExt to fs::metadata 2015-05-18 10:48:22 -07:00
clatour
83df71d6c5 trpl: Dining philosophers backstory typo
Minor typo/grammar error.
2015-05-18 11:41:59 -06:00
bors
2dd5ad0be8 Auto merge of #25501 - nham:E0072_E0073, r=alexcrichton
cc #24407
2015-05-18 15:39:07 +00:00
Alexander Artemenko
a591546294 Move all version headers to the same level.
That way old versions won't be a subsections of the 1.0.0 release.
2015-05-18 10:57:58 +03:00
bors
84b1e08486 Auto merge of #25560 - Manishearth:rollup, r=Manishearth
- Successful merges: #25526, #25530, #25537
- Failed merges:
2015-05-18 04:41:43 +00:00
peferron
a10d243dd4 Use byte string literal syntax
The byte string literal syntax `b"whatever"` is more idiomatic than
`"whatever".as_bytes()`.
2015-05-17 21:19:12 -07:00
Manish Goregaokar
5ed02b5c0e Rollup merge of #25537 - carols10cents:grammar-oops, r=alexcrichton
Hiiii soooo I'm trying to get the reference grammar and associated tests running again, and I swear I tested before but I must have had multiple things going on when I did, because the change I made in #25137 to verify.rs is totally wrong. The RustLexer.tokens file that antlr generates has two sections:

```
EQ=1
LT=2
LE=3
EQEQ=4
NE=5
...
COMMENT=56
SHEBANG=57
UTF8_BOM=58
'='=1
'<'=2
'<='=3
'=='=4
...
```

and verify.rs is only interested in the first half-- the `continue` is to ignore the second half. In 9c7d5ae, I made it panic instead. I was trying to make sure verify.rs handled everything that might happen in the first half and complain if it didn't. That would mean the reference grammar was out of sync with at least verify.rs, if not the real grammar. But it's totally ok for verify.rs to not handle the entire second half of the file.

I'm sorry for breaking this :( Good thing these tests aren't being run regularly yet...? 😳
2015-05-18 08:55:38 +05:30
Manish Goregaokar
252027768e Rollup merge of #25530 - peferron:doc-closures-whitespace-fix, r=alexcrichton
Tiny fixes collected while reading through the Rust book. If they're too nitpicky please let me know and I'll ignore the next ones. :)

The spaces after the function and closure arguments might be intentional, but they do not make much sense: the usual formatting doesn't have such spaces, and they aren't helping align the three lines together either.

r? @steveklabnik (as suggested by [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md))
2015-05-18 08:55:38 +05:30
Manish Goregaokar
6f2a069b9c Rollup merge of #25526 - chellmuth:patch-1, r=alexcrichton 2015-05-18 08:55:37 +05:30
bors
8a8583c160 Auto merge of #25541 - klutzy:remove-packed-attr, r=alexcrichton
The attribute was removed by #16499.
2015-05-18 01:32:26 +00:00
Steven Fackler
fb526cf3a1 Fix finish docs 2015-05-17 18:09:35 -07:00
Steven Fackler
bd85983d05 Make debug builders take &mut self, add entries method
[breaking-change]
2015-05-17 17:33:29 -07:00
mdinger
fb73c47e5e typo 2015-05-17 20:09:11 -04:00
bors
0cc99f9cc9 Auto merge of #25527 - inrustwetrust:const-not-overflow, r=alexcrichton
Fixes #23968.
Since the values are stored in a u64 internally, we need to be mask away the
high bits after applying the ! operator. Otherwise, these bits will be set to
one, causing overflow.
2015-05-17 23:53:41 +00:00