Skip to content

Commit

Permalink
Auto merge of #65943 - tmandry:rollup-g20uvkh, r=tmandry
Browse files Browse the repository at this point in the history
Rollup of 12 pull requests

Successful merges:

 - #65405 (Create new error E0742 and add long error explanation)
 - #65539 (resolve: Turn the "non-empty glob must import something" error into a lint)
 - #65724 (ci: refactor pr tools job skipping)
 - #65741 (Prevent help popup to disappear when clicking on it)
 - #65832 (Re-enable Emscripten's exception handling support)
 - #65843 (Enable dist for MIPS64 musl targets)
 - #65898 (add basic HermitCore support within libtest)
 - #65900 (proc_macro: clean up bridge::client::__run_expand{1,2} a bit.)
 - #65906 (Update mdbook to 0.3.3)
 - #65920 (Use rustc-workspace-hack for rustbook)
 - #65930 (doc: use new feature gate for c_void type)
 - #65936 (save-analysis: Account for async desugaring in async fn return types)

Failed merges:

 - #65434 (Add long error explanation for E0577)

r? @ghost
  • Loading branch information
bors committed Oct 29, 2019
2 parents caa1f8d + db49686 commit aa69777
Show file tree
Hide file tree
Showing 80 changed files with 304 additions and 202 deletions.
25 changes: 13 additions & 12 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ dependencies = [

[[package]]
name = "ammonia"
version = "2.1.2"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384d704f242a0a9faf793fff775a0be6ab9aa27edabffa097331d73779142520"
checksum = "9e266e1f4be5ffa05309f650e2586fe1d3ae6034eb24025a7ae1dfecc330823a"
dependencies = [
"html5ever",
"lazy_static 1.3.0",
"maplit",
"matches",
"tendril",
"url 1.7.2",
"url 2.1.0",
]

[[package]]
Expand Down Expand Up @@ -1363,16 +1363,16 @@ dependencies = [

[[package]]
name = "html5ever"
version = "0.23.0"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ce65ac8028cf5a287a7dbf6c4e0a6cf2dcf022ed5b167a81bae66ebf599a8b7"
checksum = "025483b0a1e4577bb28578318c886ee5f817dda6eb62473269349044406644cb"
dependencies = [
"log",
"mac",
"markup5ever",
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.5",
]

[[package]]
Expand Down Expand Up @@ -1902,9 +1902,9 @@ checksum = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"

[[package]]
name = "markup5ever"
version = "0.8.1"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1af46a727284117e09780d05038b1ce6fc9c76cc6df183c3dae5a8955a25e21"
checksum = "65381d9d47506b8592b97c4efd936afcf673b09b059f2bef39c7211ee78b9d03"
dependencies = [
"log",
"phf",
Expand All @@ -1925,9 +1925,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"

[[package]]
name = "mdbook"
version = "0.3.1"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "949bb2acb2cff9fa5c375cf9c43e70b3dba0a974d9fe01c31285d7a84d2a0fa2"
checksum = "9a070268274c566082efb6b2ace7743e43ba91a70d5c6982981e96d3c05ac81c"
dependencies = [
"ammonia",
"chrono",
Expand Down Expand Up @@ -3103,6 +3103,7 @@ dependencies = [
"failure",
"mdbook",
"mdbook-linkcheck",
"rustc-workspace-hack",
]

[[package]]
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ def v(*args):
"mips-unknown-linux-musl install directory")
v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root",
"mipsel-unknown-linux-musl install directory")
v("musl-root-mips64", "target.mips64-unknown-linux-muslabi64.musl-root",
"mips64-unknown-linux-muslabi64 install directory")
v("musl-root-mips64el", "target.mips64el-unknown-linux-muslabi64.musl-root",
"mips64el-unknown-linux-muslabi64 install directory")
v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
"rootfs in qemu testing, you probably don't want to use this")
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ impl Step for TestHelpers {
builder.info("Building test helpers");
t!(fs::create_dir_all(&dst));
let mut cfg = cc::Build::new();
// FIXME: Workaround for https://github.com/emscripten-core/emscripten/issues/9013
if target.contains("emscripten") {
cfg.pic(false);
}

// We may have found various cross-compilers a little differently due to our
// extra configuration, so inform gcc of these compilers. Note, though, that
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ pub fn prepare_tool_cargo(
path.ends_with("rls") ||
path.ends_with("clippy") ||
path.ends_with("miri") ||
path.ends_with("rustbook") ||
path.ends_with("rustfmt")
{
cargo.env("LIBZ_SYS_STATIC", "1");
Expand Down
14 changes: 3 additions & 11 deletions src/ci/azure-pipelines/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ jobs:
IMAGE: x86_64-gnu-llvm-6.0
mingw-check:
IMAGE: mingw-check

- job: LinuxTools
timeoutInMinutes: 600
pool:
vmImage: ubuntu-16.04
steps:
- template: steps/run.yml
parameters:
only_on_updated_submodules: 'yes'
variables:
IMAGE: x86_64-gnu-tools
x86_64-gnu-tools:
IMAGE: x86_64-gnu-tools
CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
22 changes: 2 additions & 20 deletions src/ci/azure-pipelines/steps/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
#
# Check travis config for `gdb --batch` command to print all crash logs

parameters:
# When this parameter is set to anything other than an empty string the tests
# will only be executed when the commit updates submodules
only_on_updated_submodules: ''

steps:

# Disable automatic line ending conversion, which is enabled by default on
Expand All @@ -26,21 +21,8 @@ steps:
- checkout: self
fetchDepth: 2

# Set the SKIP_JOB environment variable if this job is supposed to only run
# when submodules are updated and they were not. The following time consuming
# tasks will be skipped when the environment variable is present.
- ${{ if parameters.only_on_updated_submodules }}:
- bash: |
set -e
# Submodules pseudo-files inside git have the 160000 permissions, so when
# those files are present in the diff a submodule was updated.
if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
echo "Executing the job since submodules are updated"
else
echo "Not executing this job since no submodules were updated"
echo "##vso[task.setvariable variable=SKIP_JOB;]1"
fi
displayName: Decide whether to run this job
- bash: src/ci/scripts/should-skip-this.sh
displayName: Decide whether to run this job

# Spawn a background process to collect CPU usage statistics which we'll upload
# at the end of the build. See the comments in the script here for more
Expand Down
16 changes: 16 additions & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
g++-arm-linux-gnueabi \
g++-arm-linux-gnueabihf \
g++-aarch64-linux-gnu \
g++-mips64-linux-gnuabi64 \
g++-mips64el-linux-gnuabi64 \
gcc-sparc64-linux-gnu \
libc6-dev-sparc64-cross \
bzip2 \
Expand Down Expand Up @@ -77,6 +79,14 @@ RUN env \
CC=mipsel-openwrt-linux-gcc \
CXX=mipsel-openwrt-linux-g++ \
bash musl.sh mipsel && \
env \
CC=mips64-linux-gnuabi64-gcc \
CXX=mips64-linux-gnuabi64-g++ \
bash musl.sh mips64 && \
env \
CC=mips64el-linux-gnuabi64-gcc \
CXX=mips64el-linux-gnuabi64-g++ \
bash musl.sh mips64el && \
rm -rf /build/*

# FIXME(mozilla/sccache#235) this shouldn't be necessary but is currently
Expand All @@ -97,6 +107,8 @@ ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
ENV TARGETS=$TARGETS,mips-unknown-linux-musl
ENV TARGETS=$TARGETS,mipsel-unknown-linux-musl
ENV TARGETS=$TARGETS,mips64-unknown-linux-muslabi64
ENV TARGETS=$TARGETS,mips64el-unknown-linux-muslabi64
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf
ENV TARGETS=$TARGETS,armv5te-unknown-linux-gnueabi
Expand Down Expand Up @@ -125,6 +137,8 @@ ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf

ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
CC_mips64el_unknown_linux_muslabi64=mips64el-linux-gnuabi64-gcc \
CC_mips64_unknown_linux_muslabi64=mips64-linux-gnuabi64-gcc \
CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \
CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
Expand All @@ -139,6 +153,8 @@ ENV RUST_CONFIGURE_ARGS \
--musl-root-aarch64=/musl-aarch64 \
--musl-root-mips=/musl-mips \
--musl-root-mipsel=/musl-mipsel \
--musl-root-mips64=/musl-mips64 \
--musl-root-mips64el=/musl-mips64el \
--disable-docs

ENV SCRIPT \
Expand Down
20 changes: 20 additions & 0 deletions src/ci/scripts/should-skip-this.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Set the SKIP_JOB environment variable if this job is supposed to only run
# when submodules are updated and they were not. The following time consuming
# tasks will be skipped when the environment variable is present.

set -euo pipefail
IFS=$'\n\t'

source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

if [[ -z "${CI_ONLY_WHEN_SUBMODULES_CHANGED+x}" ]]; then
echo "Executing the job since there is no skip rule in effect"
elif git diff HEAD^ | grep --quiet "^index .* 160000"; then
# Submodules pseudo-files inside git have the 160000 permissions, so when
# those files are present in the diff a submodule was updated.
echo "Executing the job since submodules are updated"
else
echo "Not executing this job since no submodules were updated"
ciCommandSetEnv SKIP_JOB 1
fi
7 changes: 6 additions & 1 deletion src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ use crate::ops::{Deref, DerefMut};
/// stabilized, it is recommended to use a newtype wrapper around an empty
/// byte array. See the [Nomicon] for details.
///
/// One could use `std::os::raw::c_void` if they want to support old Rust
/// compiler down to 1.1.0. After Rust 1.30.0, it was re-exported by
/// this definition. For more information, please read [RFC 2521].
///
/// [pointer]: ../../std/primitive.pointer.html
/// [Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
/// [RFC 2521]: https://github.com/rust-lang/rfcs/blob/master/text/2521-c_void-reunification.md
// N.B., for LLVM to recognize the void pointer type and by extension
// functions like malloc(), we need to have it represented as i8* in
// LLVM bitcode. The enum used here ensures this and prevents misuse
Expand All @@ -29,7 +34,7 @@ use crate::ops::{Deref, DerefMut};
// would be uninhabited and at least dereferencing such pointers would
// be UB.
#[repr(u8)]
#[stable(feature = "raw_os", since = "1.1.0")]
#[stable(feature = "core_c_void", since = "1.30.0")]
pub enum c_void {
#[unstable(feature = "c_void_variant", reason = "temporary implementation detail",
issue = "0")]
Expand Down
82 changes: 28 additions & 54 deletions src/libproc_macro/bridge/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ macro_rules! define_handles {
}

impl HandleCounters {
// FIXME(#53451) public to work around `Cannot create local mono-item` ICE.
pub extern "C" fn get() -> &'static Self {
// FIXME(eddyb) use a reference to the `static COUNTERS`, intead of
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
extern "C" fn get() -> &'static Self {
static COUNTERS: HandleCounters = HandleCounters {
$($oty: AtomicUsize::new(1),)*
$($ity: AtomicUsize::new(1),)*
Expand Down Expand Up @@ -333,29 +334,32 @@ impl Bridge<'_> {
#[repr(C)]
#[derive(Copy, Clone)]
pub struct Client<F> {
// FIXME(eddyb) use a reference to the `static COUNTERS`, intead of
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters,
pub(super) run: extern "C" fn(Bridge<'_>, F) -> Buffer<u8>,
pub(super) f: F,
}

// FIXME(#53451) public to work around `Cannot create local mono-item` ICE,
// affecting not only the function itself, but also the `BridgeState` `thread_local!`.
pub extern "C" fn __run_expand1(
/// Client-side helper for handling client panics, entering the bridge,
/// deserializing input and serializing output.
// FIXME(eddyb) maybe replace `Bridge::enter` with this?
fn run_client<A: for<'a, 's> DecodeMut<'a, 's, ()>, R: Encode<()>>(
mut bridge: Bridge<'_>,
f: fn(crate::TokenStream) -> crate::TokenStream,
f: impl FnOnce(A) -> R,
) -> Buffer<u8> {
// The initial `cached_buffer` contains the input.
let mut b = bridge.cached_buffer.take();

panic::catch_unwind(panic::AssertUnwindSafe(|| {
bridge.enter(|| {
let reader = &mut &b[..];
let input = TokenStream::decode(reader, &mut ());
let input = A::decode(reader, &mut ());

// Put the `cached_buffer` back in the `Bridge`, for requests.
Bridge::with(|bridge| bridge.cached_buffer = b.take());

let output = f(crate::TokenStream(input)).0;
let output = f(input);

// Take the `cached_buffer` back out, for the output value.
b = Bridge::with(|bridge| bridge.cached_buffer.take());
Expand Down Expand Up @@ -383,65 +387,35 @@ pub extern "C" fn __run_expand1(

impl Client<fn(crate::TokenStream) -> crate::TokenStream> {
pub const fn expand1(f: fn(crate::TokenStream) -> crate::TokenStream) -> Self {
extern "C" fn run(
bridge: Bridge<'_>,
f: impl FnOnce(crate::TokenStream) -> crate::TokenStream,
) -> Buffer<u8> {
run_client(bridge, |input| f(crate::TokenStream(input)).0)
}
Client {
get_handle_counters: HandleCounters::get,
run: __run_expand1,
run,
f,
}
}
}

// FIXME(#53451) public to work around `Cannot create local mono-item` ICE,
// affecting not only the function itself, but also the `BridgeState` `thread_local!`.
pub extern "C" fn __run_expand2(
mut bridge: Bridge<'_>,
f: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream,
) -> Buffer<u8> {
// The initial `cached_buffer` contains the input.
let mut b = bridge.cached_buffer.take();

panic::catch_unwind(panic::AssertUnwindSafe(|| {
bridge.enter(|| {
let reader = &mut &b[..];
let input = TokenStream::decode(reader, &mut ());
let input2 = TokenStream::decode(reader, &mut ());

// Put the `cached_buffer` back in the `Bridge`, for requests.
Bridge::with(|bridge| bridge.cached_buffer = b.take());

let output = f(crate::TokenStream(input), crate::TokenStream(input2)).0;

// Take the `cached_buffer` back out, for the output value.
b = Bridge::with(|bridge| bridge.cached_buffer.take());

// HACK(eddyb) Separate encoding a success value (`Ok(output)`)
// from encoding a panic (`Err(e: PanicMessage)`) to avoid
// having handles outside the `bridge.enter(|| ...)` scope, and
// to catch panics that could happen while encoding the success.
//
// Note that panics should be impossible beyond this point, but
// this is defensively trying to avoid any accidental panicking
// reaching the `extern "C"` (which should `abort` but may not
// at the moment, so this is also potentially preventing UB).
b.clear();
Ok::<_, ()>(output).encode(&mut b, &mut ());
})
}))
.map_err(PanicMessage::from)
.unwrap_or_else(|e| {
b.clear();
Err::<(), _>(e).encode(&mut b, &mut ());
});
b
}

impl Client<fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream> {
pub const fn expand2(
f: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream
) -> Self {
extern "C" fn run(
bridge: Bridge<'_>,
f: impl FnOnce(crate::TokenStream, crate::TokenStream) -> crate::TokenStream,
) -> Buffer<u8> {
run_client(bridge, |(input, input2)| {
f(crate::TokenStream(input), crate::TokenStream(input2)).0
})
}
Client {
get_handle_counters: HandleCounters::get,
run: __run_expand2,
run,
f,
}
}
Expand Down
Loading

0 comments on commit aa69777

Please sign in to comment.