Commit Graph

93079 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
e40f9a62bb
Rollup merge of #60657 - JohnTitor:stabilize-array, r=SimonSapin
Stabilize and re-export core::array in std

Fixes #60014
2019-05-09 18:34:58 +02:00
Mazdak Farrokhzad
671dd0992f
Rollup merge of #60656 - petertodd:2019-inline-cursor-over-slice, r=sfackler
Inline some Cursor calls for slices

(Partially) brings back https://github.com/rust-lang/rust/pull/33921

I've noticed in some serialization code I was writing that writes to slices produce much, much, worse code than you'd expect even with optimizations turned on. For example, you'd expect something like this to be zero cost:

```
use std::io::{self, Cursor, Write};

pub fn serialize((a, b): (u64, u64)) -> [u8;8+8] {
    let mut r = [0u8;16];
    {
        let mut w = Cursor::new(&mut r[..]);

        w.write(&a.to_le_bytes()).unwrap();
        w.write(&b.to_le_bytes()).unwrap();
    }
    r
}
```

...but it compiles down to [dozens of instructions](https://rust.godbolt.org/z/bdwDzb) because the `slice_write()` calls aren't inlined, which in turn means `unwrap()` can't be optimized away, and so on.

To be clear, this pull-req isn't sufficient by itself: if we want to go down that path we also need to add `#[inline]`'s to the default implementations for functions like `write_all()` in the `Write` trait and so on, or implement them separately in the `Cursor` impls. But I figured I'd start a conversation about what tradeoffs we're expecting here.
2019-05-09 18:34:56 +02:00
Mazdak Farrokhzad
26a7544aa3
Rollup merge of #60647 - petrochenkov:nospace, r=michaelwoerister
cleanup: Remove `DefIndexAddressSpace`

The scheme with two address spaces for `DefIndex` was needed in the past, but apparently not needed anymore (after removing `DefId`s from locals and `HirId`-ification).
2019-05-09 18:34:55 +02:00
Mazdak Farrokhzad
a74313b498
Rollup merge of #60638 - RalfJung:pin, r=sanxiyn
pin: make the to-module link more visible

Cc @gnzlbg
2019-05-09 18:34:53 +02:00
Mazdak Farrokhzad
8fd5587790
Rollup merge of #60601 - SimonSapin:cast, r=Kimundi
Add a `cast` method to raw pointers.

This is similar to `NonNull::cast`.

Compared to the `as` operator (which has a wide range of meanings depending on the input and output types), a call to this method:

* Can only go from a raw pointer to a raw pointer
* Cannot change the pointer’s `const`ness

… even when the pointed types are inferred based on context.
2019-05-09 18:34:51 +02:00
bors
ef01f29964 Auto merge of #60668 - Zoxc:hir-map-vec, r=matthewjasper
Fix typo
2019-05-09 12:42:16 +00:00
John Kåre Alsaker
f3993d0619 Fix typo 2019-05-09 13:56:14 +02:00
Yuki OKUSHI
028e78d93a Stabilize and re-export core::array 2019-05-09 12:50:55 +09:00
Peter Todd
b9c430129d
Inline some Cursor calls for slices
(Partially) brings back https://github.com/rust-lang/rust/pull/33921
2019-05-08 22:39:41 -04:00
bors
9f83961584 Auto merge of #60651 - Centril:rollup-zoamjfk, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #59979 (to_xe_bytes for isize and usize returns an array of different size)
 - #60491 (std: Update compiler-builtins crate)
 - #60550 (Add tests for concrete const types)
 - #60572 (Add test for #59972)
 - #60627 (test for #50518)
 - #60634 (Document + Cleanup lang_items.rs)
 - #60641 (Instead of ICEing on incorrect pattern, use delay_span_bug)
 - #60644 (Use `delay_span_bug` for "Failed to unify obligation")

Failed merges:

r? @ghost
2019-05-08 22:59:23 +00:00
Mazdak Farrokhzad
f683b6b799
Rollup merge of #60644 - estebank:abolish-ice, r=varkor
Use `delay_span_bug` for "Failed to unify obligation"

Fix #60283.
2019-05-09 00:58:32 +02:00
Mazdak Farrokhzad
0597292967
Rollup merge of #60641 - estebank:defer-ice, r=oli-obk
Instead of ICEing on incorrect pattern, use delay_span_bug

Fix #60635.
2019-05-09 00:58:31 +02:00
Mazdak Farrokhzad
450ad65bb2
Rollup merge of #60634 - Centril:lang-items-docs, r=oli-obk
Document + Cleanup lang_items.rs

Byproduct of work on https://github.com/rust-lang/rust/issues/60607.

r? @oli-obk
2019-05-09 00:58:29 +02:00
Mazdak Farrokhzad
d20b692756
Rollup merge of #60627 - matklad:test, r=estebank
test for #50518

It was fixed somewhere between 1.28.0 and 1.31.1

closes #50518

r? @estebank

Where's the best place to add this test? I *think* we want "compile-pass" for this test (no need to run a binary, and not running saves us a millisecond of process creation) , but there's no compile-pass anymore.

Should this be UI test with empty stdout, stderr and zero return code?
2019-05-09 00:58:28 +02:00
Mazdak Farrokhzad
b04f87fede
Rollup merge of #60572 - tmandry:issue-59972, r=RalfJung,oli-obk
Add test for #59972

This PR adds a test for #59972, which was fixed in #59897.

Closes #59972.

r? @eddyb
2019-05-09 00:58:26 +02:00
Mazdak Farrokhzad
59ff11393d
Rollup merge of #60550 - skinny121:concrete_const_tests, r=varkor
Add tests for concrete const types

In response to the request for help in https://github.com/rust-lang/rust/issues/44580#issuecomment-488819344, I have added several ui tests around the use of concrete const types, i.e. A<2>.

r? @varkor
2019-05-09 00:58:25 +02:00
Mazdak Farrokhzad
cfed892cb3
Rollup merge of #60491 - alexcrichton:update-cb, r=nikomatsakis
std: Update compiler-builtins crate

Pulls in a fix for ensuring that wasm targets have code in
compiler-builtins for `ldexp` which LLVM can generate references to.
2019-05-09 00:58:23 +02:00
Mazdak Farrokhzad
229fff3d03
Rollup merge of #59979 - stepancheg:num-size, r=ehuss
to_xe_bytes for isize and usize returns an array of different size

... on different platforms.

Official rustdoc of
[`usize::to_le_bytes`](https://doc.rust-lang.org/std/primitive.usize.html#method.to_le_bytes)
displays signature

```
pub fn to_ne_bytes(self) -> [u8; 8]
```

which might be misleading: this function returns 4 bytes on 32-bit
systems.

With this commit applied rustdoc for `isize` and `usize` is this:
<img width="740" alt="2019-04-15_0020" src="https://user-images.githubusercontent.com/28969/56100765-9f69b380-5f14-11e9-974c-daa25edaa881.png">
2019-05-09 00:58:22 +02:00
Vadim Petrochenkov
ee6d315200 cleanup: Remove DefIndexAddressSpace 2019-05-09 00:46:38 +03:00
Esteban Küber
0fce5c1bf0 Use delay_span_bug for "Failed to unify obligation" 2019-05-08 11:42:47 -07:00
bors
3f5152e200 Auto merge of #60402 - michaelwoerister:update-profiler-rt-build, r=alexcrichton
libprofiler_builtins: Set compilation flags more correctly for C code.

In particular, set `COMPILER_RT_HAS_FCNTL_LCK` and `COMPILER_RT_HAS_ATOMICS` as appropriate. This should get rid of the various runtime warnings when executing instrumented binaries.

The build script is using a heuristic here that hopefully is sufficient for the time being.

r? @alexcrichton

Fixes #59531.
2019-05-08 18:38:14 +00:00
Esteban Küber
cc40f41ee5 Instead of ICEing on incorrect pattern, use delay_span_bug 2019-05-08 10:23:55 -07:00
bors
e6305805a7 Auto merge of #60626 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from fc96aa03 to 341c96af

Fixes clippy toolstate

Fixes https://github.com/rust-lang/rust/issues/60623

Changes:
````
rustup https://github.com/rust-lang/rust/pull/60586
Add test for #771.
Clean up while_loop tests
````

r? @Manishearth
2019-05-08 15:28:14 +00:00
Ralf Jung
cf0f2b041b pin: make the to-module link more visible 2019-05-08 17:21:05 +02:00
Michael Woerister
0ffc573110 AppVeyor: Update clang-cl from 7.0.0 to 8.0.0 2019-05-08 17:05:02 +02:00
Michael Woerister
e65ef96eaf libprofiler_builtins: Set compilation flags more correctly for C code.
In particular, set COMPILER_RT_HAS_FCNTL_LCK and COMPILER_RT_HAS_ATOMICS
as appropriate.
2019-05-08 17:02:58 +02:00
Alex Crichton
7e8035593d std: Update compiler-builtins crate
Pulls in a fix for ensuring that wasm targets have code in
compiler-builtins for `ldexp` which LLVM can generate references to.
2019-05-08 06:59:24 -07:00
Mazdak Farrokhzad
47768b2613 Document + Cleanup lang_items.rs 2019-05-08 15:31:09 +02:00
bors
d7f4a864e1 Auto merge of #60246 - Zoxc:hir-map-vec, r=eddyb
Optimize HIR map

Builds on https://github.com/rust-lang/rust/pull/59042

cc @ljedrz
r? @eddyb
2019-05-08 12:29:57 +00:00
John Kåre Alsaker
d33db6ed57 Rename HirMap to HirEntryMap and add some comments 2019-05-08 14:27:40 +02:00
Aleksey Kladov
c87d2ccf88 test for #50518
It was fixed somewhere between 1.28.0 and 1.31.1

closes #50518
2019-05-08 13:43:43 +03:00
John Kåre Alsaker
df5a0111be Optimize HIR map 2019-05-08 12:18:09 +02:00
ben
bfa15f3988 Add tests for concrete const types 2019-05-08 20:35:41 +12:00
bors
b92d360c6c Auto merge of #60378 - froydnj:apple-target-modifications, r=michaelwoerister
conditionally modify darwin targets to macosx targets with versions

We need this behavior so that Rust LLVM IR objects match the target triple for Clang LLVM IR objects.  This matching then convinces the linker that yes, you really can do cross-language LTO with objects from different compilers.

The newly-added tests seem to pass locally on x86_64-unknown-linux-gnu.  I haven't done a full test run or tried the new compiler in an cross-language LTO setup yet.
2019-05-08 08:26:48 +00:00
Matthias Krüger
152b26afc9 submodules: update clippy from fc96aa03 to 341c96af
Changes:
````
rustup https://github.com/rust-lang/rust/pull/60586
Add test for #771.
Clean up while_loop tests
````
2019-05-08 08:19:29 +02:00
bors
33cde4aac2 Auto merge of #60586 - cramertj:await, r=oli-obk
Implement built-in await syntax

Adds support for .await under the existing async_await feature gate.
Moves macro-like await! syntax to the await_macro feature gate.
Removes support for `await` as a non-keyword under the `async_await`
feature.

This new syntax is not final, but is the consensus solution proposed by the lang team, as explained in https://boats.gitlab.io/blog/post/await-decision/

Fix https://github.com/rust-lang/rust/issues/51719
Fix https://github.com/rust-lang/rust/issues/51751
Fix https://github.com/rust-lang/rust/issues/60016
2019-05-07 22:33:12 +00:00
Taylor Cramer
fe8760cb84 Implement built-in await syntax
Adds support for .await under the existing async_await feature gate.
Moves macro-like await! syntax to the await_macro feature gate.
Removes support for `await` as a non-keyword under the `async_await`
feature.
2019-05-07 14:45:53 -07:00
bors
cfdc84a009 Auto merge of #60612 - Centril:rollup-61drhqt, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #60489 (Remove hamburger button from source code page)
 - #60535 (Correct handling of arguments in async fn)
 - #60579 (Rename `ParamTy::idx` to `ParamTy::index`)
 - #60583 (Fix parsing issue with negative literals as const generic arguments)
 - #60609 (Be a bit more explicit asserting over the vec rather than the len)

Failed merges:

r? @ghost
2019-05-07 19:39:52 +00:00
Mazdak Farrokhzad
2d6da83763
Rollup merge of #60609 - spastorino:be-explicit-on-mem-replace-doc, r=Centril
Be a bit more explicit asserting over the vec rather than the len
2019-05-07 19:30:11 +02:00
Mazdak Farrokhzad
9995bb5855
Rollup merge of #60583 - varkor:const-generics-emplace, r=petrochenkov
Fix parsing issue with negative literals as const generic arguments
2019-05-07 19:30:09 +02:00
Mazdak Farrokhzad
e280818cb0
Rollup merge of #60579 - varkor:typaram-index, r=eddyb
Rename `ParamTy::idx` to `ParamTy::index`

This makes it consistent with `ParamConst` and `EarlyBoundRegion`.
2019-05-07 19:30:07 +02:00
Mazdak Farrokhzad
535db2f357
Rollup merge of #60535 - taiki-e:async-fn-arguments, r=cramertj
Correct handling of arguments in async fn

Fixes #60509
Fixes #60566

r? @cramertj or @davidtwco
2019-05-07 19:30:06 +02:00
Mazdak Farrokhzad
4e233583d0
Rollup merge of #60489 - GuillaumeGomez:remove-hamburger, r=QuietMisdreavus
Remove hamburger button from source code page

Fixes #60483.

Screenshot:

<img width="575" alt="Screenshot 2019-05-03 at 00 12 51" src="https://user-images.githubusercontent.com/3050060/57110298-61ec8f00-6d38-11e9-85fd-d13be94b9c52.png">

cc @rust-lang/rustdoc
2019-05-07 19:30:05 +02:00
bors
17dba3b6e4 Auto merge of #60277 - estebank:relate-ice, r=varkor
Don't ICE when relating const type args

Fix #60263.

r? @varkor
2019-05-07 16:45:14 +00:00
Santiago Pastorino
b98bf88d32
Be a bit more explicit asserting over the vec rather than the len 2019-05-07 13:31:12 -03:00
Nathan Froyd
97ba4c95d0 choose a more specific LLVM target on OS X when necessary
This behavior matches clang's behavior, and makes cross-language LTO
possible.

Fixes #60235.
2019-05-07 11:09:39 -04:00
Nathan Froyd
1516087ca9 add negative tests for OS X LLVM target changes 2019-05-07 11:09:39 -04:00
bors
f5371a5ac7 Auto merge of #60592 - davidtwco:generator-signature-deduction, r=eddyb
Deduce signature of generator on type mismatch

Contributes towards #54326.

r? @eddyb
2019-05-07 13:49:36 +00:00
Simon Sapin
d5e819015f Add a cast method to raw pointers.
This is similar to `NonNull::cast`.

Compared to the `as` operator (which has a wide range of meanings
depending on the input and output types), a call to this method:

* Can only go from a raw pointer to a raw pointer
* Cannot change the pointer’s `const`ness

… even when the pointed types are inferred based on context.
2019-05-07 13:57:01 +02:00
bors
c6ac575648 Auto merge of #60573 - Zoxc:dep-stream-prefix-2, r=michaelwoerister
Only hash dep node indices of deps of anon tasks

Another change split out from https://github.com/rust-lang/rust/pull/60035.

r? @michaelwoerister
2019-05-07 10:48:16 +00:00