Commit Graph

86644 Commits

Author SHA1 Message Date
Pietro Albini
cd17b1d4b6
Rollup merge of #56211 - petrochenkov:fwd, r=petrochenkov
[master] Forward-ports from beta

https://github.com/rust-lang/rust/pull/56206 + one commit from https://github.com/rust-lang/rust/pull/55884 that was accidentally missing in https://github.com/rust-lang/rust/pull/56042 due to an off-by-one mistake in commit ranges

r? @ghost
2018-11-25 17:05:12 +01:00
Pietro Albini
baf45d6d90
Rollup merge of #56210 - RalfJung:c_str, r=oli-obk
read_c_str should call the AllocationExtra hooks

I just hope we do not have other methods that bypass `get_bytes`/`get_bytes_mut`... (looking over the file, I could not find any)

r? @oli-obk
2018-11-25 17:05:11 +01:00
Pietro Albini
d21d510dde
Rollup merge of #56207 - SimonSapin:int_to_from_bytes, r=nagisa
Stabilize the int_to_from_bytes feature

Fixes #52963

FCP to merge completed: https://github.com/rust-lang/rust/issues/52963#issuecomment-416548327
2018-11-25 17:05:10 +01:00
Pietro Albini
dcae83b6a3
Rollup merge of #56204 - estebank:suggest-variant, r=zackmdavis
Suggest correct enum variant on typo

Fix #37992.
2018-11-25 17:05:09 +01:00
Pietro Albini
686257c256
Rollup merge of #56176 - GuillaumeGomez:panic-setup-msg, r=nagisa
Panic setup msg

Fixes #56088.
2018-11-25 17:05:08 +01:00
Pietro Albini
e03fa3eec6
Rollup merge of #56170 - wesleywiser:fix_self_profiler_windows, r=estebank
Fix self profiler ICE on Windows

Fixes #51648
2018-11-25 17:05:07 +01:00
Pietro Albini
989678e525
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.
2018-11-25 17:05:05 +01:00
Pietro Albini
ed6c7b751d
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
2018-11-25 17:05:04 +01:00
Pietro Albini
6398df1520
Rollup merge of #56101 - frewsxcv:frewsxcv-dyn, r=steveklabnik
Incorporate `dyn` into more comments and docs.

r? @rust-lang/docs
2018-11-25 17:05:03 +01:00
Pietro Albini
45e5a856a6
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
2018-11-25 17:05:02 +01:00
Pietro Albini
ab5e45ae6b
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.
2018-11-25 17:05:01 +01:00
Pietro Albini
b16d8eb3f2
Rollup merge of #56072 - da-x:stabilize-literal-matcher, r=petrochenkov
Stabilize macro_literal_matcher

This followed FCP in #35625.

Closes #35625
2018-11-25 17:05:00 +01:00
Pietro Albini
6c2513c0d3
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.
2018-11-25 17:04:58 +01:00
Pietro Albini
1aa3ffaf99
Rollup merge of #56024 - oli-obk:const_fn_collect_inner, r=michaelwoerister
Don't auto-inline const functions

fixes #53451
2018-11-25 17:04:57 +01:00
Vadim Petrochenkov
fe548e311a resolve: Fix some more asserts in import validation 2018-11-25 16:41:29 +03:00
Vadim Petrochenkov
e593431bc7 resolve: Fix bad span arithmetics in import conflict diagnostics 2018-11-25 16:41:16 +03:00
Vadim Petrochenkov
d4a78da543 resolve: Prohibit relative paths in visibilities on 2018 edition 2018-11-25 16:40:03 +03:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
2472e83250
Typo
Co-Authored-By: RalfJung <post@ralfj.de>
2018-11-25 14:21:34 +01:00
bors
e9bca7a993 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.
2018-11-25 12:20:18 +00:00
Ralf Jung
a6ea01f239 fix length of slice returned from read_c_str 2018-11-25 12:07:20 +01:00
Ralf Jung
0fac350f99 yay for NLL 2018-11-25 11:23:21 +01:00
Ralf Jung
af54eb2916 read_c_str should call the AllocationExtra hooks 2018-11-25 10:56:10 +01:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
349271ab2c Typo
Co-Authored-By: RalfJung <post@ralfj.de>
2018-11-25 10:49:43 +01:00
Ralf Jung
fb8b1e3989 accept undef in raw pointers, for consistency with integers 2018-11-25 10:49:43 +01:00
Ralf Jung
261faf3ce2 machine hooks for stack push and pop, frame machine data 2018-11-25 10:49:43 +01:00
Ralf Jung
53ed3b7956 make memory allocation hook infallible 2018-11-25 10:49:43 +01:00
Ralf Jung
6cca7165ea pass MemoryExtra to find_foreign_static and adjust_static_allocation; they might have to create allocations 2018-11-25 10:49:43 +01:00
Ralf Jung
4c090fe310 bring back MemoryExtra 2018-11-25 10:49:43 +01:00
Simon Sapin
68a26ec647 Stabilize the int_to_from_bytes feature
Fixes #52963
2018-11-25 08:29:01 +01:00
Nicholas Nethercote
94967ae8c1 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()`.
2018-11-25 17:54:06 +11:00
Nicholas Nethercote
2d68fa07bf 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`.
2018-11-25 17:54:06 +11:00
Nicholas Nethercote
f23c969492 Introduce in_snapshot and assert_open_snapshot methods.
This makes the two snapshot implementations more consistent with each
other and with crate `ena`.
2018-11-25 17:54:06 +11:00
Nicholas Nethercote
f5624e41e8 Make commit and rollback_to methods take ownership of the snapshots.
Because they shouldn't be reused. This provides consistency with the
`ena` crate.
2018-11-25 17:54:06 +11:00
Nicholas Nethercote
7fe09a6551 Replace a .truncate(0) call with .clear(). 2018-11-25 17:54:06 +11:00
Nicholas Nethercote
c86bbd4830 Rename UndoLogEntry as UndoLog.
So that it matches `librustc_data_structures/snapshot_map/mod.rs` and
the `ena` crate.
2018-11-25 17:54:06 +11:00
Nicholas Nethercote
9847b5cfcb 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`.
2018-11-25 17:54:06 +11:00
Nicholas Nethercote
1e34dfce6f Update to ena 0.11.0.
This version has some significant speed-ups relating to snapshotting.
2018-11-25 17:54:04 +11:00
bors
abe19a7305 Auto merge of #55921 - scalexm:placeholders, r=nikomatsakis
Add placeholder types

Fixes #48696 (handle universes in canonicalization of type inference vars), and fixes #55098.
2018-11-25 06:48:21 +00:00
bors
37961dbd2d 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
2018-11-25 03:00:30 +00:00
Wesley Wiser
dce1c4530e [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
2018-11-24 21:38:35 -05:00
Esteban Küber
6b338e034a Suggest correct enum variant on typo 2018-11-24 16:25:13 -08:00
bors
2dd94c133e 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
2018-11-25 00:00:17 +00:00
scalexm
b8a30f04cd Try to work around #53332 in src/test/run-pass/rustc-rust-log.rs 2018-11-24 23:42:14 +01:00
bors
edaac35d67 Auto merge of #56201 - kennytm:revert-55935, r=alexcrichton
Revert "appveyor: Use VS2017 for all our images"

This reverts commit 008e5dcbd5 (#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
2018-11-24 20:08:57 +00:00
kennytm
91f8e3721c
Revert "appveyor: Use VS2017 for all our images"
This reverts commit 008e5dcbd5.
2018-11-25 00:25:56 +08:00
Oliver Scherer
b853252bcd Rebase fallout 2018-11-24 11:36:32 +01:00
Oliver Scherer
360f9888bc update miri submodule 2018-11-24 11:36:32 +01:00
Oliver Scherer
3220c0ce1a Explain why vtable generation needs no alignment checks 2018-11-24 11:36:32 +01:00
Oliver Scherer
22872196f5 Factor out mplace offsetting into its own method 2018-11-24 11:36:32 +01:00
Oliver Scherer
972d798881 Document Allocation 2018-11-24 11:36:32 +01:00