Commit Graph

48381 Commits

Author SHA1 Message Date
Alex Crichton
d2dd700891 std: Base Hash for Path on its iterator
Almost all operations on Path are based on the components iterator in one form
or another to handle equivalent paths. The `Hash` implementations, however,
mistakenly just went straight to the underlying `OsStr`, causing these
equivalent paths to not get merged together.

This commit updates the `Hash` implementation to also be based on the iterator
which should ensure that if two paths are equal they hash to the same thing.

cc #29008, but doesn't close it
2015-11-02 12:58:54 -08:00
Alex Burka
983349ee99 remove #![feature(rc_unique)] from Rc docs
`Rc::try_unwrap` and `Rc::make_mut` are stable since 1.4.0, but the example code still has `#![feature(rc_unique)]`. Ideally the stable and beta docs would be updated, but I don't think that's possible...
2015-11-02 15:36:22 -05:00
bors
2249b07ae9 Auto merge of #29513 - apasel422:issue-23217, r=alexcrichton
Closes #23217.

r? @alexcrichton
2015-11-02 20:11:53 +00:00
Vadim Chugunov
8cf50bc1fd Merged windows and unix find_libdir() 2015-11-02 11:42:20 -08:00
bors
cf2319bbb6 Auto merge of #29510 - mneumann:dragonfly-guard-page, r=alexcrichton
Only tested on DragonFly.
2015-11-02 18:29:33 +00:00
Alex Crichton
6e27448973 mk: Add rtstartup to dist
Needed for distcheck to pass and to have a working tarball.
2015-11-02 08:45:38 -08:00
bors
033e142915 Auto merge of #29518 - KyleMayes:master, r=apasel422
Fixes one of the `expr` examples to be a correct expression

r? @steveklabnik
2015-11-02 14:41:31 +00:00
Kyle Mayes
6e5d78dba3 Minor fix to Rust Book, Macros chapter
Fixes one of the `expr` examples to be a proper expression
2015-11-02 08:52:05 -05:00
bors
5b11b286bc Auto merge of #28846 - Ms2ger:categorization, r=nikomatsakis 2015-11-02 10:44:08 +00:00
Ricardo Martins
a9cbf6c1c1 Accept tabs as indentation character
A line may be indented with both spaces or tabs. All leading whitespace
is trimmed, even if it is mixed.
2015-11-02 09:17:17 +00:00
bors
7caf54bc0f Auto merge of #29505 - rjbs:docs-where-type, r=steveklabnik
I read this section a few times before even having a guess what
was meant, then consulted IRC for confirmation.  It may be that I
was thick-headed, but I think this is a useful addition.
2015-11-02 08:01:56 +00:00
Ricardo Signes
21a0c40ab3 Attempt to clarify use of `where i32: ConvertTo<T>
I read this section a few times before even having a guess what
was meant, then consulted IRC for confirmation.  It may be that I
was thick-headed, but I think this is a useful addition.
2015-11-01 20:41:22 -05:00
Vadim Chugunov
363deb0864 Formatting 2015-11-01 16:24:51 -08:00
bors
9c2489be0c Auto merge of #29507 - fhartwig:result-expect, r=Manishearth
This fixes part of #29506
These instances of `ok().expect()` have no benefit over using `Result`'s `expect` directly.
2015-11-01 23:22:22 +00:00
Andrew Paseltiner
6ad6cc30ef Implement IntoIterator for &{Path, PathBuf}
Closes #26220.
2015-11-01 18:04:53 -05:00
Andrew Paseltiner
3c20bd4d81 Add test for #23217
Closes #23217.
2015-11-01 17:55:09 -05:00
Michael Neumann
9415450ace Use guard-pages also on DragonFly/FreeBSD.
Only tested on DragonFly.
2015-11-01 22:56:31 +01:00
bors
6307719a12 Auto merge of #29501 - Manishearth:pat-docs, r=alexcrichton
None
2015-11-01 21:42:18 +00:00
Vadim Chugunov
ab10cb7443 Clarify Windows gcc setup instructions. 2015-11-01 12:41:32 -08:00
bors
af6e413fdb Auto merge of #29471 - pierzchalski:custom-target-custom-unwind-json, r=alexcrichton 2015-11-01 20:00:07 +00:00
Florian Hartwig
4168e026b4 Stop using ok().expect() in Result docs 2015-11-01 20:41:23 +01:00
Florian Hartwig
f7a61678e3 Replace ok().expect() by Result::expect in trait chapter of trpl 2015-11-01 20:40:20 +01:00
bors
71409184dc Auto merge of #29177 - vadimcn:rtstuff, r=alexcrichton
Note: for now, this change only affects `-windows-gnu` builds.

So why was this `libgcc` dylib dependency needed in the first place?
The stack unwinder needs to know about locations of unwind tables of all the modules loaded in the current process.  The easiest portable way of achieving this is to have each module register itself with the unwinder when loaded into the process.  All modules compiled by GCC do this by calling the __register_frame_info() in their startup code (that's `crtbegin.o` and `crtend.o`, which are automatically linked into any gcc output).
Another important piece is that there should be only one copy of the unwinder (and thus unwind tables registry) in the process.  This pretty much means that the unwinder must be in a shared library (unless everything is statically linked). 

Now, Rust compiler tries very hard to make sure that any given Rust crate appears in the final output just once.   So if we link the unwinder statically to one of Rust's crates, everything should be fine.

Unfortunately, GCC startup objects are built under assumption that `libgcc` is the one true place for the unwind info registry, so I couldn't find any better way than to replace them.  So out go `crtbegin`/`crtend`, in come `rsbegin`/`rsend`!  

A side benefit of this change is that rustc is now more in control of the command line that goes to the linker, so we could stop using `gcc` as the linker driver and just invoke `ld` directly.
2015-11-01 17:15:29 +00:00
bors
6d43fef3aa Auto merge of #29486 - petrochenkov:multiwild, r=Manishearth
Motivation:
- It is not actually a pattern
- It is not actually needed, except for...

Drawback:
- Slice patterns like `[a, _.., b]` are pretty-printed as `[a, .., b]`. Great loss :(

plugin-[breaking-change], as always
2015-11-01 13:36:49 +00:00
Vadim Petrochenkov
306b0efc44 Add comment for stability.rs 2015-11-01 16:33:46 +03:00
Manish Goregaokar
8bb72cfe00 Add code formatting on PatVec docs 2015-11-01 16:37:12 +05:30
Manish Goregaokar
7e9d73cf2d Fix PatEnum docs 2015-11-01 16:32:51 +05:30
bors
a5fbb3a25f Auto merge of #29316 - GBGamer:change-unchecked-div-generic, r=eddyb
Similarly to the simd intrinsics. I believe this is a better solution than #29288, and I could implement it as well for overflowing_add/sub/mul. Also rename from udiv/sdiv to div, and same for rem.
2015-11-01 07:03:09 +00:00
Vadim Chugunov
4e0c6db67f Windows: Move target libraries to $rustroot/lib/rustlib/... - for symmetry with all other platforms. 2015-10-31 23:29:39 -07:00
bors
b252f4c826 Auto merge of #29496 - cpjreynolds:patch-1, r=apasel422
Corrects `write_bytes`'s documentation as the parameter name is `val` not `c`.
2015-11-01 04:23:18 +00:00
Vadim Chugunov
0332ee9f63 Fix stage0 ICE caused by the old _Unwind_Resume override trickery. 2015-10-31 18:52:37 -07:00
Cole Reynolds
87c9fd2b42 Minor documentation correction
Corrects `write_bytes`'s documentation as the parameter name is `val` not `c`.
2015-10-31 20:31:16 -04:00
Nicholas Mazzuca
579420fbdd Check unchecked_div|rem's specialisation
Similarly to the simd intrinsics.
2015-10-31 12:22:15 -07:00
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