Commit Graph

40498 Commits

Author SHA1 Message Date
Niko Matsakis
d6466ff13a Driveby cleanup of the impl for negation, which had some kind of
surprising casts. This version more obviously corresponds to the builtin
semantics.
2015-03-30 04:59:56 -04:00
Niko Matsakis
d649292e60 Implement new type-checking strategy for binary operators. Basically,
the plan is to treat all binary operators as if they were overloaded,
relying on the fact that we have impls for all the builtin scalar
operations (and no more). But then during writeback we clear the
overload if the types correspond to a builtin op.

This strategy allows us to avoid having to know the types of the
operands ahead of time. It also avoids us overspecializing as we did in
the past.
2015-03-30 04:59:56 -04:00
bors
f00264074f Auto merge of #23843 - apasel422:thrads, r=steveklabnik 2015-03-30 08:49:18 +00:00
Tshepang Lekhonkhobe
d9252bde18 book: improve a bit of grammar in Method Syntax chapeter 2015-03-30 07:10:09 +02:00
bors
f55d03c8d8 Auto merge of #23838 - kgv:master, r=steveklabnik
Remove the last sentence about standard io chapter.

Additional Fixes #23760
2015-03-30 04:22:38 +00:00
bors
c748864485 Auto merge of #23837 - wesleywiser:patch-1, r=alexcrichton
Fixes #23397
2015-03-30 01:31:34 +00:00
bors
d8be84eb44 Auto merge of #23830 - petrochenkov:spellcheck, r=steveklabnik
With help of https://github.com/lucasdemarchi/codespell

r? @steveklabnik
2015-03-29 22:39:46 +00:00
Andrew Hobden
d4b5f65afc Fix line spacing. 2015-03-29 15:25:06 -07:00
Andrew Paseltiner
bf9c27d885 s/THRADS/THREADS/ 2015-03-29 17:22:21 -04:00
Germano Gabbianelli
b77a09c17e Fixed wrong name of test module in testing.md
The documentation says that 'The current convention is to use the `test` module
to hold your "unit-style"' but then defines the module as "tests" instead.
2015-03-29 22:50:51 +02:00
kgv
f575acaf5f Remove about standard io chapter from the book (from arrays-vectors-and-slices chapter)
Remove the last sentence about standard io chapter.

Additional Fixes #23760
2015-03-29 23:26:31 +03:00
bors
92f3d9a6b4 Auto merge of #23820 - sfackler:fast_read_to_end, r=alexcrichton
with_end_to_cap is enormously expensive now that it's initializing
memory since it involves 64k allocation + memset on every call. This is
most noticable when calling read_to_end on very small readers, where the
new version if **4 orders of magnitude** faster.

BufReader also depended on with_end_to_cap so I've rewritten it in its
original form.

As a bonus, converted the buffered IO struct Debug impls to use the
debug builders.

I first came across this in sfackler/rust-postgres#106 where a user reported a 10x performance regression. A call to read_to_end turned out to be the culprit: 9cd413d42c.

The new version differs from the old in a couple of ways. The buffer size used is now adaptive. It starts at 32 bytes and doubles each time EOF hasn't been reached up to a limit of 64k. In addition, the buffer is only truncated when EOF or an error has been reached, rather than after every call to read as was the case for the old implementation.

I wrote up a benchmark to compare the old version and new version: https://gist.github.com/sfackler/e979711b0ee2f2063462

It tests a couple of different cases: a high bandwidth reader, a low bandwidth reader, and a low bandwidth reader that won't return more than 10k per call to `read`. The high bandwidth reader should be analagous to use cases when reading from e.g. a `BufReader` or `Vec`, and the low bandwidth readers should be analogous to reading from something like a `TcpStream`.

Of special note, reads from a high bandwith reader containing 4 bytes are now *4,495 times faster*. 
```
~/foo ❯ cargo bench
   Compiling foo v0.0.1 (file:///home/sfackler/foo)
     Running target/release/foo-7498d7dd7faecf5c

running 13 tests
test test_new ... ignored
test new_delay_4      ... bench:    230768 ns/iter (+/- 14812)
test new_delay_4_cap  ... bench:    231421 ns/iter (+/- 7211)
test new_delay_5m     ... bench:  14495370 ns/iter (+/- 4008648)
test new_delay_5m_cap ... bench:  73127954 ns/iter (+/- 59908587)
test new_nodelay_4    ... bench:        83 ns/iter (+/- 2)
test new_nodelay_5m   ... bench:  12527237 ns/iter (+/- 335243)
test std_delay_4      ... bench:    373095 ns/iter (+/- 12613)
test std_delay_4_cap  ... bench:    374190 ns/iter (+/- 19611)
test std_delay_5m     ... bench:  17356012 ns/iter (+/- 15906588)
test std_delay_5m_cap ... bench: 883555035 ns/iter (+/- 205559857)
test std_nodelay_4    ... bench:    144937 ns/iter (+/- 2448)
test std_nodelay_5m   ... bench:  16095893 ns/iter (+/- 3315116)

test result: ok. 0 passed; 0 failed; 1 ignored; 12 measured
```

r? @alexcrichton
2015-03-29 19:47:18 +00:00
Wesley Wiser
2a1bad70dd Fix extremely small stability bars on docs page
Fixes #23397
2015-03-29 15:14:02 -04:00
Andrew Hobden
1a5e73a82d Fix trailing whitespace. Whoops! 2015-03-29 11:06:38 -07:00
Andrew Hobden
e489eaa0c5 Update std::error example
To not use `old_io` and `os`, which are deprecated. Since there is no more `MemoryMap` used byte parsing instead to generate the second potential error.
2015-03-29 10:03:49 -07:00
bors
c5370be36e Auto merge of #23816 - frewsxcv:fromiterator-example, r=Manishearth 2015-03-29 16:54:40 +00:00
Corey Farwell
8fe7f1fa97 Add an example for FromIterator::from_iter 2015-03-29 10:32:53 -04:00
bors
b27ba527c5 Auto merge of #23831 - Manishearth:rollup, r=Manishearth
- Successful merges: #23811, #23814, #23817, #23821, #23829
- Failed merges:
2015-03-29 14:02:28 +00:00
Manish Goregaokar
9147463678 Rollup merge of #23829 - huachaohuang:master, r=Manishearth 2015-03-29 18:22:16 +05:30
Manish Goregaokar
963bf1db61 Rollup merge of #23821 - nicholasbishop:bishop-slice-iter-typo-fix, r=alexcrichton 2015-03-29 18:22:16 +05:30
Manish Goregaokar
a96ee9d962 Rollup merge of #23817 - phildawes:master, r=alexcrichton
Hello! I noticed that the email address in AUTHORS.txt doesn't point to my home email. Could somebody merge this patch to correct it please?

Thanks very much!
2015-03-29 18:22:16 +05:30
Manish Goregaokar
5daab4a25b Rollup merge of #23814 - steveklabnik:gh23320, r=alexcrichton
Fixes #23320
2015-03-29 18:22:15 +05:30
Manish Goregaokar
ef94b8a9d3 Rollup merge of #23811 - alexcrichton:libc-stable, r=Manishearth
Right now the `std::isize::BYTES` typedef is `#[unstable]`, but liblibc is using
this, preventing it from compiling on stable Rust.
2015-03-29 18:22:15 +05:30
bors
ea03ad9616 Auto merge of #23809 - cmr:issue-21310, r=Manishearth
This isn't really possible to test in an automatic way, since the only traits
you can negative impl are `Send` and `Sync`, and the implementors page for
those only exists in libstd.

Closes #21310
2015-03-29 11:12:26 +00:00
Huachao Huang
58c7d6f3e1 Fix typo 2015-03-29 18:22:01 +08:00
Corey Richardson
e64b677ca6 mk: don't build docs for internal or behind-the-facade crates in beta/stable
This saves a bunch of a time and will make distributions smaller, as well as
avoiding filling the implementors page with internal garbage. Turn it back on
with `--enable-compiler-docs` if you want compiler docs during development.

Crates behind the facade are only documented on nightly/dev builds (where they
can be used).

[breaking-change]

Closes #23772
Closes #21297
2015-03-29 06:15:51 -04:00
bors
fa3d778626 Auto merge of #23787 - steveklabnik:gh23760, r=alexcrichton
This was originally used to set up the guessing game, but that no longer
exists. This version uses `old_io`, and updating it involves talking
about `&mut` and such, which we haven't covered yet. So, for now, let's
just remove it.

Fixes #23760
2015-03-29 08:14:30 +00:00
Steven Fackler
ccb4e8423e Fix massive performance issue in read_to_end
with_end_to_cap is enormously expensive now that it's initializing
memory since it involves 64k allocation + memset on every call. This is
most noticable when calling read_to_end on very small readers, where the
new version if **4 orders of magnitude** faster.

BufReader also depended on with_end_to_cap so I've rewritten it in its
original form.

As a bonus, converted the buffered IO struct Debug impls to use the
debug builders.

Fixes #23815
2015-03-28 22:32:08 -07:00
bors
227b46bded Auto merge of #23810 - sfackler:debug-collections, r=alexcrichton
The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
2015-03-29 05:21:29 +00:00
Steven Fackler
3c0c8fc43a Oops fix output examples 2015-03-28 21:59:23 -07:00
bors
27af78c6dd Auto merge of #23819 - pnkfelix:kill-unsafe-dtor, r=pnkfelix
Port of pcwalton removal of `#[unsafe_destructor]` check.

Earlier commits impose rules on lifetimes that make generic destructors safe; thus we no longer need the `#[unsafe_destructor]` attribute nor its associated check.

----

So remove the check for the unsafe_destructor attribute.

And remove outdated compile-fail tests from when lifetime-parameteric dtors were disallowed/unsafe.

In addition, when one uses the attribute without the associated feature, report that the attribute is deprecated.

However, I do not think this is a breaking-change, because the attribute and feature are still currently accepted by the compiler. (After the next snapshot that has this commit, we can remove the feature itself and the attribute as well.)

----

I consider this to:

Fix #22196

(technically there is still the post snapshot work of removing the last remnants of the feature and the attribute, but the ticket can still be closed in my opinion).
2015-03-29 02:33:27 +00:00
Nicholas Bishop
256e78a39c Fix typo in docstring for slice 2015-03-28 22:06:42 -04:00
Felix S. Klock II
64c48f390c Port of pcwalton removal of #[unsafe_destructor] check.
Earlier commits impose rules on lifetimes that make generic
destructors safe; thus we no longer need the `#[unsafe_destructor]`
attribute nor its associated check.

----

So remove the check for the unsafe_destructor attribute.

And remove outdated compile-fail tests from when lifetime-parameteric
dtors were disallowed/unsafe.

In addition, when one uses the attribute without the associated
feature, report that the attribute is deprecated.

However, I do not think this is a breaking-change, because the
attribute and feature are still currently accepted by the compiler.
(After the next snapshot that has this commit, we can remove the
feature itself and the attribute as well.)

----

I consider this to:

Fix #22196

(techincally there is still the post snapshot work of removing the
last remants of the feature and the attribute, but the ticket can
still be closed in my opinion).
2015-03-29 00:19:19 +01:00
Steven Fackler
842e6cf63e Fold in debug builder doc examples 2015-03-28 15:51:57 -07:00
Phil Dawes
80c188e3c0 Correct Phil Dawes email address 2015-03-28 22:26:00 +00:00
bors
c89de2c56b Auto merge of #23300 - sfackler:rm-iterator-ext, r=alexcrichton
All methods are inlined into Iterator with `Self: Sized` bounds to make
sure Iterator is still object safe.

[breaking-change]

This is blocked on ICEs: https://gist.github.com/sfackler/5aff7c57cf8d896e2c6f
Seem to be similar to #23281.
2015-03-28 22:11:49 +00:00
Steven Fackler
d502f4221f Remove IteratorExt
All methods are inlined into Iterator with `Self: Sized` bounds to make
sure Iterator is still object safe.

[breaking-change]
2015-03-28 13:53:45 -07:00
Steve Klabnik
f6c234fb45 Document properties for Eq + Hash
Fixes #23320
2015-03-28 16:06:37 -04:00
Steve Klabnik
9fb54f87cc Remove standard io chapter from the book
This was originally used to set up the guessing game, but that no longer
exists. This version uses `old_io`, and updating it involves talking
about `&mut` and such, which we haven't covered yet. So, for now, let's
just remove it.

Fixes #23760
2015-03-28 14:29:29 -04:00
Steven Fackler
b82bcec7ce Fold collections debug impls
Also convert [T]'s Debug impl. The behavior of the alternate flag here's
changing.
2015-03-28 11:24:26 -07:00
Alex Crichton
bd66f57e46 libc: Don't use unstable apis
Right now the `std::isize::BYTES` typedef is `#[unstable]`, but liblibc is using
this, preventing it from compiling on stable Rust.
2015-03-28 10:49:45 -07:00
Steven Fackler
4037f2a368 Update debug helpers and add list builder
The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
2015-03-28 10:33:51 -07:00
bors
01f2c67c96 Auto merge of #23807 - vhbit:ios-int-drop, r=alexcrichton
None
2015-03-28 17:14:44 +00:00
Valerii Hiora
6b7c5b9f08 iOS: int/uint fallout 2015-03-28 17:18:03 +02:00
Vadim Petrochenkov
1accaa9f86 Fix some typos 2015-03-28 18:09:51 +03:00
bors
3e7385aae9 Auto merge of #23806 - Manishearth:rollup, r=Manishearth
- Successful merges: #23332, #23751, #23788, #23803, #23804
- Failed merges:
2015-03-28 12:42:45 +00:00
Manish Goregaokar
95f4061c49 Rollup merge of #23804 - dnwade:patch-1, r=Manishearth
r? @steveklabnik
2015-03-28 18:12:06 +05:30
Manish Goregaokar
5eb4be4c56 Rollup merge of #23803 - richo:unused-braces, r=Manishearth
Pretty much what it says on the tin.
2015-03-28 18:12:06 +05:30
Manish Goregaokar
4aa17c80e6 Rollup merge of #23788 - steveklabnik:gh23748, r=alexcrichton
Fixes #23748
2015-03-28 18:12:04 +05:30
Manish Goregaokar
5299d36c52 Rollup merge of #23751 - tshepang:do-not-hardcode-the-growth, r=Manishearth
I found the arbitrary `10` surprising. A better method name, in such a case, would be `grow_by_10` :)
2015-03-28 18:12:04 +05:30