Commit Graph

63365 Commits

Author SHA1 Message Date
Niko Matsakis
8388772f42 kill a bunch of one off tasks 2017-04-18 08:20:12 -04:00
Ariel Ben-Yehuda
ed3810bf5e lower move_val_init during MIR construction
Because of its "magic" order-of-evaluation semantics, `move_val_init`
must be lowered during MIR construction in order to work.
2017-04-18 15:09:11 +03:00
Ariel Ben-Yehuda
3e473b1aaa use Lvalue helper functions in rustc_mir::shim 2017-04-18 15:05:04 +03:00
bors
c398efc53f Auto merge of #39271 - est31:add_float_bits, r=BurntSushi
Add functions to safely transmute float to int

The safe subset of Rust tries to be as powerful as possible. While it is very powerful already, its currently impossible to safely transmute integers to floats. While crates exist that provide a safe interface, most prominently the `iee754` crate (which also inspired naming of the added functions), they themselves only use the unsafe `mem::transmute` function to accomplish this task.

Also, including an entire crate for just two lines of unsafe code seems quite wasteful.

That's why this PR adds functions to safely transmute integers to floats and vice versa, currently gated by the newly added `float_bits_conv` feature.

The functions added are no niche case. Not just `ieee754` [currently implements](https://github.com/huonw/ieee754/blob/master/src/lib.rs#L441) float to int transmutation via unsafe code but also the [very popular `byteorder` crate](https://github.com/BurntSushi/byteorder/blob/1.0.0/src/lib.rs#L258). This functionality of byteorder is in turn used by higher level crates. I only give two examples out of many: [chor](a7363ea9aa/src/ser.rs (L227)) and [bincode](f06a4cfcb5/src/serde/reader.rs (L218)).

One alternative would be to manually use functions like pow or multiplication by 1 to get a similar result, but they only work in the int -> float direction, and are not bit exact, and much slower (also, most likely the optimizer will never optimize it to a transmute because the conversion is not bit exact while the transmute is).

Tracking issue: #40470
2017-04-18 11:23:44 +00:00
Niko Matsakis
810e0151af convert calls to visit_all_item_likes_in_krate
We no longer need to track the tasks in these cases since these
particular tasks have no outputs (except, potentially, errors...)  and
they always execute.
2017-04-18 07:08:40 -04:00
bors
e621e1c73f Auto merge of #41357 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests

- Successful merges: #41262, #41310, #41344
- Failed merges:
2017-04-18 04:15:13 +00:00
Corey Farwell
8f65bb450f Rollup merge of #41344 - Diggsey:remove-natvis-nbsp, r=alexcrichton
Remove non-breaking spaces from natvis files

Visual studio will see natvis files with non-breaking spaces as invalid XML, and will ignore them.
2017-04-17 23:21:19 -04:00
Corey Farwell
24e8158213 Rollup merge of #41310 - eddyb:demand-const-eval, r=nikomatsakis
[on-demand] Turn monomorphic_const_eval into a proper query, not just a cache.

The error definitions and reporting logic, alongside with `eval_length` were moved to `librustc`.
Both local and cross-crate constant evaluation is on-demand now, but the latter is only used for `enum` discriminants, to replace the manual insertion into the cache which was done when decoding variants.

r? @nikomatsakis
2017-04-17 23:21:18 -04:00
Corey Farwell
b8c446eab8 Rollup merge of #41262 - jonhoo:compiler-barrier-rename, r=alexcrichton
Rename compiler_barrier to compiler_fence

This addresses concerns raised following the merge of #41092. Specifically:

> The naming of these seems surprising: the multithreaded functions (and both the single and multithreaded intrinsics themselves) are fences, but this is a barrier. It's not incorrect, but the latter is both inconsistent with the existing functions and slightly confusing with another type in std (e.g., `Barrier`).

`compiler_fence` carries the same semantic implication that this is a compiler-only operation, while being more in line with the fence/barrier concepts already in use in `std`.
2017-04-17 23:21:17 -04:00
Richo Healey
1dbc72b28e bootstrap: Don't workaround uname -m on Darwin
This no longer manifests on any versions of OSX that I could find.
2017-04-17 19:30:18 -07:00
bors
6b2aaaf668 Auto merge of #41340 - eddyb:demand-assoc-defids, r=nikomatsakis
rustc: move associated_item_def_ids to an on-demand query.

r? @nikomatsakis
2017-04-18 01:18:14 +00:00
Alex Crichton
e3ad1b58f5 Disable debuginfo when compiling tools
Currently the Cargo binary has jumped from 14M to 34M on the beta channel, which
appears to be due to the fact that we're compiling tools with debug information
inside them. This additionally means that the `rls` binary is 62M right now!

This wasn't an intentional change, so be sure to disable debuginfo when
compiling tools as it's just intended for the standard library and compile for
now.
2017-04-17 18:16:53 -07:00
est31
0c148153f4 Add float_bits_conv to unstable book 2017-04-18 02:55:47 +02:00
est31
873a3b0363 Allow us to remove masking in the future 2017-04-18 02:43:16 +02:00
est31
3993eb4a27 Preserve sNaN payload when converting them to quiet NaNs 2017-04-18 02:43:16 +02:00
est31
fc028b8180 Convert sNaN to quiet NaN instead of returning errors 2017-04-18 02:43:16 +02:00
est31
bdab5cdc63 assert_ne and tracking issue 2017-04-18 02:43:16 +02:00
est31
56760abf3b Add examples heading 2017-04-18 02:43:16 +02:00
est31
82eead0d0b Return Err(()) when trying to convert sNaN representation to float 2017-04-18 02:43:16 +02:00
est31
32a43da68a Add functions to safely transmute float to int 2017-04-18 02:43:16 +02:00
Dylan Maccora
2877a01feb Address review comments 2017-04-18 08:29:05 +10:00
bors
235fe8313f Auto merge of #41282 - arielb1:missing-impl-item, r=petrochenkov
libsyntax/parse: fix missing kind error reporting

Fixes #41161.
Fixes #41239.
2017-04-17 22:22:56 +00:00
lukaramu
32132d9fb6 Expand std::path::Display's docs
Part of #29368.
* Added explanation for why the struct exists
* Added link to where it is created
* Added example
2017-04-17 22:51:12 +02:00
lukaramu
51ca5fe716 Restructure and redistribute std::path's module docs
Part of #29368.
* Added a new summary paragraph about std::path's parsing facilities
* Slightly exanded `Component`'s docs
* removed the now redundant section on component types from the module docs
* moved the section on path normalization during parsing to the docs on
  `Path::components`
* Clarified difference between `Prefix` and `PrefixComponent` in their
  respecive summary sentences
2017-04-17 22:37:27 +02:00
Ariel Ben-Yehuda
d648c10e5b libsyntax/parse: improve associated item error reporting
Fixes #41161.
Fixes #41239.
2017-04-17 21:25:35 +03:00
bors
5516bcc458 Auto merge of #41345 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests

- Successful merges: #41012, #41280, #41290
- Failed merges:
2017-04-17 17:56:29 +00:00
Corey Farwell
07c6295137 Rollup merge of #41290 - GuillaumeGomez:put-back-hoedown, r=steveklabnik
Hoedown big comeback!

```bash
> cargo +local test
   Compiling libc v0.2.20
   Compiling sysinfo v0.3.4 (file:///Users/imperio/rust/sysinfo)
    Finished dev [unoptimized + debuginfo] target(s) in 3.2 secs
     Running target/debug/deps/disk_list-dbd70897f1f7e080

running 1 test
test test_disks ... ok

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

     Running target/debug/deps/sysinfo-8ad11103abdf5941

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests sysinfo
WARNING: src/sysinfo.rs -  (line 45) test will be run in the next rustdoc version. If it's not supposed to, please update your documentation and make it compliant to common mark specifications.
WARNING: src/sysinfo.rs -  (line 48) test will be run in the next rustdoc version. If it's not supposed to, please update your documentation and make it compliant to common mark specifications.

running 1 test
test src/sysinfo.rs -  (line 14) ... ok

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

r? @rust-lang/docs
2017-04-17 13:26:21 -04:00
Corey Farwell
4ae25a60ba Rollup merge of #41280 - QuietMisdreavus:rustdoc-toc, r=GuillaumeGomez
rustdoc: add a list of headings to the sidebar

It's another misdreavus rustdoc PR, which means it's time for Bikeshed City once again! `:3`

In an effort to aid navigation in long documentation pages, this PR adds a listing of headings to the sidebars of pages where such headings exist. For example, for structs, links to their fields, inherent methods, and trait implementations are available where applicable.

Examples:

* Modules/Crate roots
  ![image](https://cloud.githubusercontent.com/assets/5217170/25019930/1000fa3a-2052-11e7-98ff-ddf5af18b3e6.png)
* Enums
  ![image](https://cloud.githubusercontent.com/assets/5217170/25019954/33497f9e-2052-11e7-88cf-df46f1b3b8a3.png)
* Primitives
  ![image](https://cloud.githubusercontent.com/assets/5217170/25019978/4820bbc6-2052-11e7-8b5a-96a864eb2a5b.png)
* Traits
  ![image](https://cloud.githubusercontent.com/assets/5217170/25020093/bd1bc9f2-2052-11e7-9cd1-00a0ad8007bc.png)
* Structs
  ![image](https://cloud.githubusercontent.com/assets/5217170/25020145/d75206b0-2052-11e7-88cc-9e9525084775.png)

Open questions:

* Right now, these kinds of pages (and also unions) are the only pages that will receive the name header - pages for functions, constants, macros, etc, won't have the corresponding name in their sidebar. Should I print the name regardless and only add table-of-contents links for pages that have them? This would make them match, for example, a struct with no public fields, no methods, and no trait implementations. The latter would still have a "Struct MyStruct" line above the module contents, with no header links to speak of, whereas a function wouldn't even have "Function my\_function".
* This is only a header listing, but there has been requests to include a more-complete listing of fields/methods/traits/etc, for example in #41123.
2017-04-17 13:26:20 -04:00
Corey Farwell
914b6f1f14 Rollup merge of #41012 - durka:vis-matcher, r=petrochenkov
:vis matcher for macro_rules

Resurrection of @DanielKeep's implementation posted with [RFC 1575](https://github.com/rust-lang/rfcs/pull/1575).

@jseyfried was of the opinion that this doesn't need an RFC.

Needed before merge:

- [x] sign-off from @DanielKeep since I stole his code
- [x] feature gate
- [x] docs
2017-04-17 13:26:19 -04:00
Diggory Blake
1528cbefdb Remove non-breaking spaces 2017-04-17 17:49:35 +01:00
Guillaume Gomez
bee0291320 Add hoedown COPYRIGHT back 2017-04-17 18:10:03 +02:00
Guillaume Gomez
695354af9c Remove hoedown from tidy check 2017-04-17 18:10:03 +02:00
Guillaume Gomez
cbf8342efe Hoedown big comeback! 2017-04-17 18:10:03 +02:00
QuietMisdreavus
27bfbd56f0 rustdoc: add a list of headings to the sidebar 2017-04-17 10:41:13 -05:00
Eduard-Mihai Burtescu
17fce06c18 rustc: move associated_item_def_ids to an on-demand query. 2017-04-17 18:15:22 +03:00
bors
011f240b89 Auto merge of #41264 - alexeyzab:41158-fix-docs, r=steveklabnik
Fix old docs

Fixes #41158
2017-04-17 15:10:23 +00:00
alexey zabelin
08a955af68
Adjust description 2017-04-17 10:48:23 -04:00
Evgeny Safronov
bbdf190c6a fix: remove field_init_shorthand from SUMMARY.md 2017-04-17 09:41:12 +03:00
lukaramu
8c21b60136 Expand and add examples to std::path::{Prefix, PrefixComponent}'s docs
Part of #29368.
2017-04-17 00:24:46 +02:00
bors
5997806a6a Auto merge of #41157 - aidanhs:aphs-debug-appveyor-cache, r=TimNN
Add a comment for disabling errexit, try to debug appveyor cache

Comments added as requested.

Also, lets add some cache debugging to appveyor. I *think* this is how to ignore errors in cmd.exe (and I did try it on my own machine), but I'm not 100% sure how appveyor runs them. In the worst case it'll fail but I guess that isn't the end of the world since the build has already failed by this point.

r? @TimNN
2017-04-16 22:24:36 +00:00
bors
7627e3d31d Auto merge of #40409 - mbrubeck:calloc, r=sfackler
Specialize Vec::from_elem to use calloc

Fixes #38723.  This specializes the implementation for `u8` only, but it could be extended to other zeroable types if desired.

I haven't tested this extensively, but I did verify that it gives the expected performance boost for large `vec![0; n]` allocations with both alloc_system and jemalloc, on Linux.  (I have not tested or even built the Windows code.)
2017-04-16 19:13:52 +00:00
bors
9af79f52d0 Auto merge of #41329 - nagisa:bitflags-repr-options, r=eddyb
Compress ReprOptions a little bit

r? @eddyb
2017-04-16 16:47:18 +00:00
Jeremy Soller
1bc9e5da23 Fix stdio descriptors in exec by removing cloexec if present. Use dup2 instead of dup 2017-04-16 09:33:32 -06:00
bors
fef1026bae Auto merge of #41308 - eddyb:order-must-be-preserved, r=nagisa
[rustbuild] Side-step HashMap iteration to preserve command-line step order.

The new `HashMap` was introduced by #41227 and it accidentally randomized step order.

r? @alexcrichton
2017-04-16 13:44:22 +00:00
Simonas Kazlauskas
fcbd898502 Compress ReprOptions a little bit 2017-04-16 16:17:13 +03:00
Eduard-Mihai Burtescu
cd64ff9438 rustc_typeck: fix binops needing more type informations to coerce. 2017-04-16 06:25:18 +03:00
Eduard-Mihai Burtescu
6dc21b71cf rustc: use monomorphic const_eval for cross-crate enum discriminants. 2017-04-16 01:31:37 +03:00
Eduard-Mihai Burtescu
63064ec190 rustc: expose monomorphic const_eval through on-demand. 2017-04-16 01:31:06 +03:00
Eduard-Mihai Burtescu
8854164d0c rustc_const_eval: move ConstEvalErr to the rustc crate. 2017-04-16 01:31:06 +03:00
bors
13fd5e93de Auto merge of #41320 - Mark-Simulacrum:cleanup-methodmatch, r=arielb1
Remove MethodMatchResult and MethodMatchedData.

These two enums were unused.

Fixes #41318.

r? @nikomatsakis
2017-04-15 22:15:53 +00:00