93136 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
ec6afb1ff6
Rollup merge of #60692 - davidtwco:pr-60676-followup, r=Centril
Extend #60676 test for nested mut patterns.

At request of @centril, this commit extends the existing test added by #60676 to include nested `mut` patterns.

cc @Centril
2019-05-10 20:31:10 +02:00
Mazdak Farrokhzad
bc8c782f60
Rollup merge of #60659 - nnethercote:tweak-Symbol-and-InternedString, r=Zoxc
Tweak `Symbol` and `InternedString`

Some minor improvements to speed and code cleanliness.

r? @Zoxc
2019-05-10 20:31:09 +02:00
Mazdak Farrokhzad
20dff29b35
Rollup merge of #60620 - mark-i-m:transcribe-2, r=petrochenkov
Fix a couple of FIXMEs in ext::tt::transcribe

_Blocked on #60618_

A crater run would be nice to make sure my understanding is correct. A quick google search seems to indicate these are extremely rare errors if they are possible (which I don't believe they are).

r? @petrochenkov

cc #2887 (there is only one FIXME left and it is hygiene-related)
2019-05-10 20:31:07 +02:00
Mazdak Farrokhzad
d94cb9f2ea
Rollup merge of #60529 - davidtwco:rfc-2008-uninhabited, r=petrochenkov
RFC 2008: Uninhabitedness fixes for enum variants and tests

Part of #44109.

At the request of @Centril, this PR adds tests asserting that uninhabited non-exhaustive types are considered inhabited in extern crates. In adding these tests, I fixed an oversight in the implementation of RFC 2008 on enum variants that resulted in non-exhaustive enum variants being considered uninhabited in extern crates.

Before this PR, these lines would error:

```rust
// extern crate
pub enum UninhabitedVariants {
    #[non_exhaustive] Tuple(!),
    #[non_exhaustive] Struct { x: ! }
}

pub enum PartiallyInhabitedVariants {
    Tuple(u8),
    #[non_exhaustive] Struct { x: ! }
}

// current crate
match uninhabited_variant() /* fn() -> Option<UninhabitedVariants> */ {
    Some(_x) => (), //~ ERROR unreachable pattern
    None => (),
}

while let PartiallyInhabitedVariants::Struct { x, .. } = partially_inhabited_variant() /* fn() -> PartiallyInhabitedVariants */ {
    //~^ ERROR unreachable pattern
}
```

cc @Centril
r? @petrochenkov
2019-05-10 20:31:06 +02:00
David Wood
1f0fb0391c
Add a bunch more tests. 2019-05-10 17:52:13 +01:00
David Wood
214f977fee
Move uninhabited tests into subdirectory.
This commit just tries to tidy up a little.
2019-05-10 17:52:12 +01:00
David Wood
8838b9130e
Fix uninhabitedness of non-exhaustive enums.
This commit ensures that non-exhaustive enums are considered inhabited
when used in extern crates.
2019-05-10 17:52:12 +01:00
David Wood
0d034a2e4d
Fix inhabitedness of non-exhaustive variants.
This commit ensures that non-exhaustive variants are considered
inhabited when used in extern crates.
2019-05-10 17:52:12 +01:00
David Wood
0db087e684
Add uninhabitedness tests w/ #[non_exhaustive].
This commit adds tests checking that uninhabited non-exhaustive types
are considered inhabited when used in another crate.
2019-05-10 17:52:12 +01:00
bors
cff1bdbd77 Auto merge of #60588 - cuviper:be-simd-swap, r=alexcrichton
Revert "Disable big-endian simd in swap_nonoverlapping_bytes"

This reverts commit 77bd4dc65406ba3cedbc779e6f6280868231912e (#43159).

Issue #42778 was formerly easy to reproduce on two big-endian targets,
`powerpc64` and `s390x`, so we disabled SIMD on this function for all
big-endian targets as a workaround.

I have re-tested this code on `powerpc64` and `s390x`, each with the
bundled LLVM 8 and with external LLVM 7 and LLVM 6, and the problems no
longer appear. So it seems safe to remove this workaround, although I'm
still a little uncomfortable that we never found a root-cause...

Closes #42778.
r? @arielb1
2019-05-10 15:29:40 +00:00
Mark Mansi
5b6bda3354 turn a couple of fixmes into span_bugs 2019-05-10 10:18:46 -05:00
bors
0ac53da03d Auto merge of #60684 - jethrogb:jb/sgx-test, r=joshtriplett
Fix cfg(test) build on SGX

Introduced in #60657

r? @joshtriplett
2019-05-10 09:56:56 +00:00
David Wood
d28b7afd17
Extend existing test for nested mut patterns.
At request of `@centril`, this commit extends the existing test added
by #60676 to include nested `mut` patterns.
2019-05-10 08:55:54 +01:00
bors
c441b8aca5 Auto merge of #60585 - sunfishcode:wasm32-wasi, r=alexcrichton
Omit the vendor component in the WASI triple

This renames wasm32-unknown-wasi to wasm32-wasi, omitting the vendor
component. This follows aarch64-linux-android, x86_64-fuchsia, and others in
omitting the vendor field, which has the advantage of aligning with the
[multiarch tuple](https://wiki.debian.org/Multiarch/Tuples), and of being
less noisy.

r? @alexcrichton
2019-05-10 07:02:38 +00:00
Nicholas Nethercote
e53bb1aefb Reduce Symbol's interface slightly. 2019-05-10 15:59:13 +10:00
Nicholas Nethercote
cb7eacb1d2 Remove the From<InternedString> for String impl.
It's not used.
2019-05-10 15:59:13 +10:00
Nicholas Nethercote
0e27c36145 Add various comments.
Lots of details I wish I'd known when I first looked at this code.
2019-05-10 15:59:12 +10:00
Nicholas Nethercote
c2cae7bbc3 Avoid recursion in de-gensym functions. 2019-05-10 15:59:12 +10:00
Nicholas Nethercote
8c465b4efa Add InternedString::with2.
This lets comparisons occur with a single access to the interner,
instead of two.
2019-05-10 15:59:05 +10:00
bors
407536e38d Auto merge of #60451 - rasendubi:binaryheap-min-heap, r=scottmcm
BinaryHeap: add min-heap example

Fixes #58174.
2019-05-10 04:10:36 +00:00
bors
03bd2f653f Auto merge of #60683 - Centril:rollup-p05qh5d, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #59348 (Clean up and add tests for slice drop shims)
 - #60188 (Identify when a stmt could have been parsed as an expr)
 - #60234 (std: Derive `Default` for `io::Cursor`)
 - #60618 (Comment ext::tt::transcribe)
 - #60648 (Skip codegen for one UI test with long file path)
 - #60671 (remove unneeded `extern crate`s from build tools)
 - #60675 (Remove the old await! macro)
 - #60676 (Fix async desugaring providing wrong input to procedural macros.)

Failed merges:

r? @ghost
2019-05-10 00:51:14 +00:00
Jethro Beekman
adb998fe21 Fix cfg(test) build on SGX 2019-05-09 15:00:06 -07:00
Mazdak Farrokhzad
45b09453db
Rollup merge of #60676 - davidtwco:issue-60674, r=cramertj
Fix async desugaring providing wrong input to procedural macros.

Fixes #60674.

This PR fixes a minor oversight introduced by #60535 where unused `mut` binding modes were removed from the arguments to an `async fn` (as they were added to the statement that we insert into the closure body). However, this meant that the input to procedural macros was incorrect. This removes that and instead fixes the `unused_mut` error that it avoided.

r? @cramertj
cc @taiki-e
2019-05-09 23:56:18 +02:00
Mazdak Farrokhzad
f6df1f6c30
Rollup merge of #60675 - cramertj:no-await-macro, r=nikomatsakis,Centril
Remove the old await! macro

This doesn't work anymore, and its continued presence is cause for confusion. `yield` can no longer be used to return `Pending` from an `async` body.

cc https://github.com/rust-lang/rust/issues/60660
cc @taiki-e
cc https://github.com/tokio-rs/tokio/pull/1080
2019-05-09 23:56:17 +02:00
Mazdak Farrokhzad
f27f14b60f
Rollup merge of #60671 - euclio:extern-crate, r=Centril
remove unneeded `extern crate`s from build tools
2019-05-09 23:56:16 +02:00
Mazdak Farrokhzad
e7b4023f37
Rollup merge of #60648 - petrochenkov:shorten2, r=Dylan-DPC
Skip codegen for one UI test with long file path

The path to this test is so long that object files produced by it hit some path length limit on Windows and linker cannot find them.
The workaround here is to skip codegen and avoid producing object files, this test doesn't need them anyway.
2019-05-09 23:56:14 +02:00
Mazdak Farrokhzad
903fc4bce3
Rollup merge of #60618 - mark-i-m:transcribe, r=petrochenkov
Comment ext::tt::transcribe

Also did a bit of minor cleanup (remove unidiomatic use of `Add` and an unneeded `clone`). No functionality changes.

r? @petrochenkov
2019-05-09 23:56:13 +02:00
Mazdak Farrokhzad
bd17b5c9a2
Rollup merge of #60234 - tesaguri:cursor-default, r=Amanieu
std: Derive `Default` for `io::Cursor`

I think this change is quite obvious, so made it insta-stable, but I won't insist on that.
2019-05-09 23:56:11 +02:00
Mazdak Farrokhzad
39edc68c69
Rollup merge of #60188 - estebank:recover-block, r=varkor
Identify when a stmt could have been parsed as an expr

There are some expressions that can be parsed as a statement without
a trailing semicolon depending on the context, which can lead to
confusing errors due to the same looking code being accepted in some
places and not others. Identify these cases and suggest enclosing in
parenthesis making the parse non-ambiguous without changing the
accepted grammar.

Fix #54186, cc #54482, fix #59975, fix #47287.
2019-05-09 23:56:09 +02:00
Mazdak Farrokhzad
62ab971bb7
Rollup merge of #59348 - matthewjasper:cleanup-drop-shims, r=arielb1
Clean up and add tests for slice drop shims

Adds a test for the MIR generated by `real_drop_in_place::<[T]>`. Also slightly reduces the number of statements and locals used in the shim.

r? @RalfJung
2019-05-09 23:56:08 +02:00
bors
adcd4aa8d0 Auto merge of #60665 - pietroalbini:upgrade-ci-images, r=alexcrichton
Upgrade non-LTS Ubuntu images in CI

This PR bumps `dist-various-2` to 18.04 LTS and both `x86_64-gnu` and `x86_64-gnu-debug` to 19.04.

Another change is the switch to [rust-lang/mirror-google-fuchsia-zircon](https://github.com/rust-lang/mirror-google-fuchsia-zircon) as the Zircon repository, used during Fuchsia tests: the original repository ([fuchsia.googlesource.com/zircon](https://fuchsia.googlesource.com/zircon)) is now behind a login wall and it doesn't contain anything at all.

r? @alexcrichton
cc @cramertj -- what's happening on the Fuchsia side?
2019-05-09 21:50:46 +00:00
bors
a784a80228 Auto merge of #60672 - Centril:rollup-fhcx463, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #60601 (Add a `cast` method to raw pointers.)
 - #60638 (pin: make the to-module link more visible)
 - #60647 (cleanup: Remove `DefIndexAddressSpace`)
 - #60656 (Inline some Cursor calls for slices)
 - #60657 (Stabilize and re-export core::array in std)

Failed merges:

r? @ghost
2019-05-09 18:43:00 +00:00
Dan Gohman
1fe3ce1c42 Omit the vendor component in the WASI triple
This renames wasm32-unknown-wasi to wasm32-wasi, omitting the vendor
component. This follows aarch64-linux-android, x86_64-fuchsia, and others in
omitting the vendor field, which has the advantage of aligning with the
[multiarch tuple](https://wiki.debian.org/Multiarch/Tuples), and of being
less noisy.
2019-05-09 11:35:10 -07:00
David Wood
d5e04067cb
Add FIXME about construct_async_arguments.
This is unrelated to the rest of this PR but it made sense to add a
FIXME explaining that the function shouldn't really be in the parser.
2019-05-09 19:14:39 +01:00
David Wood
dcd3cf7017
Do not modify mutability of simple bindings.
This commit removes the modification of the mutability of simple
bindings. While the mutability isn't used, it is important that it is
kept so that the input to procedural macros matches what the user wrote.
This commit also modifies the span of the binding mode so that it is
considered a compiler desugaring and won't be linted against for being
unused..
2019-05-09 19:10:27 +01:00
Taylor Cramer
df41e4f695 Remove the old await! macro
This doesn't work anymore, and its continued
presence is cause for confusion.
2019-05-09 10:49:39 -07:00
David Wood
e57c7b859d
Add regression test for #60674.
This commit adds a regression test (with current broken behaviour) that
tests that `mut` patterns are not lost when provided as input to a proc macro.
2019-05-09 18:15:15 +01:00
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
Andy Russell
b2f71fb540
remove unneeded extern crates from build tools 2019-05-09 12:03:13 -04: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
Pietro Albini
c98a27c622
ci: bump ubuntu 18.10 images to 19.04 2019-05-09 11:51:01 +02:00
Pietro Albini
8f9e90b9cd
ci: use our own mirror for fuchsia's zircon repository
The canonical repository on fuchsia.googlesource.com is not accessible
anymore, neither for anonymous access nor logged in access. This commit
switches our CI to fetch the repository from our own mirror.
2019-05-09 11:32:41 +02:00
Pietro Albini
d4f071af23
ci: update dist-various-2 to ubuntu 18.04 2019-05-09 11:17:03 +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