]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoUse suggestions instead of notes ref mismatches
Esteban Küber [Sat, 25 Nov 2017 14:00:26 +0000 (06:00 -0800)]
Use suggestions instead of notes ref mismatches

On type mismatch errors, use a suggestion when encountering minimal
differences in type differences due to refs, instead of a note.

6 years agoAuto merge of #46236 - davidtwco:issue-46023, r=arielb1
bors [Fri, 1 Dec 2017 13:26:10 +0000 (13:26 +0000)]
Auto merge of #46236 - davidtwco:issue-46023, r=arielb1

MIR-borrowck: immutable unique closure upvars can be mutated

Fixes #46023 and #46160 (see [this comment](https://github.com/rust-lang/rust/pull/46236#issuecomment-347204874)).

6 years agoAuto merge of #46211 - snipsco:master, r=pnkfelix
bors [Fri, 1 Dec 2017 08:44:42 +0000 (08:44 +0000)]
Auto merge of #46211 - snipsco:master, r=pnkfelix

disable jemalloc on executables for ios targets

This is a (temporary ?) workaround for issue #45262

6 years agoAuto merge of #45997 - estebank:pub-ident, r=nikomatsakis
bors [Fri, 1 Dec 2017 06:06:06 +0000 (06:06 +0000)]
Auto merge of #45997 - estebank:pub-ident, r=nikomatsakis

Account for missing keyword in fn/struct definition

Fix #38911.

6 years agoAuto merge of #45846 - pietroalbini:use-nested-groups, r=petrochenkov
bors [Fri, 1 Dec 2017 03:25:54 +0000 (03:25 +0000)]
Auto merge of #45846 - pietroalbini:use-nested-groups, r=petrochenkov

Add nested groups in imports

This PR adds support for nested groups in imports (rust-lang/rfcs#2128, tracking issue #44494).

r? @petrochenkov

6 years agoAuto merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddyb
bors [Fri, 1 Dec 2017 00:46:08 +0000 (00:46 +0000)]
Auto merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddyb

incr.comp.: Remove ability to produce incr. comp. hashes during metadata export.

This functionality has been superseded by on-import hashing, which can be less conservative and does not require extra infrastructure.

r? @nikomatsakis

6 years agoFixed spurious cannot borrow immutable item error with a closure.
David Wood [Thu, 30 Nov 2017 23:19:06 +0000 (23:19 +0000)]
Fixed spurious cannot borrow immutable item error with a closure.

6 years agoImmutable unique closure upvars cannot be mutated.
David Wood [Thu, 30 Nov 2017 23:18:38 +0000 (23:18 +0000)]
Immutable unique closure upvars cannot be mutated.

6 years agoAdded test for spurious cannot borrow immutable item error with a closure
David Wood [Thu, 30 Nov 2017 23:16:17 +0000 (23:16 +0000)]
Added test for spurious cannot borrow immutable item error with a closure

6 years agoAdded test for immutable unique closure upvar mutation.
David Wood [Thu, 30 Nov 2017 23:15:10 +0000 (23:15 +0000)]
Added test for immutable unique closure upvar mutation.

6 years agoexplanatory note for the workaround
Mathieu Poumeyrol [Thu, 30 Nov 2017 22:14:29 +0000 (23:14 +0100)]
explanatory note for the workaround

6 years agoAuto merge of #46402 - oli-obk:clippy, r=kennytm
bors [Thu, 30 Nov 2017 19:18:14 +0000 (19:18 +0000)]
Auto merge of #46402 - oli-obk:clippy, r=kennytm

Reenable clippy

6 years agoReenable clippy
Oliver Schneider [Thu, 30 Nov 2017 14:20:40 +0000 (15:20 +0100)]
Reenable clippy

6 years agoMark rustfmt and rls as broken
Pietro Albini [Thu, 30 Nov 2017 12:18:18 +0000 (13:18 +0100)]
Mark rustfmt and rls as broken

6 years agoImplement RFC 2128 (use_nested_groups)
Pietro Albini [Tue, 26 Sep 2017 21:04:00 +0000 (23:04 +0200)]
Implement RFC 2128 (use_nested_groups)

This commit adds support for nested groups inside `use` declarations,
such as `use foo::{bar, sub::{baz::Foo, *}};`.

6 years agoAuto merge of #46299 - michaelwoerister:incr-comp-krimskrams, r=nikomatsakis
bors [Thu, 30 Nov 2017 10:57:21 +0000 (10:57 +0000)]
Auto merge of #46299 - michaelwoerister:incr-comp-krimskrams, r=nikomatsakis

incr.comp.: Some preparatory work for caching more query results.

This PR
* adds and updates some encoding/decoding routines for various query result types so they can be cached later, and
* adds missing `[input]` annotations for a few `DepNode` variants.

The situation around having to explicitly mark dep-nodes/queries as inputs is not really satisfactory. I hope we can find a way of making this more fool-proof in the future.

r? @nikomatsakis

6 years agoAuto merge of #46226 - arielb1:special-region-obligation, r=nikomatsakis
bors [Thu, 30 Nov 2017 08:00:27 +0000 (08:00 +0000)]
Auto merge of #46226 - arielb1:special-region-obligation, r=nikomatsakis

avoid type-live-for-region obligations on dummy nodes

Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it
turns out that in the few cases they are needed, these obligations are not
needed anyway because they are verified elsewhere.

Fixes #46069.

Beta-nominating because this is a regression for our new beta.
r? @nikomatsakis

6 years agoAuto merge of #46041 - zilbuz:issue-44837, r=arielb1
bors [Thu, 30 Nov 2017 05:26:28 +0000 (05:26 +0000)]
Auto merge of #46041 - zilbuz:issue-44837, r=arielb1

MIR borrowck: finalize `check_access_permissions()`

Fix #44837 (hopefully for good)

r? @arielb1

6 years agoAuto merge of #46366 - kennytm:revert-46360, r=kennytm
bors [Thu, 30 Nov 2017 01:28:44 +0000 (01:28 +0000)]
Auto merge of #46366 - kennytm:revert-46360, r=kennytm

Revert #46360, re-enable macOS dist images.

This PR reverts #46360, which disabled all macOS dist images to workaround travis-ci/travis-ci#8821.

This PR should be merged as soon as the Travis bug has been fixed.

Closes #46357.

cc @rust-lang/infra

6 years agoAuto merge of #46144 - nrc:rls-update, r=alexcrichton
bors [Wed, 29 Nov 2017 22:41:05 +0000 (22:41 +0000)]
Auto merge of #46144 - nrc:rls-update, r=alexcrichton

Update RLS and Rustfmt

r? @alexcrichton

6 years agoincr.comp.: Update test cases after metadata hashing removal.
Michael Woerister [Wed, 29 Nov 2017 15:29:13 +0000 (16:29 +0100)]
incr.comp.: Update test cases after metadata hashing removal.

6 years agoincr.comp.: Remove on-export crate metadata hashing.
Michael Woerister [Wed, 29 Nov 2017 15:28:25 +0000 (16:28 +0100)]
incr.comp.: Remove on-export crate metadata hashing.

6 years agoRevert "Auto merge of #46360 - kennytm:workaround-travis-8821, r=kennytm"
kennytm [Wed, 29 Nov 2017 13:03:53 +0000 (21:03 +0800)]
Revert "Auto merge of #46360 - kennytm:workaround-travis-8821, r=kennytm"

This reverts commit dc0e227745765c198958f0298785d18bcf61d4ae, reversing
changes made to 77ab3a1d5ff69c0cb3eb85a75ef734eaf7429f1b.

[skip ci]

6 years agoAuto merge of #46362 - kennytm:rollup, r=kennytm
bors [Wed, 29 Nov 2017 12:17:45 +0000 (12:17 +0000)]
Auto merge of #46362 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

- Successful merges: #45969, #46077, #46219, #46287, #46293, #46322, #46323, #46330, #46354, #46356
- Failed merges:

6 years agoRollup merge of #46356 - daboross:patch-2, r=sfackler
kennytm [Wed, 29 Nov 2017 10:37:54 +0000 (18:37 +0800)]
Rollup merge of #46356 - daboross:patch-2, r=sfackler

Reject '2' as a binary digit in internals of b: number formatting

The `radix!` macro generates an implementation of the private trait `GenericRadix`, and the code replaced changes Binary's implementation to no longer accept '2' as a valid digit to print.

Granted, this code is literally only ever called from another method in this private trait, and that method has logic to never hand a '2' to the printing function. Even given this, the code's there, I thought it would be best to fix this for clarity of anyone reading it.

6 years agoRollup merge of #46354 - Mark-Simulacrum:alt-try, r=alexcrichton
kennytm [Wed, 29 Nov 2017 10:37:53 +0000 (18:37 +0800)]
Rollup merge of #46354 - Mark-Simulacrum:alt-try, r=alexcrichton

Deploy builds both with asserts enabled and asserts disabled to CI.

This also removes uploads to the 'try' bucket, and instead dumps
everything into the two rustc-builds and rustc-builds-alt buckets. This
makes lives easier, as there is only one location for a given "type" of
build, and since we have the git commit hash in the filenames, this is
fine; we won't run into uploads of the same commit.

cc @aidanhs -- this will break crater's logic for downloading `try#xxx` commits since the try bucket won't be uploaded into

r? @alexcrichton

6 years agoRollup merge of #46330 - SimonSapin:patch-6, r=kennytm
kennytm [Wed, 29 Nov 2017 10:37:52 +0000 (18:37 +0800)]
Rollup merge of #46330 - SimonSapin:patch-6, r=kennytm

Update comment on alternate builds in .travis.yml

https://github.com/rust-lang/rust/pull/45810#issuecomment-347257640

6 years agoRollup merge of #46323 - ia0:fix_mpsc_error_conv, r=kennytm
kennytm [Wed, 29 Nov 2017 10:37:51 +0000 (18:37 +0800)]
Rollup merge of #46323 - ia0:fix_mpsc_error_conv, r=kennytm

Fix since for mpsc_error_conversions

This is a followup of #45506.

6 years agoRollup merge of #46322 - gnzlbg:mmx, r=alexcrichton
kennytm [Wed, 29 Nov 2017 10:37:50 +0000 (18:37 +0800)]
Rollup merge of #46322 - gnzlbg:mmx, r=alexcrichton

white list MMX and MSA target features

r? @alexcrichton

6 years agoRollup merge of #46293 - ollie27:atomic_bool_from, r=BurntSushi
kennytm [Wed, 29 Nov 2017 10:37:50 +0000 (18:37 +0800)]
Rollup merge of #46293 - ollie27:atomic_bool_from, r=BurntSushi

impl From<bool> for AtomicBool

This seems like an obvious omission from #45610. ~~I've used the same feature name and version in the hope that this can be backported to beta so it's stabilized with the other impls. If it can't be I'll change it to `1.24.0`.~~

6 years agoRollup merge of #46287 - SimonSapin:stable-constness, r=aturon
kennytm [Wed, 29 Nov 2017 10:37:47 +0000 (18:37 +0800)]
Rollup merge of #46287 - SimonSapin:stable-constness, r=aturon

Stabilize const-calling existing const-fns in std

Fixes #46038

6 years agoRollup merge of #46219 - rust-lang:frewsxcv-issue-45636, r=GuillaumeGomez
kennytm [Wed, 29 Nov 2017 10:37:45 +0000 (18:37 +0800)]
Rollup merge of #46219 - rust-lang:frewsxcv-issue-45636, r=GuillaumeGomez

Improve documentation for slice swap/copy/clone operations.

Fixes #45636.

- Demonstrate how to use these operations with slices of differing
  lengths
- Demonstrate how to swap/copy/clone sub-slices of a slice using
  `split_at_mut`

6 years agoRollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=alexcrichton
kennytm [Wed, 29 Nov 2017 10:37:44 +0000 (18:37 +0800)]
Rollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=alexcrichton

Stabilize some `ascii_ctype` methods

As discussed in #39658, this PR stabilizes those methods for `u8` and `char`. All inherent `ascii_ctype` for `[u8]` and `str` are removed as we prefer the more explicit version `s.chars().all(|c| c.is_ascii_())`.

This PR doesn't modify the `AsciiExt` trait. There, the `ascii_ctype` methods are still unstable. It is planned to remove those in the future (I think). I had to modify some code in `ascii.rs` to properly implement `AsciiExt` for all types.

Fixes #39658.

6 years agoRollup merge of #45969 - ia0:mpsc_recv_deadline, r=alexcrichton
kennytm [Wed, 29 Nov 2017 10:37:43 +0000 (18:37 +0800)]
Rollup merge of #45969 - ia0:mpsc_recv_deadline, r=alexcrichton

Add std::sync::mpsc::Receiver::recv_deadline()

Essentially renames recv_max_until to recv_deadline (mostly copying recv_timeout
documentation). This function is useful to avoid the often unnecessary call to
Instant::now in recv_timeout (e.g. when the user already has a deadline). A
concrete example would be something along those lines:

```rust
use std::sync::mpsc::Receiver;
use std::time::{Duration, Instant};

/// Reads a batch of elements
///
/// Returns as soon as `max_size` elements have been received or `timeout` expires.
fn recv_batch_timeout<T>(receiver: &Receiver<T>, timeout: Duration, max_size: usize) -> Vec<T> {
    recv_batch_deadline(receiver, Instant::now() + timeout, max_size)
}

/// Reads a batch of elements
///
/// Returns as soon as `max_size` elements have been received or `deadline` is reached.
fn recv_batch_deadline<T>(receiver: &Receiver<T>, deadline: Instant, max_size: usize) -> Vec<T> {
    let mut result = Vec::new();
    while let Ok(x) = receiver.recv_deadline(deadline) {
        result.push(x);
        if result.len() == max_size {
            break;
        }
    }
    result
}
```

6 years agoAuto merge of #46360 - kennytm:workaround-travis-8821, r=kennytm
bors [Wed, 29 Nov 2017 09:44:04 +0000 (09:44 +0000)]
Auto merge of #46360 - kennytm:workaround-travis-8821, r=kennytm

Disable all macOS dist images to workaround travis-ci/travis-ci#8821

See: travis-ci/travis-ci#8821

Currently the [Travis status](https://www.traviscistatus.com/) is all green, I don't know how long it takes Travis to notice and fix it, so I'm merging this in immediately to keep the queue running today.

cc @rust-lang/infra

6 years agoDisable all macOS dist images to workaround travis-ci/travis-ci#8821
kennytm [Wed, 29 Nov 2017 09:39:36 +0000 (17:39 +0800)]
Disable all macOS dist images to workaround travis-ci/travis-ci#8821

[skip ci]

6 years agoUpdate Rustfmt again
Nick Cameron [Wed, 29 Nov 2017 07:33:14 +0000 (20:33 +1300)]
Update Rustfmt again

6 years agoRebased Cargo.lock
Nick Cameron [Wed, 29 Nov 2017 06:17:20 +0000 (19:17 +1300)]
Rebased Cargo.lock

6 years agoUpdate Cargo
Nick Cameron [Mon, 27 Nov 2017 22:13:44 +0000 (11:13 +1300)]
Update Cargo

Pulls in https://github.com/rust-lang/cargo/pull/4762 fixing a broken test which prevented the RLS update

6 years agoUpdate RLS and Rustfmt
Nick Cameron [Tue, 21 Nov 2017 02:42:22 +0000 (15:42 +1300)]
Update RLS and Rustfmt

6 years agoReject '2' as a binary digit in internals of 'b' formatting
David Ross [Wed, 29 Nov 2017 05:35:18 +0000 (21:35 -0800)]
Reject '2' as a binary digit in internals of 'b' formatting

I don't believe the previous code `0 ... 2` would run into any real problems, but it seems confusing to read, given that '2' is never a valid binary digit.

As far as I can tell this code is only ever called from within another private method in the trait which has logic to never hand it '2' anyways. I thought we could change this for clarity anyways.

6 years agoDeploy builds both with asserts enabled and asserts disabled to CI.
Mark Simulacrum [Wed, 29 Nov 2017 02:55:19 +0000 (19:55 -0700)]
Deploy builds both with asserts enabled and asserts disabled to CI.

This also removes uploads to the 'try' bucket, and instead dumps
everything into the two rustc-builds and rustc-builds-alt buckets. This
makes lives easier, as there is only one location for a given "type" of
build, and since we have the git commit hash in the filenames, this is
fine; we won't run into uploads of the same commit.

6 years agoAuto merge of #46207 - kennytm:kill-grep, r=alexcrichton
bors [Tue, 28 Nov 2017 23:23:03 +0000 (23:23 +0000)]
Auto merge of #46207 - kennytm:kill-grep, r=alexcrichton

Replace most call to grep in run-make by a script that cat the input.

Introduced a new `src/etc/cat-and-grep.sh` script (called in run-make as `$(CGREP)`), which prints the input and do a grep simultaneously. This is mainly used to debug spurious failures in run-make, such as the spurious error in #45810, as well as real errors such as #46126.

(cc #40713)

Some `grep` still remains, mainly the `grep -c` calls that count the number of matches and print the result to stdout.

6 years agoAuto merge of #46094 - dtolnay:is_null, r=alexcrichton
bors [Tue, 28 Nov 2017 20:40:51 +0000 (20:40 +0000)]
Auto merge of #46094 - dtolnay:is_null, r=alexcrichton

Remove `T: Sized` on `ptr::is_null()`

Originally from #44932 -- this is purely a revert of the last commit of that PR, which was removing some changes from the previous commits in the PR. So a revert of a revert means this is code written by @cuviper!

@mikeyhew makes a compelling case in https://github.com/rust-lang/rfcs/issues/433#issuecomment-345495505 for why this is the right way to implement `is_null` for trait objects. And the behavior for slices makes sense to me as well.

```diff
  impl<T: ?Sized> *const T {
-     pub fn is_null(self) -> bool where T: Sized;
+     pub fn is_null(self) -> bool;
  }

  impl<T: ?Sized> *mut T {
-     pub fn is_null(self) -> bool where T: Sized;
+     pub fn is_null(self) -> bool;
  }

6 years agoFix doc test of previous commit
Julien Cretin [Tue, 28 Nov 2017 20:22:30 +0000 (21:22 +0100)]
Fix doc test of previous commit

6 years agoAuto merge of #46291 - alexcrichton:wasm-tests, r=kennytm
bors [Tue, 28 Nov 2017 17:58:58 +0000 (17:58 +0000)]
Auto merge of #46291 - alexcrichton:wasm-tests, r=kennytm

ci: Start running wasm32 tests on Travis

This commit allocates a builder to running wasm32 tests on Travis. Not all test
suites pass right now so this is starting out with just the run-pass and the
libcore test suites. This'll hopefully give us a pretty broad set of coverage
for integration in rustc itself as well as a somewhat broad coverage of the llvm
backend itself through integration/unit tests.

6 years agoci: Start running wasm32 tests on Travis
Alex Crichton [Sun, 26 Nov 2017 18:39:16 +0000 (10:39 -0800)]
ci: Start running wasm32 tests on Travis

This commit allocates a builder to running wasm32 tests on Travis. Not all test
suites pass right now so this is starting out with just the run-pass and the
libcore test suites. This'll hopefully give us a pretty broad set of coverage
for integration in rustc itself as well as a somewhat broad coverage of the llvm
backend itself through integration/unit tests.

6 years agoDisable the cdylib-fewer-symbols test for all Windows (test was broken).
kennytm [Tue, 28 Nov 2017 15:38:04 +0000 (23:38 +0800)]
Disable the cdylib-fewer-symbols test for all Windows (test was broken).

6 years agoReplace most call to grep in run-make by a script that cat the input.
kennytm [Thu, 23 Nov 2017 15:19:50 +0000 (23:19 +0800)]
Replace most call to grep in run-make by a script that cat the input.

Introduced a new src/etc/cat-and-grep.sh script (called in run-make as
$(CGREP)), which prints the input and do a grep simultaneously. This is
mainly used to debug spurious failures in run-make, such as the sanitizer
error in #45810, as well as real errors such as #46126.

6 years agomir-borrowck: Update tests
Basile Desloges [Wed, 22 Nov 2017 17:15:56 +0000 (18:15 +0100)]
mir-borrowck: Update tests

6 years agoAuto merge of #46329 - arielb1:incoherent, r=eddyb
bors [Tue, 28 Nov 2017 15:12:58 +0000 (15:12 +0000)]
Auto merge of #46329 - arielb1:incoherent, r=eddyb

Revert "fix treatment of local types in "remote coherence" mode"

That commit had accidentally snuck in into #44884 and it causes regressions. Revert it.

This reverts commit c48650ec25d2e7e872912137e68496248743f1fe.

@bors p=10 - fixes breakage in nightly
r? @eddyb

6 years agoFix since for mpsc_error_conversions
Julien Cretin [Tue, 28 Nov 2017 14:58:36 +0000 (15:58 +0100)]
Fix since for mpsc_error_conversions

6 years agomir-borrowck: Add permission check for `WriteKind::Mutate`
Basile Desloges [Thu, 16 Nov 2017 16:44:24 +0000 (17:44 +0100)]
mir-borrowck: Add permission check for `WriteKind::Mutate`

6 years agoUpdate comment on alternate builds in .travis.yml
Simon Sapin [Tue, 28 Nov 2017 13:26:59 +0000 (14:26 +0100)]
Update comment on alternate builds in .travis.yml

https://github.com/rust-lang/rust/pull/45810#issuecomment-347257640

6 years agoRevert "fix treatment of local types in "remote coherence" mode"
Ariel Ben-Yehuda [Tue, 28 Nov 2017 12:52:34 +0000 (14:52 +0200)]
Revert "fix treatment of local types in "remote coherence" mode"

That commit had accidentally snuck in into #44884. Revert it.

This reverts commit c48650ec25d2e7e872912137e68496248743f1fe.

6 years agomir-borrowck: `describe_lvalue()` can fail if a local doesn't have a name
Basile Desloges [Wed, 22 Nov 2017 16:35:52 +0000 (17:35 +0100)]
mir-borrowck: `describe_lvalue()` can fail if a local doesn't have a name

6 years agoincr.comp.: Add some missing DepNode [input] annotations.
Michael Woerister [Mon, 27 Nov 2017 09:50:15 +0000 (10:50 +0100)]
incr.comp.: Add some missing DepNode [input] annotations.

6 years agoincr.comp.: Make a bunch of query results encodable.
Michael Woerister [Wed, 22 Nov 2017 13:39:32 +0000 (14:39 +0100)]
incr.comp.: Make a bunch of query results encodable.

6 years agoincr.comp.: Make MIR encoding fit for incr.comp. caching.
Michael Woerister [Wed, 22 Nov 2017 12:47:50 +0000 (13:47 +0100)]
incr.comp.: Make MIR encoding fit for incr.comp. caching.

6 years agoAuto merge of #46175 - GuillaumeGomez:fix-global-search, r=QuietMisdreavus
bors [Tue, 28 Nov 2017 10:41:47 +0000 (10:41 +0000)]
Auto merge of #46175 - GuillaumeGomez:fix-global-search, r=QuietMisdreavus

Fix global search

Fixes #46021.

r? @QuietMisdreavus

6 years agowhite list MMX and MSA target features
gnzlbg [Tue, 28 Nov 2017 09:28:15 +0000 (10:28 +0100)]
white list MMX and MSA target features

6 years agoAuto merge of #46123 - Gankro:c-repr, r=eddyb
bors [Tue, 28 Nov 2017 08:04:58 +0000 (08:04 +0000)]
Auto merge of #46123 - Gankro:c-repr, r=eddyb

Implement the special repr(C)-non-clike-enum layout

This is the second half of https://github.com/rust-lang/rfcs/pull/2195

which specifies that

```rust
#[repr(C, u8)]
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
enum MyEnum {
    A(u32),                 // Single primitive value
    B { x: u8, y: i16 },    // Composite, and the offset of `y` depends on tag being internal
    C,                      // Empty
    D(Option<u32>),         // Contains an enum
    E(Duration),            // Contains a struct
}
```

Has the same layout as

```rust
#[repr(C)]
struct MyEnumRepr {
    tag: MyEnumTag,
    payload: MyEnumPayload,
}

#[repr(C)]
#[allow(non_snake_case)]
union MyEnumPayload {
    A: MyEnumVariantA,
    B: MyEnumVariantB,
    D: MyEnumVariantD,
    E: MyEnumVariantE,
}

#[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E }
#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32);
#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 }
#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option<u32>);
#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration);

```

6 years agoChange `since` attribute from ctype methods from 1.23 to 1.24
Lukas Kalbertodt [Tue, 28 Nov 2017 07:50:40 +0000 (08:50 +0100)]
Change `since` attribute from ctype methods from 1.23 to 1.24

The changes didn't land in time for 1.23 and stabilizations won't
be backported to beta.

6 years agoFix and improve test for enum repr sizes
Alexis Beingessner [Mon, 20 Nov 2017 19:22:33 +0000 (14:22 -0500)]
Fix and improve test for enum repr sizes

6 years agoAuto merge of #46142 - eddyb:even-mirer-2, r=nikomatsakis
bors [Tue, 28 Nov 2017 05:38:19 +0000 (05:38 +0000)]
Auto merge of #46142 - eddyb:even-mirer-2, r=nikomatsakis

MIR: split Operand::Consume into Copy and Move.

By encoding the choice of leaving the source untouched (`Copy`) and invalidating it (`Move`) in MIR, we can express moves of copyable values and have MIR borrow-checking enforce them, *including* ownership transfer of stack locals in calls  (when the ABI passes by indirection).

Optimizations could turn a "last-use" `Copy` into a `Move`, and the MIR borrow-checker, at least within the confines of safe code, could even do this when the underlying lvalue was borrowed.
(However, that last part would be the first time lifetime inference affects code generation, AFAIK).

Furthermore, as `Move`s invalidate borrows as well, for any local that is initialized only once, we can ignore borrows that happened before a `Move` and safely reuse/replace its memory storage.
This will allow us to perform NRVO in the presence of short-lived borrows, unlike LLVM (currently), and even compute optimal `StorageLive...StorageDead` ranges instead of discarding them.

6 years agotests: update to include move annotations in MIR.
Eduard-Mihai Burtescu [Fri, 17 Nov 2017 16:22:44 +0000 (18:22 +0200)]
tests: update to include move annotations in MIR.

6 years agorustc_mir: require that Copy(L) satisfies typeof L: Copy.
Eduard-Mihai Burtescu [Fri, 17 Nov 2017 16:07:18 +0000 (18:07 +0200)]
rustc_mir: require that Copy(L) satisfies typeof L: Copy.

6 years agoMIR: split Operand::Consume into Copy and Move.
Eduard-Mihai Burtescu [Fri, 17 Nov 2017 15:19:57 +0000 (17:19 +0200)]
MIR: split Operand::Consume into Copy and Move.

6 years agorustc_mir: enforce that arguments are replaced with Local's only.
Eduard-Mihai Burtescu [Mon, 27 Nov 2017 19:01:30 +0000 (21:01 +0200)]
rustc_mir: enforce that arguments are replaced with Local's only.

6 years agorustc_mir: move storage_dead_or_drop_error_reported logic to access_lvalue.
Eduard-Mihai Burtescu [Mon, 20 Nov 2017 23:50:04 +0000 (01:50 +0200)]
rustc_mir: move storage_dead_or_drop_error_reported logic to access_lvalue.

6 years agoAuto merge of #46102 - kennytm:45861-step-1, r=alexcrichton
bors [Tue, 28 Nov 2017 02:08:52 +0000 (02:08 +0000)]
Auto merge of #46102 - kennytm:45861-step-1, r=alexcrichton

[auto-toolstate][1/8] Always ignore build failure of failable tools (rls, rustfmt, clippy)

If build failed for these tools, they will be automatically skipped from distribution, and will not fail the whole build.

Test failures are *not* ignored, nor build failure of other tools (e.g. cargo). Therefore it should have no observable effect to the current CI system.

This is step 1/8 of automatic management of broken tools #45861. The purpose is concentrate all failure detection about tools into a single CI job for easy management, while keeping the ability to distribute these tools in the nightlies.

r? @Mark-Simulacrum

6 years agoAuto merge of #46312 - kennytm:rollup, r=kennytm
bors [Mon, 27 Nov 2017 23:40:16 +0000 (23:40 +0000)]
Auto merge of #46312 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

- Successful merges: #45506, #46174, #46231, #46240, #46249, #46258, #46262, #46275, #46282, #46285
- Failed merges:

6 years agoUse an unstable feature linked to #46316
Julien Cretin [Mon, 27 Nov 2017 21:31:00 +0000 (22:31 +0100)]
Use an unstable feature linked to #46316

6 years agoChange version number for `impl From<bool> for AtomicBool` to 1.24.0
Oliver Middleton [Mon, 27 Nov 2017 21:26:19 +0000 (21:26 +0000)]
Change version number for `impl From<bool> for AtomicBool` to 1.24.0

6 years agoRollup merge of #46285 - SimonSapin:twos-complement, r=GuillaumeGomez
kennytm [Mon, 27 Nov 2017 19:16:50 +0000 (03:16 +0800)]
Rollup merge of #46285 - SimonSapin:twos-complement, r=GuillaumeGomez

Document non-obvious behavior of fmt::UpperHex & co for negative integers

Before stabilization I’d have suggested changing the behavior,  but that time is past.

6 years agoRollup merge of #46282 - estebank:impl-trait-cicle-span, r=arielb1
kennytm [Mon, 27 Nov 2017 19:16:49 +0000 (03:16 +0800)]
Rollup merge of #46282 - estebank:impl-trait-cicle-span, r=arielb1

Shorten output of E0391

Use the shorter `def_span` on the impl-Trait cyclic reference errors.

6 years agoRollup merge of #46275 - dtolnay:compiletest-libc, r=Mark-Simulacrum
kennytm [Mon, 27 Nov 2017 19:16:48 +0000 (03:16 +0800)]
Rollup merge of #46275 - dtolnay:compiletest-libc, r=Mark-Simulacrum

Compiletest libc dependency can be unix-only

In main.rs libc is imported as:

```rust
#[cfg(unix)]
extern crate libc;
```

This came up in https://github.com/laumann/compiletest-rs/pull/90.

6 years agoRollup merge of #46262 - udoprog:linked-list-remove-if, r=dtolnay
kennytm [Mon, 27 Nov 2017 19:16:47 +0000 (03:16 +0800)]
Rollup merge of #46262 - udoprog:linked-list-remove-if, r=dtolnay

Introduce LinkedList::drain_filter

This introduces `LinkedList::remove_if`.

This operation embodies one of the use-cases where `LinkedList` would typically be preferred over `Vec`: random removal and retrieval.

There are a number of considerations with this:

Should there be two `remove_if` methods? One where elements are only removed, one which returns a collection of removed elements.

Should this be implemented using a draining iterator pattern that covers both cases? I suspect that would incur a bit of overhead (moving the element into the iterator, then into a new collection). But I'm not sure. Maybe that's an acceptable compromise to maximize flexibility.

I don't feel I've had enough exposure to unsafe programming in rust to be certain the implementation is correct. This relies quite heavily on moving around copies of Shared pointers to make the code reasonable. Please help me out :).

6 years agoRollup merge of #46258 - colinmarsh19:master, r=estebank
kennytm [Mon, 27 Nov 2017 19:16:47 +0000 (03:16 +0800)]
Rollup merge of #46258 - colinmarsh19:master, r=estebank

Remove semicolon note

In reference to issue #46186
r? @estebank

First time doing a pull request, if there are any suggestions on how to improve this please let me know.
@jjolly

6 years agoRollup merge of #46249 - estebank:suggest-slice, r=arielb1
kennytm [Mon, 27 Nov 2017 19:16:46 +0000 (03:16 +0800)]
Rollup merge of #46249 - estebank:suggest-slice, r=arielb1

Suggest using slice when encountering `let x = ""[..];`

Fix #26319.

6 years agoRollup merge of #46240 - SimonSapin:from_str_radix-docs, r=estebank
kennytm [Mon, 27 Nov 2017 19:16:45 +0000 (03:16 +0800)]
Rollup merge of #46240 - SimonSapin:from_str_radix-docs, r=estebank

Expand docs of <$Int>::from_str_radix, based on that of char::to_digit

6 years agoRollup merge of #46231 - ritiek:verbs, r=arielb1
kennytm [Mon, 27 Nov 2017 19:16:44 +0000 (03:16 +0800)]
Rollup merge of #46231 - ritiek:verbs, r=arielb1

MIR: Fix value moved diagnose messages

#45960. I believe this will take a different approach. Simply replacing all nouns to verbs (`desired_action`) messes up the message `use of moved value` (although fixes the message in original issue). Here is what happens:

<pre>
$ rustc -Zborrowck-mir src/test/ui/borrowck/borrowck-reinit.rs

error[E0382]: <b>used</b> of moved value: `x` (Mir)
  --> src/test/ui/borrowck/borrowck-reinit.rs:18:16
   |
17 |     drop(x);
   |          - value moved here
18 |     let _ = (1,x);
   |                ^ value used here after move

error: aborting due to 2 previous errors
</pre>
(Notice: *"**used** of moved value: `x`"* instead of *"**use**"*)

Which does not seem to be okay.

After experimenting a bit, it looks like [`report_use_of_moved_value()`](https://github.com/rust-lang/rust/blob/1dc0b573e7ce4314eb196b21b7e0ea4a1bf1f673/src/librustc_mir/borrow_check.rs#L1319) tries to handle both these messages by taking in only one form of`desired_action`.

These messages rise from: *"[{noun} of moved value](https://github.com/rust-lang/rust/blob/1dc0b573e7ce4314eb196b21b7e0ea4a1bf1f673/src/librustc_mir/borrow_check.rs#L1338-L1342)"* and *"[value {verb} here after move](https://github.com/rust-lang/rust/blob/1dc0b573e7ce4314eb196b21b7e0ea4a1bf1f673/src/librustc_mir/borrow_check.rs#L1343)"*.

This PR fixes *"value {verb} here after move"* type messages by passing a corresponding verb (`desired_action`) instead of the original noun.

6 years agoRollup merge of #46174 - stjepang:stabilize-spinloophint, r=sfackler
kennytm [Mon, 27 Nov 2017 19:16:43 +0000 (03:16 +0800)]
Rollup merge of #46174 - stjepang:stabilize-spinloophint, r=sfackler

Stabilize spin_loop_hint

Stabilize `spin_loop_hint` in release `1.23.0`.
I've also renamed feature `hint_core_should_pause` to `spin_loop_hint`.

cc #41196

6 years agoRollup merge of #45506 - ia0:mpsc_recv_error_from, r=alexcrichton
kennytm [Mon, 27 Nov 2017 19:16:41 +0000 (03:16 +0800)]
Rollup merge of #45506 - ia0:mpsc_recv_error_from, r=alexcrichton

Implement From<RecvError> for TryRecvError and RecvTimeoutError

According to the documentation, it looks to me that `TryRecvError` and `RecvTimeoutError` are strict extensions of `RecvError`. As such, it makes sense to allow conversion from the latter type to the two former types without constraining future developments.

This permits to write `input.recv()?` and `input.recv_timeout(timeout)?` in the same function for example.

6 years agoChange the stabilization version to 1.24.0
Stjepan Glavina [Mon, 27 Nov 2017 18:24:13 +0000 (19:24 +0100)]
Change the stabilization version to 1.24.0

6 years agoAuto merge of #46022 - matthewjasper:cannot-assign-twice-error, r=arielb1
bors [Mon, 27 Nov 2017 17:13:20 +0000 (17:13 +0000)]
Auto merge of #46022 - matthewjasper:cannot-assign-twice-error, r=arielb1

Mir Borrowck: Parity with Ast for E0384 (Cannot assign twice to immutable)

- Closes #45199
- Don't allow assigning to dropped immutable variables
- Show the "first assignment" note on the first assignment that can actually come before the second assignment.
- Make "first assignment" notes point to function parameters if needed.
- Don't show a "first assignment" note if the first and second assignment have the same span (in a loop). This matches ast borrowck for now, but maybe this we should add "in previous loop iteration" as with some other borrowck errors. (Commit 2)
- Use revisions to check mir borrowck for the existing tests for this error. (Commit 3)

~~Still working on a less ad-hoc way to get 'first assignment' notes to show on the correct assignment. Also need to check mutating function arguments.~~ Now using a new dataflow pass.

6 years agoAuto merge of #44884 - arielb1:pack-safe, r=nikomatsakis,eddyb
bors [Mon, 27 Nov 2017 14:23:02 +0000 (14:23 +0000)]
Auto merge of #44884 - arielb1:pack-safe, r=nikomatsakis,eddyb

Make accesses to fields of packed structs unsafe

To handle packed structs with destructors (which you'll think are a rare
case, but the `#[repr(packed)] struct Packed<T>(T);` pattern is
ever-popular, which requires handling packed structs with destructors to
avoid monomorphization-time errors), drops of subfields of packed
structs should drop a local move of the field instead of the original
one.

That's it, I think I'll use a strategy suggested by @Zoxc, where this mir
```
drop(packed_struct.field)
```

is replaced by
```
tmp0 = packed_struct.field;
drop tmp0
```

cc #27060 - this should deal with that issue after codegen of drop glue
is updated.

The new errors need to be changed to future-compatibility warnings, but
I'll rather do a crater run first with them as errors to assess the
impact.

cc @eddyb

Things which still need to be done for this:
 - [ ] - handle `repr(packed)` structs in `derive` the same way I did in `Span`, and use derive there again
 - [ ] - implement the "fix packed drops" pass and call it in both the MIR shim and validated MIR pipelines
 - [ ] - do a crater run
 - [ ] - convert the errors to compatibility warnings

6 years agoreword to "consider borrowing here: `{suggestion}`"
Esteban Küber [Sun, 26 Nov 2017 20:52:00 +0000 (12:52 -0800)]
reword to "consider borrowing here: `{suggestion}`"

6 years agoFix test
Esteban Küber [Mon, 27 Nov 2017 14:01:16 +0000 (06:01 -0800)]
Fix test

6 years agoMake main span in impl-trait ciclic reference point to def_span
Esteban Küber [Sun, 26 Nov 2017 20:37:13 +0000 (12:37 -0800)]
Make main span in impl-trait ciclic reference point to def_span

6 years agoAuto merge of #46292 - cramertj:update-libc, r=alexcrichton
bors [Mon, 27 Nov 2017 11:44:17 +0000 (11:44 +0000)]
Auto merge of #46292 - cramertj:update-libc, r=alexcrichton

Update libc to include latest Fuchsia fix

r? @alexcrichton

cc @smklein

6 years agoUpdate tests involving E0384 for mir-borrowck
Matthew Jasper [Mon, 27 Nov 2017 08:07:58 +0000 (08:07 +0000)]
Update tests involving E0384 for mir-borrowck

6 years agoDon't show first assignment in loops
Matthew Jasper [Mon, 27 Nov 2017 08:07:49 +0000 (08:07 +0000)]
Don't show first assignment in loops

Matches current ast-borrowck behavior.

6 years agoAdd initialization info to `MoveData`
Matthew Jasper [Mon, 27 Nov 2017 08:06:36 +0000 (08:06 +0000)]
Add initialization info to `MoveData`

* Used for new dataflow to track if a variable has every been initialized
* Used for other dataflows that need to be updated for initializations

6 years agoAuto merge of #46286 - SimonSapin:patch-6, r=alexcrichton
bors [Mon, 27 Nov 2017 07:54:39 +0000 (07:54 +0000)]
Auto merge of #46286 - SimonSapin:patch-6, r=alexcrichton

Increment Nightly version to 1.24.0

The beta channel is now at 1.23.0-beta.1.

6 years agoAuto merge of #46284 - SimonSapin:deprecate-formatter-flags, r=sfackler
bors [Mon, 27 Nov 2017 05:26:23 +0000 (05:26 +0000)]
Auto merge of #46284 - SimonSapin:deprecate-formatter-flags, r=sfackler

Deprecate the Formatter::flags method, fix #46237

This fixes #46237.

6 years agoAuto merge of #46273 - semarie:openbsd-libc++, r=alexcrichton
bors [Mon, 27 Nov 2017 01:43:41 +0000 (01:43 +0000)]
Auto merge of #46273 - semarie:openbsd-libc++, r=alexcrichton

make OpenBSD to use libc++ instead of (e)stdc++

6 years agoimpl From<bool> for AtomicBool
Oliver Middleton [Mon, 27 Nov 2017 01:23:04 +0000 (01:23 +0000)]
impl From<bool> for AtomicBool

6 years agoUpdate libc to include latest Fuchsia fix
Taylor Cramer [Mon, 27 Nov 2017 01:01:15 +0000 (17:01 -0800)]
Update libc to include latest Fuchsia fix

6 years agoStabilize const-calling existing const-fns in std
Simon Sapin [Sun, 26 Nov 2017 22:19:18 +0000 (23:19 +0100)]
Stabilize const-calling existing const-fns in std

Fixes #46038