Commit Graph

47779 Commits

Author SHA1 Message Date
Steve Klabnik
e2906dbeac Clean up formatting on std main page
Part of #29330
2015-10-30 17:18:26 -04:00
Stepan Koltsov
46068c9daf Fix excessive memory allocation in RawVec::reserve
Before this patch `reserve` function allocated twice as requested
amount elements (not twice as capacity).  It leaded to unnecessary
excessive memory usage in scenarios like this:

```
let mut v = Vec::new();
v.push(17);
v.extend(0..10);
println!("{}", v.capacity());
```

`Vec` allocated 22 elements, while it could allocate just 11.

`reserve` function must have a property of keeping `push` operation
cost (which calls `reserve`) `O(1)`. To achieve this `reserve` must
exponentialy grow its capacity when it does reallocation.

There's better strategy to implement `reserve`:

```
let new_capacity = max(current_capacity * 2, requested_capacity);
```

This strategy still guarantees that capacity grows at `O(1)` with
`reserve`, and fixes the issue with `extend`.

Patch imlpements this strategy.
2015-10-31 00:17:16 +03:00
Andrew Paseltiner
04266daf77 Implement CoerceUnsized for Unique
Closes rust-lang/rfcs#1343.
2015-10-30 16:38:29 -04: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
Alex Crichton
f351b69edd Revert "Build compiler-rt/builtins with MSVC"
This reverts commit b09e8f51a2.
2015-10-30 10:36:38 -07:00
Alex Crichton
9e99367316 Revert "Update compiler-rt"
This reverts commit 6e61c6f119.
2015-10-30 10:36:34 -07:00
bors
2aa9f7d391 Auto merge of #29468 - ronindev:patch-1, r=alexcrichton
There are no `rm` commands on windows. But windows has `del`
2015-10-30 16:18:11 +00:00
Alexis Beingessner
e351595c61 don't use drop_in_place as an intrinsic 2015-10-30 11:24:54 -04:00
Alexis Beingessner
e72c226bed expose drop_in_place as ptr::drop_in_place 2015-10-30 10:54:25 -04:00
pierzchalski
054e409651 Add JSON parser rule for custom_unwind_resume. 2015-10-30 20:17:01 +11:00
Igor Shuvalov
66425568b3 Fixed delete command on Windows 2015-10-30 09:25:55 +03:00
bors
914c4dbc2a Auto merge of #29458 - tshepang:better, r=alexcrichton
I see that `extend()` is not called if new_len > len()
2015-10-30 01:28:12 +00:00
bors
2e07996a9b Auto merge of #29199 - tshepang:they-can, r=steveklabnik 2015-10-29 23:39:34 +00:00
Tshepang Lekhonkhobe
37735b4d6d run rustfmt on std::path
There was a bunch of manual fixes too... rustfmt isn't quite there yet
2015-10-30 01:15:00 +02:00
bors
7646fcfe54 Auto merge of #29452 - SimonSapin:patch-14, r=alexcrichton
… I think.
2015-10-29 20:46:44 +00: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
Tshepang Lekhonkhobe
d7a5aba2d3 doc: fix and expand explanation
I see that `extend()` is not called if new_len > len()
2015-10-29 21:40:56 +02:00
Tshepang Lekhonkhobe
615275b7b8 doc: make example more simple 2015-10-29 21:11:24 +02:00
bors
4d11db6501 Auto merge of #29129 - cuviper:impl-from-for-floats, r=alexcrichton
This is a spiritual successor to #28921, completing the "upcast" idea from rust-num/num#97.
2015-10-29 18:55:12 +00:00
Vadim Petrochenkov
61cbc84480 Make fields and macro defs exported 2015-10-29 21:54:55 +03:00
bors
a18e0b2707 Auto merge of #29445 - igpay:patch-1, r=alexcrichton
This documentation confused me when trying to use truncate on a project. Originally, it was unclear whether truncate removed the last `len` elements, or whether it cut down the vector to be exactly `len` elements long. The example was also ambiguous.
2015-10-29 16:03:46 +00:00
Simon Sapin
4e8b8707bf Typo fix
… I think.
2015-10-30 01:00:39 +09:00
bors
01fd4d6227 Auto merge of #29450 - defuz:patch-1, r=steveklabnik
r? @steveklabnik
2015-10-29 13:09:12 +00:00
bors
427140f771 Auto merge of #29188 - nikomatsakis:remove-contraction, r=pnkfelix
This fixes #29048 (though I think adding better transactional support would be a better fix for that issue, but that is more difficult). It also simplifies region inference and changes the model to a pure data flow one, as discussed in [this internals thread](https://internals.rust-lang.org/t/rough-thoughts-on-the-impl-of-region-inference-mir-etc/2800). I am not 100% sure though if this PR is the right thing to do -- or at least maybe not at this moment, so thoughts on that would be appreciated.

r? @pnkfelix 
cc @arielb1
2015-10-29 11:14:27 +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
Ms2ger
9e135f7b15 Rename categorization and stop re-exporting its variants. 2015-10-29 09:38:11 +01:00
bors
2af9aabf3a Auto merge of #29441 - Ryman:match_refactor_msg, r=alexcrichton
This helps for the case where a match, such as below:
```rust
let foo = match foo {
    Some(x) => x,
    None => 0
};
```
gets refactored to no longer need the match, but the match keyword has been left accidentally: 

```rust
let foo = match foo.unwrap_or(0);
```

This can be hard to spot as the expression grows more complex.

r? @alexcrichton
2015-10-29 06:56:52 +00:00
bors
3896a00536 Auto merge of #29432 - taralx:patch-2, r=alexcrichton
Discarding errors is bad, m'kay?
2015-10-29 05:08:56 +00:00
bors
e8e6892e3c Auto merge of #29289 - DiamondLovesYou:pnacl-std-crates, r=alexcrichton 2015-10-29 03:20:13 +00:00
Cameron Sun
39289d00fd Update docstring for truncate
This documentation confused me when trying to use truncate on a project. Originally, it was unclear whether truncate removed the last `len` elements, or whether it cut down the vector to be exactly `len` elements long. The example was also ambiguous.
2015-10-28 21:38:46 -04:00
bors
b4af35f7b1 Auto merge of #29444 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #29264, #29405, #29417, #29435, #29437, #29438
- Failed merges:
2015-10-29 01:25:34 +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
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
319e97bfcf Rollup merge of #29437 - brson:authors, r=alexcrichton 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
Steve Klabnik
2f0b4ddfa9 Rollup merge of #29417 - pmarcelll:assert-doc, r=steveklabnik
…m message

I recently discovered that this is not mentioned in the docs, only in
the examples, and it's not evident for people coming from C++

r? @steveklabnik
2015-10-28 20:27:34 -04:00
Steve Klabnik
3f3b55bd4d Rollup merge of #29405 - pmarcelll:docs-fix, r=steveklabnik
Fixes #29401.

r? @steveklabnik
2015-10-28 20:27:34 -04:00
Steve Klabnik
43c553a7d3 Rollup merge of #29264 - mdinger:colorify, r=steveklabnik
This is an alternative to https://github.com/rust-lang/rust/pull/29240 which fixes #15307 by adding colors to primitives and aliases instead of underlining.

Try to keep the discussion in https://github.com/rust-lang/rust/pull/29240 for now though so it can be kept track of.

A sample rendering is [here](http://mdinger.github.io/rust_std_colored/std/index.html)
2015-10-28 20:27:34 -04:00
bors
8ca0acc25a Auto merge of #29425 - apasel422:issue-29030, r=alexcrichton
Closes #29030.

r? @alexcrichton
2015-10-28 23:31:31 +00:00
Josh Stone
1a19f9877a Comment how the significand limits lossless int->float conversion 2015-10-28 16:05:51 -07:00
Niko Matsakis
c2277de673 Move test file to run-fail, since it does an unwrap 2015-10-28 18:48:49 -04:00
Niko Matsakis
690206c74a Do some slight refactoring, leave the rest for #29436 2015-10-28 18:48:49 -04:00
Niko Matsakis
9ef241656f Update docs for region inference to reflect current state better 2015-10-28 18:48:49 -04:00
Niko Matsakis
c81ce8249c Don't "double check" var-sub-var constraints, which are handled in
expansion already by growing the RHS to be bigger than LHS (all the way
to `'static` if necessary). This is needed because contraction doesn't
handle givens. Fixes #28934.
2015-10-28 18:48:49 -04:00
Niko Matsakis
6934618b7d remove SupSupConflict, which is now dead code 2015-10-28 18:48:49 -04:00
Niko Matsakis
18698c80c7 Regression test for #29048. Fixes #29048. 2015-10-28 18:48:49 -04:00
Niko Matsakis
41bca6dd76 Remove contraction. The contraction rules predated the notion of an
empty region, and they complicate region inference to no particular end.
They also lead in some cases to spurious errors like #29048 (though in
some cases these errors are helpful in tracking down missing
constraints).
2015-10-28 18:48:49 -04:00
Niko Matsakis
60ab57e56d do not dump extern def-ids with path for now 2015-10-28 18:48:49 -04:00
Kevin Butler
99ecf4e2c9 libsyntax: improve error message when a statement is prefixed with a match keyword 2015-10-28 22:32:07 +00:00