Commit Graph

103258 Commits

Author SHA1 Message Date
Paul Daniel Faria
0a19371243 Add predecessors fn to ReadOnlyBodyCache, fix more Body -> (ReadOnly)BodyCache type errors 2019-12-02 08:31:35 -05:00
Paul Daniel Faria
26f1c01ff7 Add read_only fn to BodyCache<&mut...> impl, fix more Body -> (ReadOnly)BodyCache type errors 2019-12-02 08:31:35 -05:00
Paul Daniel Faria
ab98c595ea Fix a large number of Body -> (ReadOnly)BodyCache type errors, add predecessor_locations fn to ReadOnlyBodyCache 2019-12-02 08:31:35 -05:00
Paul Daniel Faria
2eed90a621 Account for new maybe_sideeffect helper that requires predecessors 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
c8c266a0fb Convert &mut to & since the reference didn't need to be mutable 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
66279d12f9 Revert back to using FunctionCx's Body 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
16952cce01 Add Body back as field of FunctionCx, but under a different lifetime 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
3d68f5f3e7 Improved BodyCache body impl so it only returns a sharable ref, add new body_mut method, fix visit macros, simplify usage in codegen_ssa analyzer 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
30b1d9e798 Remove Body from FunctionCx, pass it along during librustc_codegen_ssa 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
649c73f96d Simplify Cache wrapper to single type, impl Deref on it, fix all compilation errors in librustc_codegen_ssa 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
c0592faa67 Move predecessor cache outside of Body, use wrapper types to manage Cache and Body (WIP, amend this commit) 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
9b335ce1a6 Move predecessors cache back to its own type
This ensures that the cache can be properly ignored during encoding and decoding.
Fix panics that arose due to lack of encoding
2019-12-02 08:30:30 -05:00
Paul Daniel Faria
22bc8a01c1 Add back cache invalidation to basic_blocks_and_local_decls_mut 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
52cc85f008 Address nits and remove unneeded pass 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
94414ac7bb Address excessive line length that was triggering warning during linting 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
ad734680af Move predecessors cache invalidation back to basic_blocks_mut, add a couple more ensure_predecessors to prevent panics 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
8e8c97e5fd Ensure predecessors are recomputed at critical points, fixes panics 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
570e4182e8 Address linting errors caught by CI 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
e1afa519e8 Fix Mir visitor macro to ensure it calls the proper method to invalidate the predecessors cache 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
2b31456068 Add pass to ensure predecessors cache is generated after optimization 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
f534d9f8c4 Stop invalidating predecessors cache when accessing unique basic block, invalidate cache when accessing unique terminator 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
ce29f43f52 Get rid of old comment 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
b5240596d2 Inline cache impl into Body, rename predecessor fns, change output of predecessors_for to slice 2019-12-02 08:30:29 -05:00
Paul Daniel Faria
c16ef6b21d Remove interior mutability in mir predecessors cache 2019-12-02 08:30:29 -05:00
bors
4af3ee8ee2 Auto merge of #66950 - RalfJung:rollup-12d0zx8, r=RalfJung
Rollup of 5 pull requests

Successful merges:

 - #66245 (Conditional compilation for sanitizers)
 - #66654 (Handle const-checks for `&mut` outside of `HasMutInterior`)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66834 (rustbuild fixes)

Failed merges:

r? @ghost
2019-12-02 08:35:24 +00:00
Ralf Jung
910e83eab2
Rollup merge of #66834 - infinity0:master, r=Mark-Simulacrum
rustbuild fixes

When upgrading Debian's rustc to 1.38 I needed these patches:

(1) In order to cross-compile rustc 1.38 and take it through the full rustbuild process including install, I needed the first patch.

(2) In order to build rustc 1.38 using rustc 1.38 itself I need to set --cap-lints warn, otherwise I get this error:

~~~~
error: unnecessary `unsafe` block
   --> src/bootstrap/builder.rs:148:19
    |
148 |             name: unsafe { ::std::intrinsics::type_name::<S>() },
    |                   ^^^^^^ unnecessary `unsafe` block
    |
note: lint level defined here
   --> src/bootstrap/lib.rs:107:9
    |
107 | #![deny(warnings, rust_2018_idioms, unused_lifetimes)]
    |         ^^^^^^^^
    = note: `#[deny(unused_unsafe)]` implied by `#[deny(warnings)]`

error: aborting due to previous error

error: could not compile `bootstrap`.

~~~~

In order to set --cap-lints warn however, I need bootstrap.py not to clobber RUSTFLAGS. (This worked previously, not sure if it was broken intentionally but we would like support for it.)
2019-12-02 09:34:15 +01:00
Ralf Jung
313436807b
Rollup merge of #66827 - RalfJung:miri-missing-ret-place, r=oli-obk
handle diverging functions forwarding their return place

Fixes https://github.com/rust-lang/miri/issues/1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
2019-12-02 09:34:14 +01:00
Ralf Jung
b7f8b77eec
Rollup merge of #66822 - RalfJung:miri-panic, r=oli-obk
libunwind_panic: adjust miri panic hack

We adjust the Miri hack in libpanic_unwind such that even with `cfg(miri)`, we build a version of libpanic_unwind that actually works.

This is needed to resolve https://github.com/integer32llc/rust-playground/issues/548.

r? @oli-obk @alexcrichton
2019-12-02 09:34:12 +01:00
Ralf Jung
f32f56969c
Rollup merge of #66654 - ecstatic-morse:check-consts-ref, r=eddyb,matthewjasper
Handle const-checks for `&mut` outside of `HasMutInterior`

Addresses [this comment](https://github.com/rust-lang/rust/pull/64470#discussion_r328200508).

Const-checking relied on `HasMutInterior` to forbid `&mut` in a const context. This was strange because all we needed to do was look for an `Rvalue::Ref` with a certain `BorrowKind`, whereas the `Qualif` traits are specifically meant to get the qualifs for a *value*. This PR removes that logic from `HasMutInterior` and moves it into `check_consts::Validator`.

As a result, we can now properly handle qualifications for `static`s, which had to be ignored previously since you can e.g. borrow a static `Cell` from another `static`. We also remove the `derived_from_illegal_borrow` logic, since it is no longer necessary; we give good errors for subsequent reborrows/borrows of illegal borrows.
2019-12-02 09:34:10 +01:00
Ralf Jung
8438770e1f
Rollup merge of #66245 - tmiasko:cfg-sanitize, r=oli-obk
Conditional compilation for sanitizers

Configure sanitize option when compiling with a sanitizer to make
it possible to execute different code depending on whether given
sanitizer is enabled or not.
2019-12-02 09:34:09 +01:00
bors
f5c81e0a98 Auto merge of #66944 - Centril:rollup-ojsszx6, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66905 (rustc_plugin: Remove some remaining plugin features)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)
 - #66918 (Add crc and crypto to target feature whitelist on arm)
 - #66926 (add reusable MachineStop variant to Miri engine error enum)

Failed merges:

r? @ghost
2019-12-02 03:09:36 +00:00
Mazdak Farrokhzad
cd47551a0e
Rollup merge of #66926 - RalfJung:miri-stop, r=oli-obk
add reusable MachineStop variant to Miri engine error enum

Replace the Miri-tool-specific `Exit` error variant with something dynamically typed that all clients of the Miri engine can use.

r? @oli-obk
Cc https://github.com/rust-lang/rust/issues/66902
2019-12-02 04:09:07 +01:00
Mazdak Farrokhzad
427e3690f5
Rollup merge of #66918 - makotokato:aarch32-crc-crypto, r=petrochenkov
Add crc and crypto to target feature whitelist on arm

aarch32 (ARMv8 32-bit) supports crc and crypto.
2019-12-02 04:09:06 +01:00
Mazdak Farrokhzad
319064f469
Rollup merge of #66907 - eddyb:br-nicer-named, r=oli-obk
rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.

Context: these `fmt::Debug` impls only get used with `-Z verbose` (which some tests use).

I was going to print the path like in #66850 (or rather, use `DefId`'s `fmt::Debug`, which is close but not as nice), but then I realized that most of the `DefId`s were `crate0:DefIndex(0)`, i.e. the crate root.
As the crate root is not a lifetime, they're clearly dummies of some sort, and we don't have to print anything other than the name for them.

This means that out of all the tests, there's only 5 instances of `BrNamed` that now print the full path to the lifetime parameter, and everything else is shorter instead, which doesn't feel too bad.

cc @nikomatsakis
2019-12-02 04:09:04 +01:00
Mazdak Farrokhzad
90ac08222a
Rollup merge of #66905 - petrochenkov:rmplugin2, r=Centril
rustc_plugin: Remove some remaining plugin features

- Plugin arguments (`#![plugin(my_plugin(args))]`) are no longer supported.
- Registering additional plugins from command line (`-Z extra-plugins=my_plugin`) is no longer supported, `-Z crate-attr=plugin(my_plugin)` can be used instead.
- Lint `plugin_as_library` is removed as mostly useless now, when plugins exist as a compatibility feature with greatly reduced functionality.
- Plugins registering additional LLVM passes (`Registry::register_llvm_pass`) are no longer supported, `-C                   passes=my_passes` can be used instead.

r? @Centril
2019-12-02 04:09:03 +01:00
Mazdak Farrokhzad
dbe880e8ec
Rollup merge of #66850 - eddyb:span-free-formats, r=oli-obk
rustc: hide HirId's fmt::Debug output from -Z span_free_formats.

This replaces the only occurrences of `HirId {...}` from tests with paths, i.e.:
```rust
[closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T]
```
becomes, after this PR:
```rust
[closure@foo<T>::{{closure}}#0 q:&i32, t:&T]
```

r? @oli-obk cc @michaelwoerister
2019-12-02 04:09:01 +01:00
Mazdak Farrokhzad
fd09fad064
Rollup merge of #66789 - eddyb:mir-source-scope-local-data, r=oli-obk
rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.

By having one `ClearCrossCrate<SourceScopeLocalData>` for each scope, as opposed to a single `ClearCrossCrate` for all the `SourceScopeLocalData`s, we can represent the fact that some scopes have `SourceScopeLocalData` associated with them, and some don't.

This is useful when doing MIR inlining across crates, because the `ClearCrossCrate` will be `Clear` for the cross-crate MIR scopes and `Set` for the local ones.

Also see https://github.com/rust-lang/rust/pull/66203#issuecomment-555589574 for some context around this approach.

Fixes #51314.
2019-12-02 04:09:00 +01:00
Mazdak Farrokhzad
a279ebbc91
Rollup merge of #66346 - linkmauve:try-in-docstring, r=Dylan-DPC
Replace .unwrap() with ? in std::os::unix::net

As people like to copy examples, this gives them good habits.
2019-12-02 04:08:55 +01:00
Dylan MacKenzie
ccb4eed352 Incorporate fixes from review 2019-12-01 11:43:24 -08:00
Vadim Petrochenkov
e5944a5a69 rustc_plugin: Some further cleanup
Remove a useless test
2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
279937812a rustc_plugin: Remove support for plugins adding LLVM passes 2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
cf1ffb0355 rustc_lint: Remove lint plugin_as_library 2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
db357a6e3b rustc_plugin: Remove support for adding plugins from command line 2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
55ba05bd0d rustc_plugin: Remove support for plugin arguments 2019-12-01 20:53:25 +03:00
Ralf Jung
4b81dd43e0 add reusable MachineStop variant to Miri engine error enum 2019-12-01 11:49:40 +01:00
Tomasz Miąsko
c703ff2655 Conditional compilation for sanitizers
Configure sanitize option when compiling with a sanitizer to make
it possible to execute different code depending on whether given
sanitizer is enabled or not.
2019-12-01 09:03:35 +01:00
bors
4007d4ef26 Auto merge of #66917 - Centril:rollup-xj2enik, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #66503 (More useful test error messages on should_panic(expected=...) mismatch)
 - #66662 (Miri: run panic-catching tests in liballoc)
 - #66679 (Improve lifetime errors with implicit trait object lifetimes)
 - #66726 (Use recursion_limit for const eval stack limit)
 - #66790 (Do `min_const_fn` checks for `SetDiscriminant`s target)
 - #66832 (const_prop: detect and avoid catching Miri errors that require allocation)
 - #66880 (Add long error code explanation message for E0203)
 - #66890 (Format liballoc with rustfmt)
 - #66896 (pass Queries to compiler callbacks)

Failed merges:

r? @ghost
2019-12-01 06:00:33 +00:00
Mazdak Farrokhzad
bed4c09d21
Rollup merge of #66896 - RalfJung:queries, r=Zoxc
pass Queries to compiler callbacks

https://github.com/rust-lang/rust/pull/66791 made it impossible to access the tcx in the callbacks; this should fix that.

r? @Zoxc
2019-12-01 04:49:32 +01:00
Mazdak Farrokhzad
3db3f156f1
Rollup merge of #66890 - dtolnay:fmt4, r=Dylan-DPC
Format liballoc with rustfmt

Same strategy as #66691 -- as with my previous formatting PRs, I am avoiding causing merge conflicts in other PRs by only touches those files that are not involved in any currently open PR. Files that appear in new PRs between when this PR is opened and when it makes it to the top of the bors queue will be reverted from this PR.

The list of files involved in open PRs is determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8).

With the list of files from the script in outstanding_files, the relevant commands were:

```
$ find src/liballoc -name '*.rs' \
    | xargs rustfmt --edition=2018 --unstable-features --skip-children
$ rg liballoc outstanding_files | xargs git checkout --
```

To confirm no funny business:

```
$ git checkout $THIS_COMMIT^
$ git show --pretty= --name-only $THIS_COMMIT \
    | xargs rustfmt --edition=2018 --unstable-features --skip-children
$ git diff $THIS_COMMIT  # there should be no difference
```

r? @Dylan-DPC
2019-12-01 04:49:31 +01:00
Mazdak Farrokhzad
d4f59564e7
Rollup merge of #66880 - aDotInTheVoid:add-E0203-long, r=GuillaumeGomez
Add long error code explanation message for E0203

Addressed some of #61137

r? @GuillaumeGomez
2019-12-01 04:49:29 +01:00