Commit Graph

85756 Commits

Author SHA1 Message Date
Mark Rousskov
7944075e0b
Rollup merge of #55758 - davidtwco:issue-55344, r=pnkfelix
[regression - rust2018]: unused_mut lint false positives on nightly

Fixes #55344.

This commit filters out locals that have never been initialized for
consideration in the `unused_mut` lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the `unused_mut` lint and creating a set of those locals that were
never initialized.

r? @pnkfelix
2018-11-08 18:15:10 -07:00
Mark Rousskov
660340e4aa
Rollup merge of #55755 - ljedrz:a_few_indexvec_tweaks, r=varkor
Improve creation of 3 IndexVecs

- preallocate when the minimal size is known
- use `from_elem_n` instead of `new`+`resize`
2018-11-08 18:15:08 -07:00
Mark Rousskov
7864780f9e
Rollup merge of #55753 - ljedrz:borrow_set_insert_clone, r=oli-obk
borrow_set: remove a helper function and a clone it uses

This clone doesn't seem necessary.

r? @oli-obk
2018-11-08 18:15:05 -07:00
Mark Rousskov
792476516f
Rollup merge of #55742 - F001:fix-55718, r=petrochenkov
Avoid panic when matching function call

Fix #55718

This bug is introduced by #53751. The original code checked `Def::AssociatedConst(..) | Def::Method(..)` before `pat_ty.no_bound_vars().expect("expected fn type")`. But somehow I exchanged the sequence carelessly. Sorry about that.

r? @petrochenkov
2018-11-08 18:15:03 -07:00
Mark Rousskov
96ee13a56d
Rollup merge of #55739 - wesleywiser:mir_inline_fuel, r=nikomatsakis
Consume optimization fuel from the MIR inliner

This makes it easier to debug mis-optimizations that occur during
inlining. Thanks to @nikomatsakis for the suggestion!
2018-11-08 18:15:01 -07:00
Mark Rousskov
e873984fa8
Rollup merge of #55736 - estebank:elide-anon-lt, r=petrochenkov
Elide anon lifetimes in conflicting impl note

Fix #54690.
2018-11-08 18:14:58 -07:00
Mark Rousskov
8fd4e5a467
Rollup merge of #55719 - pnkfelix:issue-54388-sidestep-link-error-from-rustfixed-code, r=alexcrichton
Sidestep link error from rustfix'ed code by using a *defined* static.

As a drive-by, added `-g` to the compile-flags so that the test more
reliably fails to compile when the extern static in question is *not*
provided. (I.e. this is making the test more robust in the face of
potential future revisions.)

Fix #54388.
2018-11-08 18:14:56 -07:00
Mark Rousskov
602a8b400f
Rollup merge of #55659 - alexcrichton:musl-no-group, r=michaelwoerister
rustc: Delete grouping logic from the musl target

This commit deletes the injection of `-(` and `-)` options to the linker
for the musl targets. This actually causes problems today on nightly if
you execute:

    $ echo 'fn main() {}' >> foo.rs
    $ rustc --target x86_64-unknown-linux-musl -C panic=abort

you get a linker error about "cannot nest groups". This comes about
because rustc injects its own `--start-group` and `--end-group`
variables which clash with the outer `-(` and `-)` variables. It's not
entirely clear to me why this doesn't affect the musl target by default
(in `-C panic=unwind` mode).

The compiler's own injection of `--start-group` and `--end-group` should
solve the issues mentioned in the comment for injecting `-(` and `-)` as
well.
2018-11-08 18:14:53 -07:00
Mark Rousskov
4805a97274
Rollup merge of #55638 - pnkfelix:issue-55608-ice-reempty-msg_span_from_free_region, r=estebank
Fix ICE in msg_span_from_free_region on ReEmpty

On an example like this:

```rust
#![feature(conservative_impl_trait)]

fn server() -> impl FilterBase2 {
    segment2(|| { loop { } }).map2(|| "")
}

trait FilterBase2 {
    fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } }
}

struct Map2<F> { _func: F }

impl<F> FilterBase2 for Map2<F> { }

fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> {
    loop { }
}
```

we now, instead of ICE'ing, get a diagnostic like:

```
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
 --> issue-55608.rs:3:16
  |
3 | fn server() -> impl FilterBase2 {
  |                ^^^^^^^^^^^^^^^^
  |
  = note: hidden type `Map2<[closure@issue-55608.rs:4:36: 4:41]>` captures an empty lifetime
```

Fix #55608
2018-11-08 18:14:51 -07:00
Mark Rousskov
78cab36139
Rollup merge of #55633 - nikic:memcpy-align, r=nagisa
Support memcpy/memmove with differing src/dst alignment

If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version.

Fixes #49740.
2018-11-08 18:14:49 -07:00
Mark Rousskov
6153ce127a
Rollup merge of #55576 - birkenfeld:opt-level-error-msg, r=cramertj
Clarify error message for -C opt-level

The new levels s and z are not mentioned as possible values.
2018-11-08 18:14:46 -07:00
ljedrz
e3390d89ea Improve creation of 3 IndexVecs 2018-11-08 11:55:10 +01:00
bors
653da4fd00 Auto merge of #55532 - pnkfelix:rustc_error-survey, r=nikomatsakis
#[rustc_error] survey

Fix #55505
2018-11-08 09:38:49 +00:00
bors
1d834550d5 Auto merge of #55366 - Amanieu:stable_layout, r=Amanieu
Add tracking issue for Layout methods (and some API changes)

These methods are already useful when used with the stable global allocator API (stabilized in #51241).

```rust
pub fn align_to(&self, align: usize) -> Result<Layout, LayoutErr>;
pub fn padding_needed_for(&self, align: usize) -> usize;
pub fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
pub fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>;
pub fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>;
pub fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>;
pub fn array<T>(n: usize) -> Result<Layout, LayoutErr>;
```

cc #32838

r? @SimonSapin
2018-11-08 06:52:27 +00:00
bors
9c304fb0cf Auto merge of #55187 - malbarbo:fix-manifest, r=alexcrichton
Remove targets from the manifest that are not built on travis

Fixes https://github.com/rust-lang/rust/issues/55020
2018-11-08 01:10:10 +00:00
Marco A L Barbosa
11637aca8c Remove targets from the manifest that are not built on travis
Fixes https://github.com/rust-lang/rust/issues/55020
2018-11-07 19:15:04 -02:00
bors
25a42b2ceb Auto merge of #55746 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

Successful merges:

 - #55377 (Slight copy-editing for `std::cell::Cell` docs)
 - #55441 (Remove unused re import in gdb_rust_pretty_printing)
 - #55453 (Choose predicates without inference variables over those with them)
 - #55495 (Don't print opt fuel messages to stdout because it breaks Rustbuild)
 - #55501 (Make `process_obligations`' computation of `completed` optional.)
 - #55510 (Fix feature gate only being checked on first repr attr.)
 - #55609 (Run name-anon-globals after LTO passes as well)
 - #55645 (do not print wrapping ranges like normal ranges in validity diagnostics)
 - #55688 (Standardised names and location of ui issue tests)
 - #55692 (-C remark: fix incorrect warning about requiring "--debuginfo" instead of "-C debuginfo=n")
 - #55702 (Add `aarch64-pc-windows-msvc` to deployed targets)
 - #55728 (Update lldb)
 - #55730 (Use trait impl method span when type param mismatch is due to impl Trait)
 - #55734 (refactor: use shorthand fields)
2018-11-07 17:14:34 +00:00
Felix S. Klock II
34ffbdb965 This test will not link on wasm32. 2018-11-07 16:33:41 +01:00
David Wood
299a452a75
Ignore never-initialized locals for unused_mut.
This commit filters out locals that have never been initialized for
consideration in the `unused_mut` lint.

This is intended to detect when the statement that would have
initialized the local was removed as unreachable code. In these cases,
we would not want to lint. This is the same behaviour as the AST borrow
checker.

This is achieved by taking advantage of an existing pass over the MIR
for the `unused_mut` lint and creating a set of those locals that were
never initialized.
2018-11-07 16:10:40 +01:00
Felix S. Klock II
f4da71e04e work around deviation in diagnostic output for opt-level=0 by forcing -O. 2018-11-07 15:58:59 +01:00
Felix S. Klock II
58c7a786b0 Update output of lint-type-overflow2.stderr to reflect its output from rustc -O.
(The fact that output differs under `opt-level=0` is an instance of #55757.)
2018-11-07 15:47:49 +01:00
ljedrz
2d7426bb5a borrow_set: remove a helper function and a clone it uses 2018-11-07 15:32:58 +01:00
F001
f63c2f80e5 fix ICE 2018-11-07 22:17:32 +08:00
kennytm
4e86576277
Rollup merge of #55645 - RalfJung:validity-range-inclusive, r=oli-obk
do not print wrapping ranges like normal ranges in validity diagnostics
2018-11-07 21:28:19 +08:00
kennytm
9d9146ad95
Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwco
refactor: use shorthand fields

refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07 21:27:00 +08:00
kennytm
e222d1db3c
Rollup merge of #55730 - estebank:impl-trait-arg-mismatch, r=varkor
Use trait impl method span when type param mismatch is due to impl Trait

Fix #55374.
2018-11-07 21:26:56 +08:00
kennytm
dd9ea2ae64
Rollup merge of #55728 - tromey:update-lldb, r=alexcrichton
Update lldb

This updates lldb to pick up some bug fixes, and makes one minor test
suite fix to account for this.
2018-11-07 21:26:54 +08:00
Wesley Wiser
e72afa9573 Consume optimization fuel from the MIR inliner
This makes it easier to debug mis-optimizations that occur during
inlining. Thanks to @nikomatsakis for the suggestion!
2018-11-07 08:17:21 -05:00
Ralf Jung
3ec89746ba test diagnostics for more ranges 2018-11-07 14:06:38 +01:00
Ralf Jung
b42b9b34d5 pretty-print scalar range that only has an upper bound 2018-11-07 13:58:43 +01:00
Ralf Jung
9dba743a6a do not print wrapping ranges like normal ranges in diagnostics 2018-11-07 13:46:49 +01:00
Felix S. Klock II
a2e090624e Removed #[rustc_error] from tests that are all // compile-pass.
I also added `// skip-codegen` to each one, to address potential concerns
that this change would otherwise slow down our test suite spending time
generating code for files that are really just meant to be checks of
compiler diagnostics.

(However, I will say: My preference is to not use `// skip-codegen` if
one can avoid it. We can use all the testing of how we drive LLVM that
we can get...)

(Updated post rebase.)
2018-11-07 13:09:52 +01:00
Felix S. Klock II
0332a39f07 Replaced use of #[rustc_error] with // skip-codegen.
This test specifically notes that it does not want to invoke the
linker, due to the way it (IMO weakly) exercises the `#[link=...]`
attribute.

In any case, removing the the `#[rustc_error]` here uncovered an
"invalid windows subsystem" error that was previously not included in
the transcript of diagnostic output. So that's a step forward, (right?).
2018-11-07 13:09:52 +01:00
Felix S. Klock II
bf544fa920 remove #[rustc_error] from ui/ tests that remain compile-fail tests. 2018-11-07 13:09:52 +01:00
kennytm
6f10e34fd3
Rollup merge of #55702 - alexcrichton:arm64-msvc-deploy, r=michaelwoerister
Add `aarch64-pc-windows-msvc` to deployed targets

Accidentally forgotten from #54718!
2018-11-07 18:01:58 +08:00
kennytm
3682d3140c
Rollup merge of #55692 - matthiaskrgr:remark_debuginfo_hint, r=michaelwoerister
-C remark: fix incorrect warning about requiring "--debuginfo" instead of "-C debuginfo=n"

Previously suggested "--debuginfo" does not actually work.
2018-11-07 18:01:57 +08:00
kennytm
8f93a3c05e
Rollup merge of #55688 - alexreg:move-issue-tests, r=estebank
Standardised names and location of ui issue tests

None
2018-11-07 18:01:56 +08:00
kennytm
dfa104ecf1
Rollup merge of #55609 - nikic:fix-51947, r=nagisa
Run name-anon-globals after LTO passes as well

If we're going to emit bitcode (through ThinLTOBuffer), then we need to ensure that anon globals are named. This was already done after optimization passes, but also has to happen after LTO passes, as we always emit the final result in a ThinLTO-compatible manner.

I added the test as `run-make`. The important bit is that we emit bitcode in some way (e.g. `--crate-type rlib` or `--emit=llvm-bc`). Please tell me if there is a better way to test for that.

Fixes #51947
2018-11-07 18:01:54 +08:00
kennytm
0708a6a717
Rollup merge of #55510 - bitshifter:repr-feature-gate-fix, r=petrochenkov
Fix feature gate only being checked on first repr attr.

Reported in https://github.com/rust-lang/rust/issues/33158#issuecomment-412185357.
2018-11-07 18:01:53 +08:00
kennytm
d64142bb2e
Rollup merge of #55501 - nnethercote:DoCompleted, r=pnkfelix
Make `process_obligations`' computation of `completed` optional.

It's only used in tests.

This reduces instruction counts on several benchmarks by 0.5--1%.
2018-11-07 18:01:51 +08:00
kennytm
099c587851
Rollup merge of #55495 - wesleywiser:opt_fuel_rustbuild, r=nikomatsakis
Don't print opt fuel messages to stdout because it breaks Rustbuild

Rustbuild passes `--message-format json` to the compiler invocations
which causes JSON to be emitted on stdout. Printing optimization fuel
messages to stdout breaks the json and causes Rustbuild to fail.

Work around this by emitting optimization fuel related messages on
stderr instead.
2018-11-07 18:01:50 +08:00
kennytm
88f214cfd5
Rollup merge of #55453 - Aaron1011:fix/rustdoc-lifetime, r=pnkfelix
Choose predicates without inference variables over those with them

Fixes #54705

When constructing synthetic auto trait impls, we may come across
multiple predicates involving the same type, trait, and substitutions.
Since we can only display one of these, we pick the one with the 'most
strict' lifetime paramters. This ensures that the impl we render the
user is actually valid (that is, a struct matching that impl will
actually implement the auto trait in question).

This commit exapnds the definition of 'more strict' to take into account
inference variables. We always choose a predicate without inference
variables over a predicate with inference variables.
2018-11-07 18:01:48 +08:00
kennytm
0156dd2589
Rollup merge of #55441 - xfix:patch-12, r=aturon
Remove unused re import in gdb_rust_pretty_printing
2018-11-07 18:01:47 +08:00
kennytm
ac9d5ec74e
Rollup merge of #55377 - goffrie:patch-2, r=joshtriplett
Slight copy-editing for `std::cell::Cell` docs

Hopefully this is a bit more precise and also more correct English.
2018-11-07 18:01:45 +08:00
bors
8315b11b63 Auto merge of #55549 - RalfJung:miri-visitor, r=oli-obk
Value visitors for miri

Generalize the traversal part of validation to a `ValueVisitor`.

~~This includes https://github.com/rust-lang/rust/pull/55316, [click here](https://github.com/RalfJung/rust/compare/retagging...RalfJung:miri-visitor) for just the new commits.~~
2018-11-07 09:14:12 +00:00
bors
ddd4b194a0 Auto merge of #55262 - oli-obk:dangling_alloc_id_ice, r=RalfJung
Change the ICE from #55223 to a hard error

cc @SimonSapin

r? @RalfJung

fixes https://github.com/rust-lang/rust/issues/55287
2018-11-06 23:36:13 +00:00
Esteban Küber
3ec837e763 Elide anon lifetimes in conflicting impl note 2018-11-06 14:49:09 -08:00
Amanieu d'Antras
02d50de63e Add a tracking issue for extra Layout methods 2018-11-06 20:36:43 +00:00
teresy
eca11b99a7 refactor: use shorthand fields 2018-11-06 15:05:44 -05:00
Esteban Küber
46fcf1c6ad Use trait impl method span when type param mismatch is due to impl Trait 2018-11-06 11:24:48 -08:00