Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 16 pull requests #55789

Closed
wants to merge 39 commits into from
Closed

Rollup of 16 pull requests #55789

wants to merge 39 commits into from

Conversation

kennytm
Copy link
Member

@kennytm kennytm commented Nov 8, 2018

Successful merges:

Failed merges:

r? @ghost

birkenfeld and others added 30 commits November 1, 2018 09:52
The new levels s and z are not mentioned as possible values.
Implement the rotate_left and rotate_right operations using
llvm.fshl and llvm.fshr if they are available (LLVM >= 7).

Originally I wanted to expose the funnel_shift_left and
funnel_shift_right intrinsics and implement rotate_left and
rotate_right on top of them. However, emulation of funnel
shifts requires emitting a conditional to check for zero shift
amount, which is not necessary for rotates. I was uncomfortable
doing that here, as I don't want to rely on LLVM to optimize
away that conditional (and for variable rotates, I'm not sure it
can). We should revisit that question when we raise our minimum
version requirement to LLVM 7 and don't need emulation code
anymore.
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 rust-lang#54388.
This makes it easier to debug mis-optimizations that occur during
inlining. Thanks to @nikomatsakis for the suggestion!
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.
This is a (much) more constrained version of rust-lang#54772 that also aims at
improving the situation in rust-lang#34681. It removes any font specifications
that are not the "official" rustdoc font, and instead relies on the
browser to provide the fallback font if the official on is not
available. On Linux systems, this is particularly important, as fonts
like Helvetica, Arial, and Times often look pretty bad since they're
pulled from extracted MS fonts. A specification like `serif` or
`sans-serif` lets the browser instead choose a good font.
The `wasm32-unknown-emscripten` expects the `rust_eh_personality` symbol to be there, but a cfg checking for `target_arch = "wasm32"` which was meant to remove the symbol from the `wasm32-unknown-unknown` target, didn't check for whether `emscripten` is targeted or not, so the symbol accidentally got filtered out there as well.

Fixes rust-lang#55276
Currently Cargo will always capture the output of rustc meaning that
rustc is never hooked up to a tty. To retain colors Cargo uses the
`fwdansi` crate to ensure that ansi color codes are translated to
windows terminal methods (and ansi codes otherwise just go their natural
route on Unix).

Cargo passes `--color always` to rustc to ensure that using a pipe
doesn't trick it into not emitting colors at all. It turns out, however,
that `--color always` ends up still accidentally using the native shell
api on native windows shells.

The fix here is to instead pass `AlwaysAnsi` to `termcolor` instead of
`Always`, ensuring that when `--color always` is passed to rustc and its
output isn't a terminal, we're always generating ansi colors regardless
of the platform.

Closes rust-lang#55769
Support for the program data address space option of LLVM's Target Datalayout

This was introduced recently (specifically, for AVR, cc @dylanmckay).

(I came up with this when attempting to run [avr-rust](https://github.com/avr-rust/rust) rebased on the latest [rust-lang](https://github.com/rust-lang/rust) commits. If this requires a different design, some additional discussions, or is not something to pursue right now, I'd be happy to close this PR).

Note that this somewhat overlaps with @DiamondLovesYou's rust-lang#51576, I think, although the implementation here is significantly simpler: Since the address space applies to _all_ program data, we can just check the pointee's type whenever we create an LLVM pointer type. If it is a function we use the program data address space; if not we use the default address space.

cc @eddyb, who has been reviewing rust-lang#51576

Ref: https://llvm.org/docs/LangRef.html#data-layout
…ramertj

Clarify error message for -C opt-level

The new levels s and z are not mentioned as possible values.
…g_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 rust-lang#55608
Implement rotate using funnel shift on LLVM >= 7

Implement the rotate_left and rotate_right operations using
llvm.fshl and llvm.fshr if they are available (LLVM >= 7).

Originally I wanted to expose the funnel_shift_left and
funnel_shift_right intrinsics and implement rotate_left and
rotate_right on top of them. However, emulation of funnel
shifts requires emitting a conditional to check for zero shift
amount, which is not necessary for rotates. I was uncomfortable
doing that here, as I don't want to rely on LLVM to optimize
away that conditional (and for variable rotates, I'm not sure it
can). We should revisit that question when we raise our minimum
version requirement to LLVM 7 and don't need emulation code
anymore.

Fixes rust-lang#52457.
miri: accept extern types in structs if they are the only field

Fixes rust-lang#55541

Cc @oli-obk @eddyb rust-lang#43467
…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 rust-lang#54388.
impl_stable_hash_for: support enums and tuple structs with generic parameters

Port a bunch of implementations over to the macro, now that that is possible.
…matsakis

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!
…li-obk

borrow_set: remove a helper function and a clone it uses

This clone doesn't seem necessary.

r? @oli-obk
Improve creation of 3 IndexVecs

- preallocate when the minimal size is known
- use `from_elem_n` instead of `new`+`resize`
[regression - rust2018]: unused_mut lint false positives on nightly

Fixes rust-lang#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
…llaumeGomez

Remove intermediate font specs

This is a (much) more constrained version of rust-lang#54772 that also aims at improving the situation in rust-lang#34681. It removes any font specifications that are not the "official" rustdoc font, and instead relies on the browser to provide the fallback font if the official on is not available. On Linux systems, this is particularly important, as fonts like Helvetica, Arial, and Times often look pretty bad since they're pulled from extracted MS fonts. A specification like `serif` or `sans-serif` lets the browser instead choose a good font.
…r=estebank

mir: remove a hacky recursive helper function

It can be replaced with a `while let` loop.
wasm32-unknown-emscripten expects the rust_eh_personality symbol

The `wasm32-unknown-emscripten` expects the `rust_eh_personality` symbol to be there, but a cfg checking for `target_arch = "wasm32"` which was meant to remove the symbol from the `wasm32-unknown-unknown` target, didn't check for whether `emscripten` is targeted or not, so the symbol accidentally got filtered out there as well.

Fixes rust-lang#55276
rustc: Request ansi colors if stderr isn't a tty

Currently Cargo will always capture the output of rustc meaning that
rustc is never hooked up to a tty. To retain colors Cargo uses the
`fwdansi` crate to ensure that ansi color codes are translated to
windows terminal methods (and ansi codes otherwise just go their natural
route on Unix).

Cargo passes `--color always` to rustc to ensure that using a pipe
doesn't trick it into not emitting colors at all. It turns out, however,
that `--color always` ends up still accidentally using the native shell
api on native windows shells.

The fix here is to instead pass `AlwaysAnsi` to `termcolor` instead of
`Always`, ensuring that when `--color always` is passed to rustc and its
output isn't a terminal, we're always generating ansi colors regardless
of the platform.

Closes rust-lang#55769
@kennytm
Copy link
Member Author

kennytm commented Nov 8, 2018

@bors r+ p=16

@bors
Copy link
Contributor

bors commented Nov 8, 2018

📌 Commit de60b44 has been approved by kennytm

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 8, 2018
@bors
Copy link
Contributor

bors commented Nov 8, 2018

⌛ Testing commit de60b44 with merge 034b7941f6749ffa686a83aa27606b828607fdbd...

@rust-highfive
Copy link
Collaborator

The job dist-i586-gnu-i586-i686-musl of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[01:35:43] test sync::tests::test_from_box_trait ... ok
[01:35:43] test sync::tests::test_from_box_trait_zero_sized ... ok
[01:35:43] test sync::tests::test_from_owned ... ok
[01:35:43] test sync::tests::test_from_str ... ok
[01:35:43] error: process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/i686-unknown-linux-musl/release/deps/alloc-c32cd8682a140bf4` (signal: 11, SIGSEGV: invalid memory reference)
[01:35:43] 
[01:35:43] 
[01:35:43] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "i686-unknown-linux-musl" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--"
[01:35:43] 
[01:35:43] 
[01:35:43] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target i586-unknown-linux-gnu,i686-unknown-linux-musl
[01:35:43] Build completed unsuccessfully in 1:32:35
---
travis_time:end:04007a2a:start=1541721774022654376,finish=1541721774030307086,duration=7652710
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1e69a88a
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:start:crashlog
obj/cores/core.25252.!checkout!obj!build!x86_64-unknown-linux-gnu!stage2-std!i686-unknown-linux-musl!release!deps!alloc-c32cd8682a140bf4
warning: core file may not match specified executable file.
[New LWP 25252]
Core was generated by `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/i686-unknown-linux-musl'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  unbin (i=37, c=0x9747218) at src/malloc/malloc.c:194
194 src/malloc/malloc.c: No such file or directory.
#0  unbin (i=37, c=0x9747218) at src/malloc/malloc.c:194
#1  alloc_rev (c=c@entry=0x9747798) at src/malloc/malloc.c:225
#2  0x080c13c7 in __bin_chunk (self=<optimized out>) at src/malloc/malloc.c:467
#3  0x080ab72c in dealloc () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/liballoc_system/lib.rs:170
#4  __rdl_dealloc () at libstd/alloc.rs:160
#5  0x0806f6ca in dealloc () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/liballoc/alloc.rs:96
#6  box_free<std::sync::mpsc::mpsc_queue::Node<(test::TestDesc, test::TestResult, alloc::vec::Vec<u8>)>> () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/liballoc/alloc.rs:206
#7  drop_in_place<alloc::boxed::Box<std::sync::mpsc::mpsc_queue::Node<(test::TestDesc, test::TestResult, alloc::vec::Vec<u8>)>>> () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/libcore/ptr.rs:194
#8  _$LT$std..sync..mpsc..mpsc_queue..Queue$LT$T$GT$$GT$::pop::had68de00b6e91e88 () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/libstd/sync/mpsc/mpsc_queue.rs:109
#9  0x08069ea8 in _$LT$std..sync..mpsc..shared..Packet$LT$T$GT$$GT$::try_recv::h744a3f3a79c5e8ad () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/libstd/sync/mpsc/shared.rs:276
#10 0x08081495 in try_recv<(test::TestDesc, test::TestResult, alloc::vec::Vec<u8>)> () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/libstd/sync/mpsc/mod.rs:1115
#11 recv_timeout<(test::TestDesc, test::TestResult, alloc::vec::Vec<u8>)> () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/libstd/sync/mpsc/mod.rs:1322
#12 run_tests<closure> () at libtest/lib.rs:1167
#13 test::run_tests_console::h228393995ef0c574 () at libtest/lib.rs:962
#14 0x08079d90 in test::test_main::h49fbb39912011bd8 () at libtest/lib.rs:295
#15 0x0807a450 in test::test_main_static::ha1bdc89994421609 () at libtest/lib.rs:329
#16 0x08061402 in alloc::main::h4bdbf0e9663c49f9 ()
#17 0x08049a26 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hab5b8163bc776beb () at /rustc/034b7941f6749ffa686a83aa27606b828607fdbd/src/libstd/rt.rs:74
#18 0x080aa107 in {{closure}} () at libstd/rt.rs:59
#19 std::sys_common::backtrace::__rust_begin_short_backtrace::h03702fa4f9eb426d () at libstd/sys_common/backtrace.rs:136
#20 0x080abea0 in {{closure}} () at libstd/rt.rs:59
#21 std::panicking::try::do_call::hec3a9ec31ecacf5c () at libstd/panicking.rs:310
#22 0x080b80f3 in __rust_maybe_catch_panic () at libpanic_unwind/lib.rs:102
#23 0x080ac7a9 in try<i32,closure> () at libstd/panicking.rs:289
#24 catch_unwind<closure,i32> () at libstd/panic.rs:398
#25 std::rt::lang_start_internal::hadfade540b484135 () at libstd/rt.rs:58
#26 0x0806144b in main ()
travis_time:end:1e69a88a:start=1541721774036398236,finish=1541721774677154058,duration=640755822
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0da665c9
travis_time:start:0da665c9
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:17ea9988
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Nov 9, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 9, 2018
@kennytm kennytm closed this Nov 9, 2018
@Centril Centril added the rollup A PR which is a rollup label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.