Commit Graph

47843 Commits

Author SHA1 Message Date
Alex Crichton 8588654783 std: Prevent print panics when using TLS
Currently if a print happens while a thread is being torn down it may cause a
panic if the LOCAL_STDOUT TLS slot has been destroyed by that point. This adds a
guard to check and prints to the process stdout if that's the case (as we do for
if the slot is already borrowed).

Closes #29488
2015-10-31 09:41:21 -07:00
bors 1a2eaffb63 Auto merge of #29487 - sfackler:current-exe-docs, r=steveklabnik
The "optionally" stuff just makes things confusing.

r? @steveklabnik
2015-10-31 14:13:43 +00:00
bors 57a0df6db5 Auto merge of #29489 - Ms2ger:fmt-ri, r=Manishearth
CC @nrc
2015-10-31 10:58:41 +00:00
Ms2ger eb5c0a6b68 Rustfmt region_inference. 2015-10-31 11:31:52 +01:00
Steven Fackler 4af19537b2 Tweak env docs a bit
The "optionally" stuff just makes things confusing.
2015-10-30 22:13:32 -07:00
bors fa7a3c210d Auto merge of #29484 - steveklabnik:gh29330, r=brson
These two commits do a few things:

1. reformat to 80 cols
2. use the reference-style links where appropriate for improved in-source readability
3. adds a few links, tweaks a couple of words, `3` -> `three`, stuff like that

While the diff is big due to these edits, there's no significant content change.

r? @brson
2015-10-31 04:04:45 +00:00
bors ee88e04e77 Auto merge of #29480 - apasel422:coerce-unique, r=alexcrichton
Closes rust-lang/rfcs#1343.
2015-10-31 01:58:51 +00:00
Vadim Petrochenkov 3468b8d42c Remove PatWildMulti 2015-10-31 03:44:43 +03:00
bors 11ba81e105 Auto merge of #29477 - alexcrichton:revert-compiler-rt, r=brson
This ended up causing regressions in a few builds I've seen:

* MinGW -- [64-bit](https://ci.appveyor.com/project/alexcrichton/gcc-rs/build/1.0.338/job/2c4pkxgxa2dvqs25) and [32-bit](https://ci.appveyor.com/project/alexcrichton/gcc-rs/build/1.0.338/job/d0n7kml3k5el9gla)
- MSVC - [64-bit with VS 12.0](https://ci.appveyor.com/project/alexcrichton/gcc-rs/build/job/ugldcage9ydoy1k6) and [32-bit with VS 12.0](https://ci.appveyor.com/project/alexcrichton/gcc-rs/build/job/pn59p4rhnj8gybei).

I suspect the problems are along the lines of:

* The emutls support needs to be disabled on Windows, it currently always used pthreads which isn't available
* The objects in compiler-rt either need to be built without a CRT or not specifically against the static one.
2015-10-31 00:09:39 +00:00
bors 64b0277643 Auto merge of #29454 - stepancheg:vec-reserve, r=bluss
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-30 22:23:41 +00:00
Steve Klabnik 744df28758 Some fixes to std index docs
Part of https://github.com/rust-lang/rust/issues/29330

Needed because of https://github.com/rust-lang/rust/issues/29481 and https://github.com/rust-lang/rust/issues/29483
2015-10-30 17:43:05 -04:00
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
Brian Anderson 018c468e18 Address release notes feedback 2015-10-29 11:36:56 -07: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