Commit Graph

42784 Commits

Author SHA1 Message Date
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
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
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
bors
e4d56b7b5b Auto merge of #25523 - nham:remove_E0068, r=alexcrichton
A built-in feature enabling the dereferencing of newtype structs was removed
in PR https://github.com/rust-lang/rust/pull/11188, and this error (E0068) was added at the same time to warn of
its removal. It seems to make sense to remove the error now, given that
the obsolete feature it is warning about was removed nearly a year and a
half ago.
2015-05-17 22:13:30 +00:00
Sean Collins
99868f6ba8 Add 'active' class to current page in rustbook table of contents 2015-05-17 17:05:23 -04:00
Steven Fackler
1973ee479d Make #[derive(Debug)] work with unsized fields
Closes #25394
2015-05-17 14:03:37 -07:00
Nick Hamann
c69a152018 Add error explanations for E0072, E0073, E0121, E0178, E0371, E0372. 2015-05-17 15:53:12 -05:00
bors
1c44801429 Auto merge of #25454 - steveklabnik:r_doc_fix, r=alexcrichton 2015-05-17 19:40:50 +00:00
klutzy
d0fc35f394 syntax: Remove unused packed attribute
The attribute was removed by #16499.
2015-05-18 00:30:40 +09:00
Carol Nichols
e70c8584d5 Revert "Panic if the grammar verifier sees a token it doesn't recognize"
This reverts commit 9c7d5ae57c.

This was wrong... the `continue` was to ignore the latter half of the
tokens file. Another mechanism will have to be used to keep the model
grammar's tokens in sync with the actual grammar's tokens :-/
2015-05-17 10:48:42 -04:00
peferron
82447cf500 Fix doc whitespace issues 2015-05-17 03:00:04 -07:00
bors
8b7c17db22 Auto merge of #25524 - Manishearth:unsafe_derive, r=cmr 2015-05-17 09:26:30 +00:00
Manish Goregaokar
5b63841d91 Allow #[derive()] to generate unsafe methods 2015-05-17 14:56:13 +05:30
inrustwetrust
d1605deab8 Fix compile-time integer overflow when using ! on unsigned values
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 10:04:15 +02:00
Chris Hellmuth
09a473ea7b Fix typo in references-and-borrowing docs 2015-05-17 00:19:53 -07:00
bors
9f3a7f0c2b Auto merge of #25525 - Manishearth:rollup, r=Manishearth
- Successful merges: #25465, #25469, #25472, #25474, #25476, #25484, #25490, #25493, #25503, #25506, #25508, #25510, #25516, #25522
- Failed merges:
2015-05-17 06:25:58 +00:00
Manish Goregaokar
a0815c8c74 Rollup merge of #25522 - alexcrichton:reexport-incoming, r=sfackler
This iterator was mistakenly not reexported at the top level, preventing
actually naming the type!

Closes #25519
2015-05-17 11:55:40 +05:30
Manish Goregaokar
99ed2c9f4b Rollup merge of #25516 - bstrie:cstrdoc, r=alexcrichton
No need for `&b"foo"[..]` to make a CString, `"foo"` will do.
2015-05-17 11:55:40 +05:30
Manish Goregaokar
8fa94747e4 Rollup merge of #25510 - thelostt:patch-1, r=alexcrichton
The same example for ``reverse`` were in the ``reserve_exact``'s example.
2015-05-17 11:55:40 +05:30
Manish Goregaokar
4e12a92d9b Rollup merge of #25508 - johshoff:visit_dirs_example, r=alexcrichton
The current version of the example won't compile due to unstable features.
This is an attempt to fix that, at the cost of slightly more verbose code.

Using rust 1.0.0 (a59de37e9).

It might be obvious, but I'm not well versed with rust, so feedback is very welcome.
2015-05-17 11:55:40 +05:30
Manish Goregaokar
1fd0a8455b Rollup merge of #25506 - Wilfred:master, r=alexcrichton
Newcomers to Rust need to learn the distinctinion between `&str` and
`String`, so additonally having `string` in an example risks confusion.
2015-05-17 11:55:39 +05:30
Manish Goregaokar
b3706de65a Rollup merge of #25503 - brson:betafix, r=cmr 2015-05-17 11:55:39 +05:30
Manish Goregaokar
094d29cf09 Rollup merge of #25493 - coffeejunk:update_installed_rust_version, r=alexcrichton
Rust is out of beta 🎉 

r? @steveklabnik
2015-05-17 11:55:39 +05:30
Manish Goregaokar
b40fcf5b10 Rollup merge of #25490 - huachaohuang:patch-1, r=alexcrichton 2015-05-17 11:55:39 +05:30
Manish Goregaokar
4d3db38940 Rollup merge of #25484 - sumito3478:fix-deadlink-in-complement-lang-faq, r=alexcrichton
In "The Rust Language FAQ", some of the links to example projects/modules written in Rust are dead links. This PR updates them.
2015-05-17 11:55:38 +05:30