Commit graph

43553 commits

Author SHA1 Message Date
bors
effcd29652 Auto merge of #29543 - Amanieu:asm_mem_constraint, r=alexcrichton
The "m" memory constraint in inline assembly is broken (generates incorrect code or triggers LLVM asserts) and should not be used. Instead, indirect memory operands should be used with "\*m", "=\*m" and "+\*m".

Clang does this transparently by transforming "m" constraints into "\*m" indirect constraints, but for now just being able to use "\*m" directly is enough since asm! isn't stable.

While "\*m" works fine as an input operand, "=\*m" and "+\*m" need to be specified as input operands because they take a pointer value as an input. This PR relaxes the constraint checker to allow constraints starting with "=" or "+" if the constraint string contains a "\*", which indicates an indirect operand.

This (indirectly) fixes these issues: #29382, #16383 and #13366. The code will need to be changed to use "\*m" instead of "m".
2015-11-04 20:39:49 +00:00
Niko Matsakis
3e6b4545f9 Introduce a SwitchInt and restructure pattern matching to collect
integers and characters into one master switch.
2015-11-04 15:38:43 -05:00
bors
4ee11cd210 Auto merge of #29536 - sanxiyn:unused-assign-arg, r=alexcrichton
Fix #29136.
2015-11-04 18:52:07 +00:00
Björn Steinbrink
5a35f498f3 [MIR-trans] Fix handling of non-alloca temps in trans_operand_into() 2015-11-04 19:30:04 +01:00
Björn Steinbrink
fe3a609b0b [MIR-trans] Fix handling of small aggregate arguments
Function arguments that are small aggregates get passed as integer types
instead. To correctly handle that, we need to use store_ty instead of
plain Store.
2015-11-04 16:20:23 +01:00
bors
11e55e4de1 Auto merge of #29564 - gereeter:no-freevar-refcell, r=sanxiyn 2015-11-04 15:13:49 +00:00
arcnmx
efdf9aa52f target_family configuration 2015-11-04 09:33:09 -05:00
bors
14db074659 Auto merge of #29528 - amitsaha:rust-inside-other-languages-minor, r=nikomatsakis
When referring to the different shared library extensions, specify the OS explicitly.
2015-11-04 13:24:50 +00:00
Steve Klabnik
a118aa270a Mention [T]::sort is stable in docs
Fixes #27322
2015-11-04 12:44:31 +01:00
bors
1be3f9f602 Auto merge of #29200 - tshepang:rustfmt-path, r=aturon 2015-11-04 11:37:50 +00:00
Steve Klabnik
0c93e727c2 Mention multiple impl blocks in TRPL
Fixes #29322
2015-11-04 10:35:09 +01:00
Steve Klabnik
e9989d526d Add note about HashMap::capacity's bounds
Fixes #24591
2015-11-04 10:19:54 +01:00
Steve Klabnik
2f4fbb2bf5 Merge first three chapters into one.
Conceptually, this makes more sense as one introductory chapter.
2015-11-04 10:06:50 +01:00
bors
1ad89e0de6 Auto merge of #29550 - nrc:save-root, r=alexcrichton 2015-11-04 08:39:44 +00:00
Toby Scrace
6fb2333d77 Fix #29542
Reword "Writing the logic" paragraph to prevent `unwrap` being confused
for a macro.
2015-11-04 07:42:54 +00:00
Steven Fackler
d0bc6a1f49 Don't chain method calls in #[derive(Debug)]
Closes #29540
2015-11-03 22:48:28 -08:00
bors
cc403b6c33 Auto merge of #29478 - angelsl:msvc2, r=alexcrichton
r? @alexcrichton
2015-11-04 06:07:24 +00:00
Jonathan S
fb2129e043 Remove the RefCell around freevars and freevars_seen in librustc_resolve 2015-11-03 23:45:47 -06:00
angelsl
9fe4e962e1 Build compiler-rt/builtins with MSVC 2015-11-04 11:43:41 +08:00
bors
a216e84727 Auto merge of #29217 - nikomatsakis:mir-trans, r=dotdash
This branch implements a variant of trans that is based on MIR. It is very incomplete (intentionally), and had only the goal of laying out enough work to enable more incremental follow-on patches. Currently, only fns tagged with `#[rustc_mir]` use the new trans code. I plan to build up a meta-issue as well that tracks the various "not-yet-implemented" points. The only fn that has been tested so far is this amazingly complex "spike" fn:

```rust
#[rustc_mir]
fn sum(x: i32, y: i32) -> i32 {
    x + y
}
```

In general, the most interesting commit is the last one. There are some points on which I would like feedback from @rust-lang/compiler:

- I did not use `Datum`. Originally, I thought that maybe just a `ValueRef` would be enough but I wound up with two very simple structures, `LvalueRef` and `OperandRef`, that just package up a `ValueRef` and a type. Because of MIR's structure, you don't wind up mixing by-ref and by-value so much, and I tend to think that a thinner abstraction layer is better here, but I'm not sure.
- Related to the above, I expect that sooner or later we will analyze temps (and maybe variables too) to find those whose address is never taken and which are word-sized and which perhaps meet a few other criteria. For those, we'll probably want to avoid the alloca, just because it means prettier code.
- I generally tried to re-use data structures from elsewhere in trans, though I'm sure we can trim these down.
- I didn't do any debuginfo primarily because it seems to want node-ids and we have only spans. I haven't really read into that code so I don't know what's going on there.

r? @nrc
2015-11-04 02:13:05 +00:00
Niko Matsakis
e78786315b remove unused import 2015-11-03 20:38:02 -05:00
bors
c340ea1de5 Auto merge of #29547 - arielb1:speculative-upvar, r=eddyb
`resolve_identifier` used to mark a variable as an upvar when used within a closure. However, the function is also used for the "unnecessary qualification" lint, which would mark paths whose last component had the same name as a local as upvars.

Fixes #29522 

r? @eddyb
2015-11-04 00:30:05 +00:00
Niko Matsakis
b46c0fc497 address nits from dotdash 2015-11-03 18:00:35 -05:00
Niko Matsakis
9c9f4be9df correct typos 2015-11-03 18:00:30 -05:00
Niko Matsakis
6a5b263503 Add (and use) an analysis to determine which temps can forgo an alloca. 2015-11-03 18:00:30 -05:00
Nick Cameron
6252af9ce1 save-analysis: emit the crate root 2015-11-04 10:16:06 +13:00
bors
708e319f80 Auto merge of #29545 - mystor:vec-deque-test-panic, r=bluss
I think this should fix the test failures in debug mode from #29492

The assertion was written incorrectly, and I don't like the way the new assertion is written, but I _think_ it does the right thing now.
2015-11-03 21:12:03 +00:00
bors
2a7bd082ac Auto merge of #29532 - Ryman:cow_path, r=alexcrichton 2015-11-03 19:29:44 +00:00
Ariel Ben-Yehuda
ca04855a06 resolve: don't speculatively create freevars when resolving
Fixes #29522
2015-11-03 21:08:42 +02:00
Amanieu d'Antras
59c5191c21 Add test for inline asm indirect memory operands 2015-11-03 18:13:03 +00:00
Michael Layzell
26db71783f Correct incorrect assertion in VecDeque::wrap_copy 2015-11-03 13:03:36 -05:00
angelsl
54d85b4f2f Update compiler-rt 2015-11-04 01:41:46 +08:00
Kevin Butler
f57621535e libcollections: DRY up a PartialEq impl for String 2015-11-03 17:41:42 +00:00
Kevin Butler
cc830ef18b libstd: implement PartialEq<Path> for PathBuf and Cow<Path> 2015-11-03 17:41:42 +00:00
bors
de11d2aa83 Auto merge of #29529 - Ryman:rustdoc-cap-lints, r=alexcrichton
This sets the `cap-lints` setting to 'allow' for all doc compilations. There's precedent for this as rustdoc [already whitelists unstable code](https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs#L112) when compiling documentation, with the expectation being that a regular compile will complain about any problems. I think the same justification applies here.

Problem case in the wild: https://github.com/laumann/compiletest-rs/pull/28

r? @Manishearth
2015-11-03 17:02:13 +00:00
Amanieu d'Antras
1805e5fb48 Allow indirect operands to be used as inputs for inline asm 2015-11-03 15:19:46 +00:00
bors
4aa1f59e1e Auto merge of #29515 - Manishearth:ice-itembody, r=eddyb
r? @eddyb or @nrc
2015-11-03 15:19:07 +00:00
Manish Goregaokar
6468292c35 Fix ICE with unresolved associated items in closures (fixes #28971) 2015-11-03 20:09:20 +05:30
bors
c143ae7764 Auto merge of #29495 - meqif:fix_unindent_tabs, r=steveklabnik
A line may be indented with either spaces or tabs, but not a mix of both. If there is a mix of tabs and spaces, only the kind that occurs first is counted.

This addresses issue #29268.
2015-11-03 13:34:09 +00:00
Jake Goulding
b0ca039233 Mention what iterator terminators do with an empty iterator 2015-11-03 08:25:56 -05:00
Steve Klabnik
75a6d51750 Make some edits as per No Starch.
Lots of little details and things.
2015-11-03 13:56:06 +01:00
Bruno Tavares
bf7c92038e Closes #24954 2015-11-03 10:20:45 -02:00
Toby Scrace
d9df16bf61 Fix #29533
This replaces usage of the (missing) `fatal!` macro with `panic!`.
2015-11-03 11:46:05 +00:00
Niko Matsakis
544b06d455 Add a MIR visitor 2015-11-03 06:34:23 -05:00
Kevin Butler
7690ec89ff libstd: implement From<&Path|PathBuf> for Cow<Path> 2015-11-03 11:25:34 +00:00
Seo Sanghyeon
61e5b6dfdb Warn unused_assignments for arguments 2015-11-03 19:04:36 +09:00
Niko Matsakis
e84829d51d Plumbing to omit allocas for temps when possible (currently unused) 2015-11-03 04:35:00 -05:00
Niko Matsakis
02017b30eb New trans codepath that builds fn body from MIR instead. 2015-11-03 04:35:00 -05:00
Niko Matsakis
877b93add2 Move shifting code out of expr and into somewhere more accessible 2015-11-03 04:35:00 -05:00
Niko Matsakis
81ff2c2f8e Change adt case handling fn to be less tied to match 2015-11-03 04:35:00 -05:00
Niko Matsakis
0a62158a4e Add helper methods that require tcx; these compute types of
lvalues and operands
2015-11-03 04:35:00 -05:00
Niko Matsakis
044096b3e9 Change Call operands to be, well, Operands 2015-11-03 04:35:00 -05:00
Niko Matsakis
3ab29d3378 Add adt_def into Switch, since it's convenient to have in trans 2015-11-03 04:35:00 -05:00
Niko Matsakis
b5d3580843 Move the "HAIR" code that reads the tcx tables etc out of the tcx
module and into `hair/cx`, now that we don't have a trait defining
the interface
2015-11-03 04:35:00 -05:00
Niko Matsakis
3c07b46118 Pass the mir map to trans 2015-11-03 04:34:59 -05:00
Niko Matsakis
15c1da4e27 Convert from using named fields to always using indices 2015-11-03 04:34:59 -05:00
Niko Matsakis
1e30f3e52b Change ShallowDrop to Free, so that it matches what trans will do 2015-11-03 04:34:59 -05:00
Niko Matsakis
88a9c3e764 Build the MIR using the liberated fn sigs, and track the return type 2015-11-03 04:34:59 -05:00
Niko Matsakis
6d7c66e6e8 Introduce a "liberated fn sigs" map so that we have easy access to this
information when constructing MIR.
2015-11-03 04:34:59 -05:00
bors
eacd35984b Auto merge of #29459 - tshepang:simplify, r=steveklabnik 2015-11-03 08:18:45 +00:00
bors
fffe075708 Auto merge of #29523 - durka:patch-9, r=alexcrichton
`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-03 06:34:53 +00:00
bors
3330f54198 Auto merge of #29514 - apasel422:issue-26220, r=alexcrichton
Closes #26220.

r? @alexcrichton
2015-11-03 04:52:12 +00:00
bors
b7fbfb658e Auto merge of #29285 - eefriedman:libsyntax-panic, r=nrc
A set of commits which pushes some panics out of core parser methods, and into users of those parser methods.
2015-11-03 03:06:03 +00:00
bors
749625ad6d Auto merge of #29500 - vadimcn:rustlib, r=alexcrichton
According to a recent [discussion on IRC](https://botbot.me/mozilla/rust-tools/2015-10-27/?msg=52887517&page=2), there's no good reason for Windows builds to store target libraries under `bin`, when on every other platform they are under `lib`.

This might be a [breaking-change] for some users.  I am pretty sure VisualRust has that path hard-coded somewhere.

r? @brson
2015-11-03 01:23:10 +00:00
Amit Saha
900f36fde3 Specify Microsoft Windows and Mac OS X explicitly
When referring to the different shared library extensions, specify the OS explicitly.
2015-11-03 10:50:20 +11:00
Kevin Butler
b1ef5302d5 librustdoc: ignore lint warnings when compiling documentation 2015-11-02 23:44:53 +00:00
bors
e2bb53ca52 Auto merge of #29291 - petrochenkov:privacy, r=alexcrichton
The public set is expanded with trait items, impls and their items, foreign items, exported macros, variant fields, i.e. all the missing parts. Now it's a subset of the exported set.
This is needed for https://github.com/rust-lang/rust/pull/29083 because stability annotation pass uses the public set and all things listed above need to be annotated.
Rustdoc can now be migrated to the public set as well, I guess.

Exported set is now slightly more correct with regard to exported items in blocks - 1) blocks in foreign items are considered and 2) publicity is not inherited from the block's parent - if a function is public it doesn't mean structures defined in its body are public.

r? @alexcrichton or maybe someone else
2015-11-02 23:38:49 +00:00
Vadim Petrochenkov
ab7b3456d0 Parens + issue number + typo 2015-11-03 01:58:41 +03:00
bors
a1fd944eb8 Auto merge of #29456 - alexcrichton:path-hash, r=aturon
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 21:56:47 +00:00
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
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
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
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
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
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
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