]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRollup merge of #25620 - brson:betavers, r=alexcrichton
Steve Klabnik [Tue, 19 May 2015 22:38:54 +0000 (18:38 -0400)]
Rollup merge of #25620 - brson:betavers, r=alexcrichton

9 years agoRollup merge of #25614 - parir:patch-2, r=alexcrichton
Steve Klabnik [Tue, 19 May 2015 22:38:54 +0000 (18:38 -0400)]
Rollup merge of #25614 - parir:patch-2, r=alexcrichton

r? @steveklabnik

9 years agoRollup merge of #25611 - parir:patch-1, r=steveklabnik
Steve Klabnik [Tue, 19 May 2015 22:38:54 +0000 (18:38 -0400)]
Rollup merge of #25611 - parir:patch-1, r=steveklabnik

r? @steveklabnik

9 years agoRollup merge of #25607 - peferron:doc-macros-assert-fix, r=steveklabnik
Steve Klabnik [Tue, 19 May 2015 22:38:54 +0000 (18:38 -0400)]
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

9 years agoRollup merge of #25604 - skeuomorf:docs-lifetime, r=steveklabnik
Steve Klabnik [Tue, 19 May 2015 22:38:53 +0000 (18:38 -0400)]
Rollup merge of #25604 - skeuomorf:docs-lifetime, r=steveklabnik

r? @steveklabnik

9 years agoRollup merge of #25602 - parkr:patch-1, r=alexcrichton
Steve Klabnik [Tue, 19 May 2015 22:38:53 +0000 (18:38 -0400)]
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

9 years agoRollup merge of #25585 - sferik:change-default-gender, r=steveklabnik
Steve Klabnik [Tue, 19 May 2015 22:38:53 +0000 (18:38 -0400)]
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 :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.

r? @steveklabnik, since this is a documentation change and was created after reading http://words.steveklabnik.com/ouroboros, where I noticed this mistake.

9 years agoRollup merge of #25583 - steveklabnik:gh25517, r=alexcrichton
Steve Klabnik [Tue, 19 May 2015 22:38:53 +0000 (18:38 -0400)]
Rollup merge of #25583 - steveklabnik:gh25517, r=alexcrichton

Fixes #25517

9 years agoChange default gender in the dining philosophers project
Erik Michaels-Ober [Mon, 18 May 2015 21:48:09 +0000 (23:48 +0200)]
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.

9 years agoAuto merge of #25495 - alexcrichton:process-pid, r=aturon
bors [Tue, 19 May 2015 19:20:20 +0000 (19:20 +0000)]
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.

9 years agomk: Report the prerelease version on beta again. Fixes #25618
Brian Anderson [Tue, 19 May 2015 18:34:34 +0000 (11:34 -0700)]
mk: Report the prerelease version on beta again. Fixes #25618

9 years agodoc: fix a broken link
parir [Tue, 19 May 2015 17:36:10 +0000 (19:36 +0200)]
doc: fix a broken link

9 years agodoc: add missing fences
parir [Tue, 19 May 2015 17:19:42 +0000 (19:19 +0200)]
doc: add missing fences

9 years agoAuto merge of #25605 - Manishearth:rollup, r=Manishearth
bors [Tue, 19 May 2015 16:44:52 +0000 (16:44 +0000)]
Auto merge of #25605 - Manishearth:rollup, r=Manishearth

- Successful merges: #25452, #25512, #25551, #25556, #25562, #25575, #25576, #25580, #25587, #25590, #25591
- Failed merges: #25585

9 years agoFix description of assert!
peferron [Mon, 18 May 2015 20:39:19 +0000 (13:39 -0700)]
Fix description of assert!

9 years agoRollup merge of #25591 - rick68:patch-2, r=alexcrichton
Manish Goregaokar [Tue, 19 May 2015 13:17:16 +0000 (18:47 +0530)]
Rollup merge of #25591 - rick68:patch-2, r=alexcrichton

fixed a mistake.

9 years agoRollup merge of #25590 - michaelsproul:enum-struct-diagnostics, r=Manishearth
Manish Goregaokar [Tue, 19 May 2015 13:17:15 +0000 (18:47 +0530)]
Rollup merge of #25590 - michaelsproul:enum-struct-diagnostics, r=Manishearth

Part of #24407.

This covers various errors to do with struct and enum patterns.

9 years agoRollup merge of #25587 - bluss:rustdoc-type-margin, r=alexcrichton
Manish Goregaokar [Tue, 19 May 2015 13:17:15 +0000 (18:47 +0530)]
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.

9 years agoRollup merge of #25580 - killercup:trpl/unify-code-blocks, r=steveklabnik
Manish Goregaokar [Tue, 19 May 2015 13:17:15 +0000 (18:47 +0530)]
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

9 years agoRollup merge of #25576 - mbrubeck:pathext-doc, r=steveklabnik
Manish Goregaokar [Tue, 19 May 2015 13:17:15 +0000 (18:47 +0530)]
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

9 years agoRollup merge of #25575 - clatour:patch-2, r=steveklabnik
Manish Goregaokar [Tue, 19 May 2015 13:17:14 +0000 (18:47 +0530)]
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

9 years agoRollup merge of #25562 - svetlyak40wt:patch-1, r=alexcrichton
Manish Goregaokar [Tue, 19 May 2015 13:17:14 +0000 (18:47 +0530)]
Rollup merge of #25562 - svetlyak40wt:patch-1, r=alexcrichton

That way old versions won't be a subsections of the 1.0.0 release.

9 years agoRollup merge of #25556 - mdinger:patch-1, r=alexcrichton
Manish Goregaokar [Tue, 19 May 2015 13:17:14 +0000 (18:47 +0530)]
Rollup merge of #25556 - mdinger:patch-1, r=alexcrichton

9 years agoRollup merge of #25551 - cllns:add-active-class-to-rustbook-toc, r=alexcrichton
Manish Goregaokar [Tue, 19 May 2015 13:17:14 +0000 (18:47 +0530)]
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.

9 years agoRollup merge of #25512 - peferron:doc-traits-error-fix, r=alexcrichton
Manish Goregaokar [Tue, 19 May 2015 13:17:13 +0000 (18:47 +0530)]
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

9 years agoRollup merge of #25452 - jimblandy:master, r=steveklabnik
Manish Goregaokar [Tue, 19 May 2015 13:17:13 +0000 (18:47 +0530)]
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

9 years agoFix lifetimes trpl typo
Mohammed Attia [Tue, 19 May 2015 12:38:54 +0000 (14:38 +0200)]
Fix lifetimes trpl typo

9 years agofmt.rs: add note about lack of padding support for some types
Parker Moore [Tue, 19 May 2015 12:21:52 +0000 (19:21 +0700)]
fmt.rs: add note about lack of padding support for some types

9 years agoAuto merge of #25550 - sfackler:derive-debug-unsized, r=alexcrichton
bors [Tue, 19 May 2015 07:38:24 +0000 (07:38 +0000)]
Auto merge of #25550 - sfackler:derive-debug-unsized, r=alexcrichton

Closes #25394

9 years agoAuto merge of #25548 - sfackler:debug-builders-by-ref, r=alexcrichton
bors [Tue, 19 May 2015 05:39:29 +0000 (05:39 +0000)]
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

9 years agoUpdate iter.rs
Wei-Ming Yang [Tue, 19 May 2015 04:40:01 +0000 (12:40 +0800)]
Update iter.rs

fixed a mistake.

9 years agoExplain E0023, E0024, E0025, E0026, E0027, E0033.
Michael Sproul [Mon, 11 May 2015 12:15:16 +0000 (22:15 +1000)]
Explain E0023, E0024, E0025, E0026, E0027, E0033.

9 years agoFix debug builder examples examples
Steven Fackler [Tue, 19 May 2015 03:57:11 +0000 (20:57 -0700)]
Fix debug builder examples examples

9 years agoAuto merge of #25496 - alexcrichton:stabilize-cloned, r=aturon
bors [Tue, 19 May 2015 03:41:23 +0000 (03:41 +0000)]
Auto merge of #25496 - alexcrichton:stabilize-cloned, r=aturon

The method was stabilized but the structure was forgotten to be stabilized.

Closes #25480

9 years agoAuto merge of #25441 - alexcrichton:debug-panic-neg, r=aturon
bors [Tue, 19 May 2015 01:08:54 +0000 (01:08 +0000)]
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

9 years agostd: Make abs() panic on overflow in debug mode
Alex Crichton [Fri, 15 May 2015 16:18:14 +0000 (09:18 -0700)]
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

9 years agorustdoc: Fix left margin for type aliases
Ulrik Sverdrup [Mon, 18 May 2015 23:44:04 +0000 (01:44 +0200)]
rustdoc: Fix left margin for type aliases

Fixes #24655

Margin for associated types was applied to type aliases (in return
value) by mistake.

9 years agoAuto merge of #25337 - bleibig:update-grammar, r=nikomatsakis
bors [Mon, 18 May 2015 23:29:26 +0000 (23:29 +0000)]
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 []

9 years agoAdd example for from_str_radix
Steve Klabnik [Mon, 18 May 2015 20:58:29 +0000 (16:58 -0400)]
Add example for from_str_radix

Fixes #25517

9 years agoAuto merge of #25230 - rayglover:patch-bitset, r=Gankro
bors [Mon, 18 May 2015 19:54:24 +0000 (19:54 +0000)]
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!

9 years agoTRPL: Normalize rust Code Block Markers
Pascal Hertleif [Mon, 18 May 2015 19:10:00 +0000 (21:10 +0200)]
TRPL: Normalize rust Code Block Markers

`{rust,ignore}` -> `rust,ignore

9 years agoTRPL: Add `rust` Marker to Some Code Block
Pascal Hertleif [Mon, 18 May 2015 18:56:00 +0000 (20:56 +0200)]
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.)

9 years ago[doc] Add a reference from PathExt to fs::metadata
Matt Brubeck [Mon, 18 May 2015 17:48:22 +0000 (10:48 -0700)]
[doc] Add a reference from PathExt to fs::metadata

9 years agotrpl: Dining philosophers backstory typo
clatour [Mon, 18 May 2015 17:41:59 +0000 (11:41 -0600)]
trpl: Dining philosophers backstory typo

Minor typo/grammar error.

9 years agoAuto merge of #25501 - nham:E0072_E0073, r=alexcrichton
bors [Mon, 18 May 2015 15:39:07 +0000 (15:39 +0000)]
Auto merge of #25501 - nham:E0072_E0073, r=alexcrichton

cc #24407

9 years agoMove all version headers to the same level.
Alexander Artemenko [Mon, 18 May 2015 07:57:58 +0000 (10:57 +0300)]
Move all version headers to the same level.

That way old versions won't be a subsections of the 1.0.0 release.

9 years agoAuto merge of #25560 - Manishearth:rollup, r=Manishearth
bors [Mon, 18 May 2015 04:41:43 +0000 (04:41 +0000)]
Auto merge of #25560 - Manishearth:rollup, r=Manishearth

- Successful merges: #25526, #25530, #25537
- Failed merges:

9 years agoUse byte string literal syntax
peferron [Mon, 18 May 2015 04:18:29 +0000 (21:18 -0700)]
Use byte string literal syntax

The byte string literal syntax `b"whatever"` is more idiomatic than
`"whatever".as_bytes()`.

9 years agoRollup merge of #25537 - carols10cents:grammar-oops, r=alexcrichton
Manish Goregaokar [Mon, 18 May 2015 03:25:38 +0000 (08:55 +0530)]
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...? :flushed:

9 years agoRollup merge of #25530 - peferron:doc-closures-whitespace-fix, r=alexcrichton
Manish Goregaokar [Mon, 18 May 2015 03:25:38 +0000 (08:55 +0530)]
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))

9 years agoRollup merge of #25526 - chellmuth:patch-1, r=alexcrichton
Manish Goregaokar [Mon, 18 May 2015 03:25:37 +0000 (08:55 +0530)]
Rollup merge of #25526 - chellmuth:patch-1, r=alexcrichton

9 years agoAuto merge of #25541 - klutzy:remove-packed-attr, r=alexcrichton
bors [Mon, 18 May 2015 01:32:26 +0000 (01:32 +0000)]
Auto merge of #25541 - klutzy:remove-packed-attr, r=alexcrichton

The attribute was removed by #16499.

9 years agoFix finish docs
Steven Fackler [Mon, 18 May 2015 01:09:35 +0000 (18:09 -0700)]
Fix finish docs

9 years agoMake debug builders take &mut self, add entries method
Steven Fackler [Sun, 17 May 2015 20:17:26 +0000 (13:17 -0700)]
Make debug builders take &mut self, add entries method

[breaking-change]

9 years agotypo
mdinger [Mon, 18 May 2015 00:09:11 +0000 (20:09 -0400)]
typo

9 years agoAuto merge of #25527 - inrustwetrust:const-not-overflow, r=alexcrichton
bors [Sun, 17 May 2015 23:53:41 +0000 (23:53 +0000)]
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.

9 years agoAuto merge of #25523 - nham:remove_E0068, r=alexcrichton
bors [Sun, 17 May 2015 22:13:30 +0000 (22:13 +0000)]
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.

9 years agoAdd 'active' class to current page in rustbook table of contents
Sean Collins [Sun, 17 May 2015 21:05:23 +0000 (17:05 -0400)]
Add 'active' class to current page in rustbook table of contents

9 years agoMake #[derive(Debug)] work with unsized fields
Steven Fackler [Sun, 17 May 2015 21:03:37 +0000 (14:03 -0700)]
Make #[derive(Debug)] work with unsized fields

Closes #25394

9 years agoAdd error explanations for E0072, E0073, E0121, E0178, E0371, E0372.
Nick Hamann [Thu, 14 May 2015 20:42:35 +0000 (15:42 -0500)]
Add error explanations for E0072, E0073, E0121, E0178, E0371, E0372.

9 years agoAuto merge of #25454 - steveklabnik:r_doc_fix, r=alexcrichton
bors [Sun, 17 May 2015 19:40:50 +0000 (19:40 +0000)]
Auto merge of #25454 - steveklabnik:r_doc_fix, r=alexcrichton

9 years agosyntax: Remove unused `packed` attribute
klutzy [Sun, 17 May 2015 15:25:31 +0000 (00:25 +0900)]
syntax: Remove unused `packed` attribute

The attribute was removed by #16499.

9 years agoRevert "Panic if the grammar verifier sees a token it doesn't recognize"
Carol Nichols [Sat, 16 May 2015 18:31:52 +0000 (14:31 -0400)]
Revert "Panic if the grammar verifier sees a token it doesn't recognize"

This reverts commit 9c7d5ae57c27ebfc019c2c23283bb905d8c3b74f.

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 :-/

9 years agoFix doc whitespace issues
peferron [Sun, 17 May 2015 09:48:09 +0000 (02:48 -0700)]
Fix doc whitespace issues

9 years agoAuto merge of #25524 - Manishearth:unsafe_derive, r=cmr
bors [Sun, 17 May 2015 09:26:30 +0000 (09:26 +0000)]
Auto merge of #25524 - Manishearth:unsafe_derive, r=cmr

9 years agoAllow #[derive()] to generate unsafe methods
Manish Goregaokar [Sun, 17 May 2015 05:58:19 +0000 (11:28 +0530)]
Allow #[derive()] to generate unsafe methods

9 years agoFix compile-time integer overflow when using ! on unsigned values
inrustwetrust [Sun, 17 May 2015 08:04:15 +0000 (10:04 +0200)]
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.

9 years agoFix typo in references-and-borrowing docs
Chris Hellmuth [Sun, 17 May 2015 07:19:53 +0000 (00:19 -0700)]
Fix typo in references-and-borrowing docs

9 years agoAuto merge of #25525 - Manishearth:rollup, r=Manishearth
bors [Sun, 17 May 2015 06:25:58 +0000 (06:25 +0000)]
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:

9 years agoRollup merge of #25522 - alexcrichton:reexport-incoming, r=sfackler
Manish Goregaokar [Sun, 17 May 2015 06:25:40 +0000 (11:55 +0530)]
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

9 years agoRollup merge of #25516 - bstrie:cstrdoc, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:40 +0000 (11:55 +0530)]
Rollup merge of #25516 - bstrie:cstrdoc, r=alexcrichton

No need for `&b"foo"[..]` to make a CString, `"foo"` will do.

9 years agoRollup merge of #25510 - thelostt:patch-1, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:40 +0000 (11:55 +0530)]
Rollup merge of #25510 - thelostt:patch-1, r=alexcrichton

The same example for ``reverse`` were in the ``reserve_exact``'s example.

9 years agoRollup merge of #25508 - johshoff:visit_dirs_example, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:40 +0000 (11:55 +0530)]
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.

9 years agoRollup merge of #25506 - Wilfred:master, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:39 +0000 (11:55 +0530)]
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.

9 years agoRollup merge of #25503 - brson:betafix, r=cmr
Manish Goregaokar [Sun, 17 May 2015 06:25:39 +0000 (11:55 +0530)]
Rollup merge of #25503 - brson:betafix, r=cmr

9 years agoRollup merge of #25493 - coffeejunk:update_installed_rust_version, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:39 +0000 (11:55 +0530)]
Rollup merge of #25493 - coffeejunk:update_installed_rust_version, r=alexcrichton

Rust is out of beta :tada:

r? @steveklabnik

9 years agoRollup merge of #25490 - huachaohuang:patch-1, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:39 +0000 (11:55 +0530)]
Rollup merge of #25490 - huachaohuang:patch-1, r=alexcrichton

9 years agoRollup merge of #25484 - sumito3478:fix-deadlink-in-complement-lang-faq, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:38 +0000 (11:55 +0530)]
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.

9 years agoRollup merge of #25476 - rpjohnst:master, r=huonw
Manish Goregaokar [Sun, 17 May 2015 06:25:38 +0000 (11:55 +0530)]
Rollup merge of #25476 - rpjohnst:master, r=huonw

Closes #18173

9 years agoRollup merge of #25474 - achanda:fix_email, r=nikomatsakis
Manish Goregaokar [Sun, 17 May 2015 06:25:38 +0000 (11:55 +0530)]
Rollup merge of #25474 - achanda:fix_email, r=nikomatsakis

9 years agoRollup merge of #25472 - WillEngler:book-tiny-typo-fixes, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:38 +0000 (11:55 +0530)]
Rollup merge of #25472 - WillEngler:book-tiny-typo-fixes, r=alexcrichton

This PR fixes two little typos in the Dining Philosophers example.

Also, there are two style points that may have been oversights but may have been deliberate, so I'll just bring them up here:

1) In the last paragraph, you say

> You’ll notice we can introduce a new binding to `table` here, and it will shadow the old one. This is often used so that you don’t need to come up with two unique names.

You already said something similar to this in the Guessing Game, but maybe you intended for this example to be independent of that one.

2) In "Rust Inside Other Languages," you introduce the idea of the "global interpreter lock" and then refer to it as the GIL a few paragraphs later without explicitly stating that GIL == global interpreter lock. It's reasonable to expect readers to make the connection, but maybe that's not what you intended.

Excellent work on the examples! Congrats on 1.0!

r? @steveklabnik

9 years agoRollup merge of #25469 - ecoal95:patch-1, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:38 +0000 (11:55 +0530)]
Rollup merge of #25469 - ecoal95:patch-1, r=alexcrichton

Just detected it while reading.

9 years agoRollup merge of #25465 - Ryman:patch-2, r=alexcrichton
Manish Goregaokar [Sun, 17 May 2015 06:25:37 +0000 (11:55 +0530)]
Rollup merge of #25465 - Ryman:patch-2, r=alexcrichton

r? @steveklabnik

9 years agoRemove error about obsolete dereferencing of newtype structs.
Nick Hamann [Sun, 17 May 2015 06:12:11 +0000 (01:12 -0500)]
Remove error about obsolete dereferencing of newtype structs.

A built-in feature enabling the dereferencing of newtype structs was removed
in PR #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.

9 years agostd: Reexport std::net::tcp::Incoming
Alex Crichton [Sun, 17 May 2015 05:24:13 +0000 (22:24 -0700)]
std: Reexport std::net::tcp::Incoming

This iterator was mistakenly not reexported at the top level, preventing
actually naming the type!

Closes #25519

9 years agoSimplify CString doc comment
Ben Striegel [Sun, 17 May 2015 02:30:25 +0000 (22:30 -0400)]
Simplify CString doc comment

No need for `&b"foo"[..]` to make a CString, `"foo"` will do.

9 years agoAuto merge of #25458 - P1start:arc-dst, r=huonw
bors [Sun, 17 May 2015 01:41:52 +0000 (01:41 +0000)]
Auto merge of #25458 - P1start:arc-dst, r=huonw

9 years agoAuto merge of #25387 - eddyb:syn-file-loader, r=nikomatsakis
bors [Sun, 17 May 2015 00:05:34 +0000 (00:05 +0000)]
Auto merge of #25387 - eddyb:syn-file-loader, r=nikomatsakis

This allows compiling entire crates from memory or preprocessing source files before they are tokenized.

Minor API refactoring included, which is a [breaking-change] for libsyntax users:
* `ParseSess::{next_node_id, reserve_node_ids}` moved to rustc's `Session`
* `new_parse_sess` -> `ParseSess::new`
* `new_parse_sess_special_handler` -> `ParseSess::with_span_handler`
* `mk_span_handler` -> `SpanHandler::new`
* `default_handler` -> `Handler::new`
* `mk_handler` -> `Handler::with_emitter`
* `string_to_filemap(sess source, path)` -> `sess.codemap().new_filemap(path, source)`

9 years agoMake error message consistent with source code
peferron [Sun, 17 May 2015 00:01:25 +0000 (17:01 -0700)]
Make error message consistent with source code

The source code uses `"whatever".as_bytes()`, not `b"whatever"`.

9 years agoFixed reserve_exact example
Mário Feroldi [Sat, 16 May 2015 23:59:20 +0000 (20:59 -0300)]
Fixed reserve_exact example

The same example for ``reverse`` were in the ``reserve_exact``'s example.

9 years agoMake `Arc` support DSTs
P1start [Sat, 16 May 2015 23:25:17 +0000 (11:25 +1200)]
Make `Arc` support DSTs

9 years agotest/compile-fail: fix expected error message for non-UTF8 source.
Eduard Burtescu [Sat, 16 May 2015 23:15:00 +0000 (02:15 +0300)]
test/compile-fail: fix expected error message for non-UTF8 source.

9 years agofs::walk_dir example without unstable features
Johannes Hoff [Sat, 16 May 2015 23:07:52 +0000 (16:07 -0700)]
fs::walk_dir example without unstable features

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.

9 years agoAvoid calling a variable 'string' when discussing strings.
Wilfred Hughes [Sat, 16 May 2015 22:52:28 +0000 (23:52 +0100)]
Avoid calling a variable 'string' when discussing strings.

Newcomers to Rust need to learn the distinctinion between `&str` and
`String`, so additonally having `string` in an example risks confusion.

9 years agoAuto merge of #25463 - jeremyschlatter:master, r=alexcrichton
bors [Sat, 16 May 2015 22:29:56 +0000 (22:29 +0000)]
Auto merge of #25463 - jeremyschlatter:master, r=alexcrichton

9 years agoMake a test compatible with the beta channel
Brian Anderson [Sat, 16 May 2015 21:53:37 +0000 (14:53 -0700)]
Make a test compatible with the beta channel

9 years agoAuto merge of #25485 - XuefengWu:24968_err_msg_parse_self_type_2, r=nrc
bors [Sat, 16 May 2015 20:53:42 +0000 (20:53 +0000)]
Auto merge of #25485 - XuefengWu:24968_err_msg_parse_self_type_2, r=nrc

fix #24968
report more friendly error message for Self when fn args
copy from https://github.com/rust-lang/rust/pull/25096
r? @nrc  @arielb1

9 years agoAuto merge of #25434 - dotdash:gep, r=alexcrichton
bors [Sat, 16 May 2015 19:17:30 +0000 (19:17 +0000)]
Auto merge of #25434 - dotdash:gep, r=alexcrichton

Using regular pointer arithmetic to iterate collections of zero-sized types
doesn't work, because we'd get the same pointer all the time. Our
current solution is to convert the pointer to an integer, add an offset
and then convert back, but this inhibits certain optimizations.

What we should do instead is to convert the pointer to one that points
to an i8\*, and then use a LLVM GEP instructions without the inbounds
flag to perform the pointer arithmetic. This allows to generate pointers
that point outside allocated objects without causing UB (as long as you
don't dereference them), and it wraps around using two's complement,
i.e. it behaves exactly like the wrapping_* operations we're currently
using, with the added benefit of LLVM being able to better optimize the
resulting IR.

9 years agostd: Fix missing stability on iter::Cloned
Alex Crichton [Sat, 16 May 2015 18:27:08 +0000 (11:27 -0700)]
std: Fix missing stability on iter::Cloned

The method was stabilized but the structure was forgotten to be stabilized.

Closes #25480

9 years agostd: Add an unstable method Child::id
Alex Crichton [Thu, 16 Apr 2015 16:44:05 +0000 (09:44 -0700)]
std: Add an unstable method Child::id

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.