]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #56170 - wesleywiser:fix_self_profiler_windows, r=estebank
Pietro Albini [Sun, 25 Nov 2018 16:05:07 +0000 (17:05 +0100)]
Rollup merge of #56170 - wesleywiser:fix_self_profiler_windows, r=estebank

Fix self profiler ICE on Windows

Fixes #51648

5 years agoRollup merge of #56151 - alexcrichton:move-out-flaky-test, r=nagisa
Pietro Albini [Sun, 25 Nov 2018 16:05:05 +0000 (17:05 +0100)]
Rollup merge of #56151 - alexcrichton:move-out-flaky-test, r=nagisa

Move a flaky process test out of libstd

This test ensures that everything in `env::vars()` is inherited but
that's not actually true because other tests may add env vars after we
spawn the process, causing the test to be flaky! This commit moves the
test to a run-pass test where it can execute in isolation.

Along the way this removes a lot of the platform specificity of the
test, using iteslf to print the environment instead of a foreign process.

5 years agoRollup merge of #56144 - tromey:Bug-55771-btreemap, r=alexcrichton
Pietro Albini [Sun, 25 Nov 2018 16:05:04 +0000 (17:05 +0100)]
Rollup merge of #56144 - tromey:Bug-55771-btreemap, r=alexcrichton

Fix BTreeSet and BTreeMap gdb pretty-printers

The BTreeSet and BTreeMap gdb pretty-printers did not take the node
structure into account, and consequently only worked for shallow sets.
This fixes the problem by iterating over child nodes when needed.

This patch avoids the current approach of implementing some of the
value manipulations in debugger-indepdendent code.  This was done for
convenience: a type lookup was needed for the first time, and there
currently are no lldb formatters for these types.

Closes #55771

5 years agoRollup merge of #56101 - frewsxcv:frewsxcv-dyn, r=steveklabnik
Pietro Albini [Sun, 25 Nov 2018 16:05:03 +0000 (17:05 +0100)]
Rollup merge of #56101 - frewsxcv:frewsxcv-dyn, r=steveklabnik

Incorporate `dyn` into more comments and docs.

r? @rust-lang/docs

5 years agoRollup merge of #56100 - RalfJung:visiting-generators, r=oli-obk
Pietro Albini [Sun, 25 Nov 2018 16:05:02 +0000 (17:05 +0100)]
Rollup merge of #56100 - RalfJung:visiting-generators, r=oli-obk

generator fields are not necessarily initialized

Looking at the MIR we generate for generators, I think we deliberately leave fields of the generator uninitialized in ways that would be illegal if this was a normal struct (or rather, one would have to use `MaybeUninit`). Consider [this example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=417b4a2950421b726dd7b307e9ee3bec):
```rust
#![feature(generators, generator_trait)]

fn main() {
    let generator = || {
        let mut x = Box::new(5);
        {
            let y = &mut *x;
            *y = 5;
            yield *y;
            *y = 10;
        }
        *x
    };
    let _gen = generator;
}
```

It generates the MIR
```
fn main() -> (){
    let mut _0: ();                      // return place
    scope 1 {
        scope 3 {
        }
        scope 4 {
            let _2: [generator@src/main.rs:4:21: 13:6 for<'r> {std::boxed::Box<i32>, i32, &'r mut i32, ()}]; // "_gen" in scope 4 at src/main.rs:14:9: 14:13
        }
    }
    scope 2 {
        let _1: [generator@src/main.rs:4:21: 13:6 for<'r> {std::boxed::Box<i32>, i32, &'r mut i32, ()}]; // "generator" in scope 2 at src/main.rs:4:9: 4:18
    }

    bb0: {
        StorageLive(_1);                 // bb0[0]: scope 0 at src/main.rs:4:9: 4:18
        (_1.0: u32) = const 0u32;        // bb0[1]: scope 0 at src/main.rs:4:21: 13:6
                                         // ty::Const
                                         // + ty: u32
                                         // + val: Scalar(Bits { size: 4, bits: 0 })
                                         // mir::Constant
                                         // + span: src/main.rs:4:21: 13:6
                                         // + ty: u32
                                         // + literal: Const { ty: u32, val: Scalar(Bits { size: 4, bits: 0 }) }
        StorageLive(_2);                 // bb0[2]: scope 1 at src/main.rs:14:9: 14:13
        _2 = move _1;                    // bb0[3]: scope 1 at src/main.rs:14:16: 14:25
        drop(_2) -> bb1;                 // bb0[4]: scope 1 at src/main.rs:15:1: 15:2
    }

    bb1: {
        StorageDead(_2);                 // bb1[0]: scope 1 at src/main.rs:15:1: 15:2
        StorageDead(_1);                 // bb1[1]: scope 0 at src/main.rs:15:1: 15:2
        return;                          // bb1[2]: scope 0 at src/main.rs:15:2: 15:2
    }
}
```
Notice how we only initialize the first field of `_1` (even though it contains a `Box`!), and then assign it to `_2`. This violates the rule "on assignment, all data must satisfy the validity invariant", and hence miri complains about this code.

What this PR effectively does is to change the validity invariant for generators such that it says nothing about the fields of the generator. We behave as if every field of the generator was wrapped in a `MaybeUninit`.

r? @oli-obk

Cc @nikomatsakis @eddyb @cramertj @withoutboats @Zoxc

5 years agoRollup merge of #56075 - alexcrichton:wasm-producer-section, r=estebank
Pietro Albini [Sun, 25 Nov 2018 16:05:01 +0000 (17:05 +0100)]
Rollup merge of #56075 - alexcrichton:wasm-producer-section, r=estebank

Encode a custom "producers" section in wasm files

This commit implements WebAssembly/tool-conventions#65 for wasm files
produced by the Rust compiler. This adds a bit of metadata to wasm
modules to indicate that the file's language includes Rust and the
file's "processed-by" tools includes rustc.

The thinking with this section is to eventually have telemetry in
browsers tracking all this.

5 years agoRollup merge of #56072 - da-x:stabilize-literal-matcher, r=petrochenkov
Pietro Albini [Sun, 25 Nov 2018 16:05:00 +0000 (17:05 +0100)]
Rollup merge of #56072 - da-x:stabilize-literal-matcher, r=petrochenkov

Stabilize macro_literal_matcher

This followed FCP in #35625.

Closes #35625

5 years agoRollup merge of #56045 - qnighy:additional-sizedness, r=cramertj
Pietro Albini [Sun, 25 Nov 2018 16:04:58 +0000 (17:04 +0100)]
Rollup merge of #56045 - qnighy:additional-sizedness, r=cramertj

Check arg/ret sizedness at ExprKind::Path

This PR solves three problems:

- #50940: ICE on casting unsized tuple struct constructors
- Unsized tuple struct constructors were callable in presence of `unsized_locals`.
- https://github.com/rust-lang/rust/issues/48055#issuecomment-437178966: we cannot relax `Sized` bounds on stable functions because of fn ptr casting

These are caused by lack of `Sized`ness checks for arguments/retvals at **reference sites of `FnDef` items** (not call sites of the functions). Therefore we can basically add more `Sized` obligations on typeck. However, adding `Sized` obligations arbitrarily breaks type inference; to prevent that I added a new method `require_type_is_sized_deferred` which doesn't interfere usual type inference.

5 years agoRollup merge of #56024 - oli-obk:const_fn_collect_inner, r=michaelwoerister
Pietro Albini [Sun, 25 Nov 2018 16:04:57 +0000 (17:04 +0100)]
Rollup merge of #56024 - oli-obk:const_fn_collect_inner, r=michaelwoerister

Don't auto-inline const functions

fixes #53451

5 years agoAuto merge of #55906 - nnethercote:rm-OpenSnapshot-CommittedSnapshot, r=nikomatsakis
bors [Sun, 25 Nov 2018 12:20:18 +0000 (12:20 +0000)]
Auto merge of #55906 - nnethercote:rm-OpenSnapshot-CommittedSnapshot, r=nikomatsakis

Clean up and streamline snapshot data structures

These commits clean up the snapshot structures a bit, so they are more consistent with each other and with the `ena` crate.

They also remove the `OpenSnapshot` and `CommittedSnapshot` entries in the undo log, just like I did for the `ena` crate in https://github.com/rust-lang-nursery/ena/pull/14. This PR in combination with that `ena` PR reduces instruction counts by up to 6% on benchmarks.

r? @nikomatsakis. Note that this isn't quite ready for landing, because the `ena` dependency in the first commit needs to be updated once https://github.com/rust-lang-nursery/ena/pull/14 lands. But otherwise it should be good.

5 years agoRemove `OpenSnapshot` and `CommittedSnapshot` markers from `RegionConstraintCollector`.
Nicholas Nethercote [Mon, 5 Nov 2018 01:21:54 +0000 (12:21 +1100)]
Remove `OpenSnapshot` and `CommittedSnapshot` markers from `RegionConstraintCollector`.

They're not strictly necessary, and they result in the `Vec` being
allocated even for the trivial (and common) case where a
`start_snapshot` is immediately followed by a `commit` or `rollback_to`.

The commit also removes a now-unnecessary argument of
`pop_placeholders()`.

5 years agoRemove `OpenSnapshot` and `CommittedSnapshot` markers from `SnapshotMap`.
Nicholas Nethercote [Sun, 4 Nov 2018 23:59:33 +0000 (10:59 +1100)]
Remove `OpenSnapshot` and `CommittedSnapshot` markers from `SnapshotMap`.

They're not strictly necessary, and they result in the `Vec` being
allocated even for the trivial (and common) case where a
`start_snapshot` is immediately followed by a `commit` or `rollback_to`.

5 years agoIntroduce `in_snapshot` and `assert_open_snapshot` methods.
Nicholas Nethercote [Sun, 4 Nov 2018 23:44:52 +0000 (10:44 +1100)]
Introduce `in_snapshot` and `assert_open_snapshot` methods.

This makes the two snapshot implementations more consistent with each
other and with crate `ena`.

5 years agoMake `commit` and `rollback_to` methods take ownership of the snapshots.
Nicholas Nethercote [Sun, 4 Nov 2018 23:37:23 +0000 (10:37 +1100)]
Make `commit` and `rollback_to` methods take ownership of the snapshots.

Because they shouldn't be reused. This provides consistency with the
`ena` crate.

5 years agoReplace a `.truncate(0)` call with `.clear()`.
Nicholas Nethercote [Sun, 4 Nov 2018 22:35:28 +0000 (09:35 +1100)]
Replace a `.truncate(0)` call with `.clear()`.

5 years agoRename `UndoLogEntry` as `UndoLog`.
Nicholas Nethercote [Sun, 4 Nov 2018 22:34:37 +0000 (09:34 +1100)]
Rename `UndoLogEntry` as `UndoLog`.

So that it matches `librustc_data_structures/snapshot_map/mod.rs` and
the `ena` crate.

5 years agoRemove `insert_noop`.
Nicholas Nethercote [Sun, 4 Nov 2018 22:28:12 +0000 (09:28 +1100)]
Remove `insert_noop`.

Because it's as useless as its name suggests.

This commit also renames `UndoLog::Noop` as `UndoLog::Purged`, because
(a) that's a more descriptive name and (b) it matches the name used in
similar code in `librustc/infer/region_constraints/mod.rs`.

5 years agoUpdate to `ena` 0.11.0.
Nicholas Nethercote [Fri, 2 Nov 2018 08:46:59 +0000 (19:46 +1100)]
Update to `ena` 0.11.0.

This version has some significant speed-ups relating to snapshotting.

5 years agoAuto merge of #55921 - scalexm:placeholders, r=nikomatsakis
bors [Sun, 25 Nov 2018 06:48:21 +0000 (06:48 +0000)]
Auto merge of #55921 - scalexm:placeholders, r=nikomatsakis

Add placeholder types

Fixes #48696 (handle universes in canonicalization of type inference vars), and fixes #55098.

5 years agoAuto merge of #55959 - matthewjasper:remove-end-region, r=nikomatsakis
bors [Sun, 25 Nov 2018 03:00:30 +0000 (03:00 +0000)]
Auto merge of #55959 - matthewjasper:remove-end-region, r=nikomatsakis

Cleanup from lexical MIR borrowck removal

Lexical MIR borrowck was removed months ago now, and `EndRegion`s are no longer used for MIRI verification.

* Remove `rustc::mir::StatementKind::EndRegion` and the `-Zemit_end_regions` flag
* Use `RegionVid` instead of `Region` in BorrowSet
* Rewrite drop generation to create fewer goto terminators.

r? @nikomatsakis

5 years ago[Windows] Work around non-monotonic clocks in the self-profiler
Wesley Wiser [Thu, 22 Nov 2018 18:05:25 +0000 (13:05 -0500)]
[Windows] Work around non-monotonic clocks in the self-profiler

On Windows, the high-resolution timestamp api doesn't seem to always be
monotonic. This can cause panics when the self-profiler uses the
`Instant` api to find elapsed time.

Work around this by detecting the case where now is less than the start
time and just use 0 elapsed ticks as the measurement.

Fixes #51648

5 years agoAuto merge of #55915 - oli-obk:miri_engine_refactoring, r=RalfJung
bors [Sun, 25 Nov 2018 00:00:17 +0000 (00:00 +0000)]
Auto merge of #55915 - oli-obk:miri_engine_refactoring, r=RalfJung

Miri engine refactoring

next small step of https://github.com/rust-lang/rust/pull/55293

r? @RalfJung

5 years agoTry to work around #53332 in `src/test/run-pass/rustc-rust-log.rs`
scalexm [Sat, 24 Nov 2018 22:34:44 +0000 (23:34 +0100)]
Try to work around #53332 in `src/test/run-pass/rustc-rust-log.rs`

5 years agoAuto merge of #56201 - kennytm:revert-55935, r=alexcrichton
bors [Sat, 24 Nov 2018 20:08:57 +0000 (20:08 +0000)]
Auto merge of #56201 - kennytm:revert-55935, r=alexcrichton

Revert "appveyor: Use VS2017 for all our images"

This reverts commit 008e5dcbd55cd751717ffd35a51dd65cd40011d4 (#55935)

We suspect this causes the spurious failure in https://github.com/rust-lang/rust/pull/55906#issuecomment-441365922 and https://github.com/rust-lang/rust/pull/55915#issuecomment-441377543.

r? @alexcrichton

5 years agoRevert "appveyor: Use VS2017 for all our images"
kennytm [Sat, 24 Nov 2018 16:25:29 +0000 (00:25 +0800)]
Revert "appveyor: Use VS2017 for all our images"

This reverts commit 008e5dcbd55cd751717ffd35a51dd65cd40011d4.

5 years agoRebase fallout
Oliver Scherer [Tue, 20 Nov 2018 10:04:07 +0000 (11:04 +0100)]
Rebase fallout

5 years agoupdate miri submodule
Oliver Scherer [Sat, 17 Nov 2018 16:52:25 +0000 (17:52 +0100)]
update miri submodule

5 years agoExplain why vtable generation needs no alignment checks
Oliver Scherer [Sat, 17 Nov 2018 15:18:05 +0000 (16:18 +0100)]
Explain why vtable generation needs no alignment checks

5 years agoFactor out mplace offsetting into its own method
Oliver Scherer [Sat, 17 Nov 2018 12:36:55 +0000 (13:36 +0100)]
Factor out mplace offsetting into its own method

5 years agoDocument `Allocation`
Oliver Scherer [Fri, 16 Nov 2018 15:25:15 +0000 (16:25 +0100)]
Document `Allocation`

5 years agotidy
Oliver Scherer [Fri, 16 Nov 2018 10:48:48 +0000 (11:48 +0100)]
tidy

5 years agoArray and slice projections need to update the place alignment
Oliver Scherer [Fri, 16 Nov 2018 10:46:58 +0000 (11:46 +0100)]
Array and slice projections need to update the place alignment

5 years agocomment nit
Ralf Jung [Fri, 16 Nov 2018 10:16:34 +0000 (11:16 +0100)]
comment nit

Co-Authored-By: oli-obk <github35764891676564198441@oli-obk.de>
5 years agoUse correct alignment checks for scalars and zsts, too
Oliver Scherer [Thu, 15 Nov 2018 17:05:15 +0000 (18:05 +0100)]
Use correct alignment checks for scalars and zsts, too

5 years agoUse correct alignment for fat pointer extra part
Oliver Scherer [Thu, 15 Nov 2018 16:47:11 +0000 (17:47 +0100)]
Use correct alignment for fat pointer extra part

5 years agoExplain {read,write}_scalar failure to cope with zsts
Oliver Scherer [Thu, 15 Nov 2018 13:48:34 +0000 (14:48 +0100)]
Explain {read,write}_scalar failure to cope with zsts

5 years agoMove alignment checks out of `Allocation`
Oliver Scherer [Thu, 15 Nov 2018 13:43:58 +0000 (14:43 +0100)]
Move alignment checks out of `Allocation`

5 years agoExplain early abort legality
Oliver Scherer [Wed, 14 Nov 2018 12:28:38 +0000 (13:28 +0100)]
Explain early abort legality

5 years agoRebase fallout
Oliver Scherer [Wed, 14 Nov 2018 11:19:56 +0000 (12:19 +0100)]
Rebase fallout

5 years agoClean up array/slice of primitive validation
Oliver Scherer [Wed, 14 Nov 2018 10:45:10 +0000 (11:45 +0100)]
Clean up array/slice of primitive validation

5 years agoUpdate miri submodule
Oliver Scherer [Wed, 14 Nov 2018 09:56:09 +0000 (10:56 +0100)]
Update miri submodule

5 years agoRemove stderr file, because the test passes now
Oliver Scherer [Tue, 13 Nov 2018 16:23:26 +0000 (17:23 +0100)]
Remove stderr file, because the test passes now

5 years agoReintroduce zst-slice reading `read_bytes` method on `Memory`
Oliver Scherer [Tue, 13 Nov 2018 15:13:51 +0000 (16:13 +0100)]
Reintroduce zst-slice reading `read_bytes` method on `Memory`

5 years agoProperly test for int pointers in fat pointers to str slices of zero chars
Oliver Scherer [Tue, 13 Nov 2018 14:36:05 +0000 (15:36 +0100)]
Properly test for int pointers in fat pointers to str slices of zero chars

5 years agoReorder methods in `allocation.rs`
Oliver Scherer [Tue, 13 Nov 2018 13:55:18 +0000 (14:55 +0100)]
Reorder methods in `allocation.rs`

5 years agoAdd regression test for integral pointers in zst str slice fat pointers
Oliver Scherer [Tue, 13 Nov 2018 13:54:00 +0000 (14:54 +0100)]
Add regression test for integral pointers in zst str slice fat pointers

5 years agoMake a method that doesn't need `Self` a free function instead
Oliver Scherer [Tue, 13 Nov 2018 13:32:39 +0000 (14:32 +0100)]
Make a method that doesn't need `Self` a free function instead

5 years agoMake zst accesses in allocations take the regular path.
Oliver Scherer [Tue, 13 Nov 2018 09:19:12 +0000 (10:19 +0100)]
Make zst accesses in allocations take the regular path.

Speeding up zst accesses should be done on a higher level.

5 years agoRemove unnecessary `Result` (function always returned `Ok`)
Oliver Scherer [Tue, 13 Nov 2018 08:44:59 +0000 (09:44 +0100)]
Remove unnecessary `Result` (function always returned `Ok`)

5 years agoAdjust rustc_mir::interpret to changes in `Allocation`/`Memory` methods
Oliver Scherer [Mon, 12 Nov 2018 12:26:53 +0000 (13:26 +0100)]
Adjust rustc_mir::interpret to changes in `Allocation`/`Memory` methods

5 years agoMove some byte and scalar accessors from `Memory` to `Allocation`
Oliver Scherer [Mon, 12 Nov 2018 08:00:41 +0000 (09:00 +0100)]
Move some byte and scalar accessors from `Memory` to `Allocation`

5 years agoFiddle a `HasDataLayout` through the allocation methods
Oliver Scherer [Mon, 12 Nov 2018 07:56:41 +0000 (08:56 +0100)]
Fiddle a `HasDataLayout` through the allocation methods

5 years agoAccess `self` instead of `alloc`
Oliver Scherer [Mon, 12 Nov 2018 07:39:04 +0000 (08:39 +0100)]
Access `self` instead of `alloc`

5 years agoAdjust generics to `Allocation` parameters
Oliver Scherer [Mon, 12 Nov 2018 07:38:35 +0000 (08:38 +0100)]
Adjust generics to `Allocation` parameters

5 years agoMove alignment and bounds check from `Memory` to `Allocation`
Oliver Scherer [Mon, 12 Nov 2018 07:37:54 +0000 (08:37 +0100)]
Move alignment and bounds check from `Memory` to `Allocation`

5 years agoMove undef mask methods from `Memory` to `Allocation`
Oliver Scherer [Mon, 12 Nov 2018 07:35:32 +0000 (08:35 +0100)]
Move undef mask methods from `Memory` to `Allocation`

5 years agoMove relocation methods from `Memory` to `Allocation`
Oliver Scherer [Mon, 12 Nov 2018 07:34:04 +0000 (08:34 +0100)]
Move relocation methods from `Memory` to `Allocation`

5 years agoPreliminary code adjustment to let the compiler complain about missing methods
Oliver Scherer [Mon, 12 Nov 2018 07:32:30 +0000 (08:32 +0100)]
Preliminary code adjustment to let the compiler complain about missing methods

5 years agoMove some methods from `Memory` to `Allocation`
Oliver Scherer [Mon, 12 Nov 2018 07:30:52 +0000 (08:30 +0100)]
Move some methods from `Memory` to `Allocation`

5 years agoFix NLL ui test
scalexm [Wed, 14 Nov 2018 11:50:26 +0000 (12:50 +0100)]
Fix NLL ui test

5 years agoFix `ChalkInferenceContext::into_hh_goal`
scalexm [Mon, 5 Nov 2018 17:08:47 +0000 (18:08 +0100)]
Fix `ChalkInferenceContext::into_hh_goal`

5 years agoImplement some instantiate / canonical routines
scalexm [Sat, 3 Nov 2018 15:08:50 +0000 (16:08 +0100)]
Implement some instantiate / canonical routines

5 years agoMove `BoundTy` debruijn index to the `TyKind` enum variant
scalexm [Sat, 3 Nov 2018 14:15:33 +0000 (15:15 +0100)]
Move `BoundTy` debruijn index to the `TyKind` enum variant

5 years agoInstantiate all bound vars universally
scalexm [Sat, 3 Nov 2018 13:52:37 +0000 (14:52 +0100)]
Instantiate all bound vars universally

5 years agoHandle placeholder types in canonicalization
scalexm [Fri, 2 Nov 2018 18:46:30 +0000 (19:46 +0100)]
Handle placeholder types in canonicalization

5 years agoAdd `HAS_TY_PLACEHOLDER` flag
scalexm [Fri, 2 Nov 2018 18:25:20 +0000 (19:25 +0100)]
Add `HAS_TY_PLACEHOLDER` flag

5 years agoRename some occurences of `skol` to `placeholder`
scalexm [Fri, 2 Nov 2018 17:56:30 +0000 (18:56 +0100)]
Rename some occurences of `skol` to `placeholder`

5 years agoIntroduce `TyKind::Placeholder` variant
scalexm [Fri, 2 Nov 2018 17:48:24 +0000 (18:48 +0100)]
Introduce `TyKind::Placeholder` variant

5 years agoDistinguish between placeholder kinds
scalexm [Fri, 2 Nov 2018 14:08:51 +0000 (15:08 +0100)]
Distinguish between placeholder kinds

5 years agoAuto merge of #55935 - alexcrichton:vs2017, r=Mark-Simulacrum
bors [Fri, 23 Nov 2018 23:12:11 +0000 (23:12 +0000)]
Auto merge of #55935 - alexcrichton:vs2017, r=Mark-Simulacrum

appveyor: Use VS2017 for all our images

This was [recommended by AppVeyor][1] to see if it has any impact on our
build times, hopefully on the beneficial side of things! This shouldn't
affect our binary compatibility for generated compilers like it would
normally do for Linux.

[1]: https://help.appveyor.com/discussions/questions/29832-did-recent-changes-apply-to-possibly-slow-down-builds#comment_46484879

5 years agoMerge branch 'master' into frewsxcv-dyn
Corey Farwell [Fri, 23 Nov 2018 19:09:08 +0000 (14:09 -0500)]
Merge branch 'master' into frewsxcv-dyn

5 years agoAuto merge of #56186 - kennytm:rollup, r=kennytm
bors [Fri, 23 Nov 2018 18:42:20 +0000 (18:42 +0000)]
Auto merge of #56186 - kennytm:rollup, r=kennytm

Rollup of 14 pull requests

Successful merges:

 - #55767 (Disable some pretty-printers when gdb is rust-enabled)
 - #55838 (Fix #[cfg] for step impl on ranges)
 - #55869 (Add std::iter::unfold)
 - #55945 (Ensure that the argument to `static_assert` is a `bool`)
 - #56022 (When popping in CTFE, perform validation before jumping to next statement to have a better span for the error)
 - #56048 (Add rustc_codegen_ssa to sysroot)
 - #56091 (Fix json output in the self-profiler)
 - #56097 (Fix invalid bitcast taking bool out of a union represented as a scalar)
 - #56116 (ci: Download clang/lldb from tarballs)
 - #56120 (Add unstable Literal::subspan().)
 - #56154 (Pass additional linker flags when targeting Fuchsia)
 - #56162 (std::str Adapt documentation to reality)
 - #56163 ([master] Backport 1.30.1 release notes)
 - #56168 (Fix the tracking issue for hash_raw_entry)

Failed merges:

r? @ghost

5 years agoRollup merge of #56168 - sfackler:raw-entry-tracking, r=kennytm
kennytm [Fri, 23 Nov 2018 17:32:03 +0000 (01:32 +0800)]
Rollup merge of #56168 - sfackler:raw-entry-tracking, r=kennytm

Fix the tracking issue for hash_raw_entry

It used to point to the implementation PR.

5 years agoRollup merge of #56163 - pietroalbini:1.30.1-relnotes-master, r=pietroalbini
kennytm [Fri, 23 Nov 2018 17:32:02 +0000 (01:32 +0800)]
Rollup merge of #56163 - pietroalbini:1.30.1-relnotes-master, r=pietroalbini

[master] Backport 1.30.1 release notes

Fixes #56135

r? @ghost

5 years agoRollup merge of #56162 - adrianheine:patch-1, r=withoutboats
kennytm [Fri, 23 Nov 2018 17:32:01 +0000 (01:32 +0800)]
Rollup merge of #56162 - adrianheine:patch-1, r=withoutboats

std::str Adapt documentation to reality

5 years agoRollup merge of #56154 - petrhosek:fuchsia-linker-args, r=alexcrichton
kennytm [Fri, 23 Nov 2018 17:31:59 +0000 (01:31 +0800)]
Rollup merge of #56154 - petrhosek:fuchsia-linker-args, r=alexcrichton

Pass additional linker flags when targeting Fuchsia

This is a follow up to 8aa9267 which changed the driver to use lld
directly rather than invoking it through Clang. This change ensures
we pass all the necessary flags to lld.

5 years agoRollup merge of #56120 - SergioBenitez:subspan, r=alexcrichton
kennytm [Fri, 23 Nov 2018 17:31:58 +0000 (01:31 +0800)]
Rollup merge of #56120 - SergioBenitez:subspan, r=alexcrichton

Add unstable Literal::subspan().

Take 2 of #55971. Still ~wrong, but now with a comment! (and less of a surface) Unblocks #49219.

r? @alexcrichton

5 years agoRollup merge of #56116 - alexcrichton:tarball-calng, r=kennytm
kennytm [Fri, 23 Nov 2018 17:31:57 +0000 (01:31 +0800)]
Rollup merge of #56116 - alexcrichton:tarball-calng, r=kennytm

ci: Download clang/lldb from tarballs

Hopefully will speed up CI slightly!

5 years agoRollup merge of #56097 - ogoffart:union-abi, r=eddyb
kennytm [Fri, 23 Nov 2018 17:31:56 +0000 (01:31 +0800)]
Rollup merge of #56097 - ogoffart:union-abi, r=eddyb

Fix invalid bitcast taking bool out of a union represented as a scalar

As reported in https://github.com/rust-lang/rust/pull/54668#issuecomment-440186476

5 years agoRollup merge of #56091 - wesleywiser:fix_self_profiler_json, r=petrochenkov
kennytm [Fri, 23 Nov 2018 17:31:54 +0000 (01:31 +0800)]
Rollup merge of #56091 - wesleywiser:fix_self_profiler_json, r=petrochenkov

Fix json output in the self-profiler

Fix missing ',' array element separators and convert NaN's to 0.

cc @Mark-Simulacrum

5 years agoRollup merge of #56048 - bjorn3:cg_ssa_sysroot, r=eddyb
kennytm [Fri, 23 Nov 2018 17:31:53 +0000 (01:31 +0800)]
Rollup merge of #56048 - bjorn3:cg_ssa_sysroot, r=eddyb

Add rustc_codegen_ssa to sysroot

Outside of rustc you are currently unable to use it.

r? @nikomatsakis (because you r+'ed #55627)

5 years agoRollup merge of #56022 - RalfJung:validate-before-jump, r=oli-obk
kennytm [Fri, 23 Nov 2018 17:31:52 +0000 (01:31 +0800)]
Rollup merge of #56022 - RalfJung:validate-before-jump, r=oli-obk

When popping in CTFE, perform validation before jumping to next statement to have a better span for the error

Currently, when validating the return value fails, the span points at the next statement after the call. That does not make much sense.

r? @oli-obk

5 years agoRollup merge of #55945 - oli-obk:static_assert_arg_type, r=michaelwoerister
kennytm [Fri, 23 Nov 2018 17:31:51 +0000 (01:31 +0800)]
Rollup merge of #55945 - oli-obk:static_assert_arg_type, r=michaelwoerister

Ensure that the argument to `static_assert` is a `bool`

cc @eddyb

5 years agoRollup merge of #55869 - SimonSapin:iterate, r=alexcrichton
kennytm [Fri, 23 Nov 2018 17:31:50 +0000 (01:31 +0800)]
Rollup merge of #55869 - SimonSapin:iterate, r=alexcrichton

Add std::iter::unfold

This adds an **unstable** ~`std::iter::iterate`~ `std::iter::unfold` function and ~`std::iter::Iterate`~ `std::iter::Unfold` type that trivially wrap a ~`FnMut() -> Option<T>`~ `FnMut(&mut State) -> Option<T>` closure to create an iterator. ~Iterator state can be kept in the closure’s environment or captures.~

This is intended to help reduce amount of boilerplate needed when defining an iterator that is only created in one place. Compare the existing example of the `std::iter` module: (explanatory comments elided)

```rust
struct Counter {
    count: usize,
}

impl Counter {
    fn new() -> Counter {
        Counter { count: 0 }
    }
}

impl Iterator for Counter {
    type Item = usize;

    fn next(&mut self) -> Option<usize> {
        self.count += 1;
        if self.count < 6 {
            Some(self.count)
        } else {
            None
        }
    }
}
```

… with the same algorithm rewritten to use this new API:

```rust
fn counter() -> impl Iterator<Item=usize> {
    std::iter::unfold(0, |count| {
        *count += 1;
        if *count < 6 {
            Some(*count)
        } else {
            None
        }
    })
}
```

-----

This also add unstable `std::iter::successors` which takes an (optional) initial item and a closure that takes an item and computes the next one (its successor).

```rust
let powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10));
assert_eq!(powers_of_10.collect::<Vec<_>>(), &[1, 10, 100, 1_000, 10_000]);
```

5 years agoRollup merge of #55838 - dralley:fix-cfg-step, r=Kimundi
kennytm [Fri, 23 Nov 2018 17:31:48 +0000 (01:31 +0800)]
Rollup merge of #55838 - dralley:fix-cfg-step, r=Kimundi

Fix #[cfg] for step impl on ranges

```#[cfg(target_pointer_witdth = ...)]``` is misspelled

5 years agoRollup merge of #55767 - tromey:disable-some-pretty-printers, r=alexcrichton
kennytm [Fri, 23 Nov 2018 17:31:47 +0000 (01:31 +0800)]
Rollup merge of #55767 - tromey:disable-some-pretty-printers, r=alexcrichton

Disable some pretty-printers when gdb is rust-enabled

A rust-enabled gdb already knows how to display string slices,
structs, tuples, and enums (and after #54004, the pretty-printers
can't handle enums at all).  This patch disables these pretty-printers
when gdb is rust-enabled.

The "gdb-pretty-struct-and-enums-pre-gdb-7-7.rs" test is renamed,
because it does not seem to depend on any behavior of that version of
gdb, and because gdb 7.7 is 4 years old now.

5 years agoAuto merge of #56184 - matthiaskrgr:clippy, r=oli-obk
bors [Fri, 23 Nov 2018 14:22:04 +0000 (14:22 +0000)]
Auto merge of #56184 - matthiaskrgr:clippy, r=oli-obk

submodules: update clippy from 2f6881c6 to 754b4c07

Changes:
````
rustup https://github.com/rust-lang/rust/pull/54071/
dependencies: update pulldown-cmark from 0.1 to 0.2
s/file_map/source_map
````

r? @oli-obk

5 years agosubmodules: update clippy from 2f6881c6 to 754b4c07
Matthias Krüger [Fri, 23 Nov 2018 11:52:47 +0000 (12:52 +0100)]
submodules: update clippy from 2f6881c6 to 754b4c07

Changes:
````
rustup https://github.com/rust-lang/rust/pull/54071/
dependencies: update pulldown-cmark from 0.1 to 0.2
s/file_map/source_map
````

5 years agoAuto merge of #55808 - estebank:type-arguments, r=petrochenkov
bors [Fri, 23 Nov 2018 11:26:48 +0000 (11:26 +0000)]
Auto merge of #55808 - estebank:type-arguments, r=petrochenkov

Suggest correct syntax when writing type arg instead of assoc type

- When confusing an associated type with a type argument, suggest the appropriate syntax. Given `Iterator<isize>`, suggest `Iterator<Item = isize>`.
- When encountering multiple missing associated types, emit only one diagnostic.
- Point at associated type def span for context.
- Point at each extra type argument.

Follow up to #48288, fix #20977.

5 years agoAuto merge of #54071 - eddyb:alignsssss, r=oli-obk
bors [Fri, 23 Nov 2018 01:02:21 +0000 (01:02 +0000)]
Auto merge of #54071 - eddyb:alignsssss, r=oli-obk

rustc_target: separate out an individual alignment quantity type from Align.

Before this PR, `rustc_target::abi::Align` combined "power-of-two alignment quantity" semantics, with a distinction between ABI (required) and preferred alignment (by having two quantities).

After this PR, `Align` is only *one* such quantity, and a new `AbiAndPrefAlign` type is introduced to hold the pair of ABI and preferred `Align` quantities.

`Align` is used everywhere one quantity is necessary/sufficient, simplifying some of the code in codegen/miri, while `AbiAndPrefAlign` only in layout computation (to propagate preferred alignment).

r? @oli-obk cc @nagisa @RalfJung @nikomatsakis

5 years agoDo not point at associated types from other crates
Esteban Küber [Thu, 22 Nov 2018 22:30:33 +0000 (14:30 -0800)]
Do not point at associated types from other crates

This is a somewhat arbitrary restriction in order to be consistent in the
output of the tests regardless of target platform.

5 years agoReword and fix test
Esteban Küber [Fri, 9 Nov 2018 05:43:08 +0000 (21:43 -0800)]
Reword and fix test

5 years agoSuggest correct syntax when writing type arg instead of assoc type
Esteban Küber [Fri, 9 Nov 2018 02:54:34 +0000 (18:54 -0800)]
Suggest correct syntax when writing type arg instead of assoc type

When confusing an associated type with a type argument, suggest the
appropriate syntax.

Given `Iterator<isize>`, suggest `Iterator<Item = isize>`.

5 years agoPoint at the associated type's def span
Esteban Küber [Fri, 9 Nov 2018 02:14:41 +0000 (18:14 -0800)]
Point at the associated type's def span

5 years agoJoin multiple E0191 errors in the same location under a single diagnostic
Esteban Küber [Fri, 9 Nov 2018 02:11:37 +0000 (18:11 -0800)]
Join multiple E0191 errors in the same location under a single diagnostic

5 years agoPoint at every unexpected lifetime and type argument in E0107
Esteban Küber [Fri, 9 Nov 2018 01:51:13 +0000 (17:51 -0800)]
Point at every unexpected lifetime and type argument in E0107

5 years agoAuto merge of #56143 - nikomatsakis:issue-56128-segment-id-ice-nightly, r=petrochenkov
bors [Thu, 22 Nov 2018 20:29:51 +0000 (20:29 +0000)]
Auto merge of #56143 - nikomatsakis:issue-56128-segment-id-ice-nightly, r=petrochenkov

Issue 56128 segment id ice nightly

Tentative fix for #56128

From what I can tell, the problem is that if you have `pub(super) use foo::{a, b}`, then when we explode the `a` and `b`, the segment ids from the `super` path were not getting cloned. However, once I fixed *that*, then I ran into a problem that the "visibility" node-ids were not present in the final HIR -- this is because the visibility of the "stem" that is returned in this case was getting reset to inherited. I don't *think* it is a problem to undo that, so that the visibility is returned unmodified.

Fixes #55475
Fixes #56128

cc @nrc @petrochenkov

5 years agoMove fake rustc_codegen_ssa dependency from rustc_driver to rustc-main
bjorn3 [Mon, 19 Nov 2018 17:28:44 +0000 (18:28 +0100)]
Move fake rustc_codegen_ssa dependency from rustc_driver to rustc-main

5 years agoAdd rustc_codegen_ssa to sysroot
bjorn3 [Sun, 18 Nov 2018 17:06:31 +0000 (18:06 +0100)]
Add rustc_codegen_ssa to sysroot

5 years agoDisable the self-profiler unless the `-Z self-profile` flag is set
Wesley Wiser [Thu, 22 Nov 2018 17:56:15 +0000 (12:56 -0500)]
Disable the self-profiler unless the `-Z self-profile` flag is set

Related to #51648