Skip to content

Commit

Permalink
Auto merge of #74375 - Manishearth:rollup-10vbpdh, r=Manishearth
Browse files Browse the repository at this point in the history
Rollup of 14 pull requests

Successful merges:

 - #72973 (RISC-V GNU/Linux as host platform)
 - #73918 (Clean up E0715 explanation)
 - #73959 (Clean up E0716 explanation)
 - #74119 (Remove `Compiler::compile()`.)
 - #74196 (Add option to collapse automatically implementors)
 - #74218 (Add margin after doc search results)
 - #74276 (improve DiscriminantKind handling)
 - #74291 (Added docs for `From<c_int>` for `ExitStatus`)
 - #74294 (Update cross-compilation README)
 - #74337 (Handle case of incomplete local ty more gracefully)
 - #74344 (Remove string comparison and use diagnostic item instead)
 - #74347 (Initialize default providers only once)
 - #74353 (Edit docs for rustc_middle::dep_graph::dep_node)
 - #74374 (Add a 1.45 release note on lto vs. embed-bitcode)

Failed merges:

 - #74251 (Teach bootstrap about target files vs target triples)

r? @ghost
  • Loading branch information
bors committed Jul 16, 2020
2 parents 7e11379 + 0bde1c3 commit e2e29de
Show file tree
Hide file tree
Showing 35 changed files with 221 additions and 198 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ jobs:
- name: dist-powerpc64le-linux
os: ubuntu-latest-xl
env: {}
- name: dist-riscv64-linux
os: ubuntu-latest-xl
env: {}
- name: dist-s390x-linux
os: ubuntu-latest-xl
env: {}
Expand Down
10 changes: 10 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ Stabilized APIs
Cargo
-----

- [Cargo uses the `embed-bitcode` flag to optimize disk usage and build
time.][cargo/8066]

Misc
----
- [Rustdoc now supports strikethrough text in Markdown.][71928] E.g.
Expand All @@ -97,12 +100,18 @@ Compatibility Notes
- [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were
previously undocumented and not intended for public use. Rustdoc still provides
a non-zero exit code on errors.
- [Rustc's `lto` flag is incompatible with the new `embed-bitcode=no`.][71848]
This may cause issues if LTO is enabled through `RUSTFLAGS` or `cargo rustc`
flags while cargo is adding `embed-bitcode` itself. The recommended way to
control LTO is with Cargo profiles, either in `Cargo.toml` or `.cargo/config`,
or by setting `CARGO_PROFILE_<name>_LTO` in the environment.

Internals Only
--------------
- [Make clippy a git subtree instead of a git submodule][70655]
- [Unify the undo log of all snapshot types][69464]

[71848]: https://github.com/rust-lang/rust/issues/71848/
[73420]: https://github.com/rust-lang/rust/issues/73420/
[72324]: https://github.com/rust-lang/rust/pull/72324/
[71843]: https://github.com/rust-lang/rust/pull/71843/
Expand All @@ -129,6 +138,7 @@ Internals Only
[69813]: https://github.com/rust-lang/rust/pull/69813/
[69464]: https://github.com/rust-lang/rust/pull/69464/
[68717]: https://github.com/rust-lang/rust/pull/68717/
[cargo/8066]: https://github.com/rust-lang/cargo/pull/8066
[`Arc::as_ptr`]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.as_ptr
[`BTreeMap::remove_entry`]: https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html#method.remove_entry
[`Rc::as_ptr`]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.as_ptr
Expand Down
24 changes: 22 additions & 2 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ impl Step for Llvm {
/// Compile LLVM for `target`.
fn run(self, builder: &Builder<'_>) -> PathBuf {
let target = self.target;
let target_native = if self.target.starts_with("riscv") {
// RISC-V target triples in Rust is not named the same as C compiler target triples.
// This converts Rust RISC-V target triples to C compiler triples.
let idx = target.find('-').unwrap();

format!("riscv{}{}", &target[5..7], &target[idx..])
} else {
target.to_string()
};

let Meta { stamp, build_llvm_config, out_dir, root } =
match prebuilt_llvm_config(builder, target) {
Expand Down Expand Up @@ -165,8 +174,8 @@ impl Step for Llvm {
.define("LLVM_ENABLE_BINDINGS", "OFF")
.define("LLVM_ENABLE_Z3_SOLVER", "OFF")
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
.define("LLVM_TARGET_ARCH", target_native.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target_native);

if !target.contains("netbsd") {
cfg.define("LLVM_ENABLE_ZLIB", "ON");
Expand Down Expand Up @@ -213,6 +222,17 @@ impl Step for Llvm {
}
}

if target.starts_with("riscv") {
// In RISC-V, using C++ atomics require linking to `libatomic` but the LLVM build
// system check cannot detect this. Therefore it is set manually here.
if !builder.config.llvm_tools_enabled {
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-latomic");
} else {
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-latomic -static-libstdc++");
}
cfg.define("CMAKE_SHARED_LINKER_FLAGS", "-latomic");
}

if target.contains("msvc") {
cfg.define("LLVM_USE_CRT_DEBUG", "MT");
cfg.define("LLVM_USE_CRT_RELEASE", "MT");
Expand Down
1 change: 1 addition & 0 deletions src/ci/azure-pipelines/auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
dist-powerpc-linux: {}
dist-powerpc64-linux: {}
dist-powerpc64le-linux: {}
dist-riscv64-linux: {}
dist-s390x-linux: {}
dist-x86_64-freebsd: {}
dist-x86_64-illumos: {}
Expand Down
39 changes: 31 additions & 8 deletions src/ci/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ for example:

Images will output artifacts in an `obj` dir at the root of a repository.

To match conditions in rusts CI, also set the environment variable `DEPLOY=1`, e.g.:
```
DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu
```

**NOTE**: Re-using the same `obj` dir with different docker images with
the same target triple (e.g. `dist-x86_64-linux` and `dist-various-1`)
may result in strange linker errors, due shared library versions differing between platforms.
Expand Down Expand Up @@ -85,42 +90,60 @@ how to generate them, and how the existing ones were generated.
### Generating a `.config` file
**NOTE:** Existing Dockerfiles can also be a good guide for the process and order
of script execution.
If you have a `linux-cross` image lying around you can use that and skip the
next two steps.
- First we spin up a container and copy `build_toolchain_root.sh` into it. All
- First we spin up a container and copy all scripts into it. All
these steps are outside the container:
```
# Note: We use ubuntu:15.10 because that's the "base" of linux-cross Docker
# image
$ docker run -it ubuntu:15.10 bash
# Note: We use ubuntu:16.04 because that's the "base" of linux-cross Docker
# image, or simply run ./src/ci/docker/run.sh once, which will download the correct
# one and you can check it out with `docker images`
$ docker run -it ubuntu:16.04 bash
# in another terminal:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cfbec05ed730 ubuntu:15.10 "bash" 16 seconds ago Up 15 seconds drunk_murdock
$ docker cp build_toolchain_root.sh drunk_murdock:/
cfbec05ed730 ubuntu:16.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock
$ docker cp src/ci/docker/scripts drunk_murdock:/tmp/
```
- Then inside the container we build crosstool-ng by simply calling the bash
script we copied in the previous step:
```
$ bash build_toolchain_root.sh
$ cd /tmp/scripts
# Download packages necessary for building
$ bash ./cross-apt-packages.sh
# Download and build crosstool-ng
$ bash ./crosstool-ng.sh
```
- In case you want to adjust or start from an existing config, copy that
to the container. `crosstool-ng` will automatically load `./.config` if
present. Otherwise one can use the TUI to load any config-file.
```
$ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config
```
- Now, inside the container run the following command to configure the
toolchain. To get a clue of which options need to be changed check the next
section and come back.
```
$ cd /tmp/
$ ct-ng menuconfig
```
- Finally, we retrieve the `.config` file from the container and give it a
meaningful name. This is done outside the container.
```
$ docker drunk_murdock:/.config arm-linux-gnueabi.config
$ docker cp drunk_murdock:/tmp/.config arm-linux-gnueabi.config
```
- Now you can shutdown the container or repeat the two last steps to generate a
Expand Down
31 changes: 31 additions & 0 deletions src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:18.04

COPY scripts/cross-apt-packages.sh /scripts/
RUN sh /scripts/cross-apt-packages.sh

COPY host-x86_64/dist-riscv64-linux/crosstool-ng.sh /scripts/
RUN sh /scripts/crosstool-ng.sh

COPY scripts/rustbuild-setup.sh /scripts/
RUN sh /scripts/rustbuild-setup.sh
USER rustbuild
WORKDIR /tmp

COPY host-x86_64/dist-riscv64-linux/build-toolchains.sh host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.config /tmp/
RUN ./build-toolchains.sh

USER root

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV PATH=$PATH:/x-tools/riscv64-unknown-linux-gnu/bin

ENV CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++

ENV HOSTS=riscv64gc-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python3 ../x.py dist --target $HOSTS --host $HOSTS
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ exit 1
set -x
}

mkdir -p /tmp/build-riscv
cp riscv64-unknown-linux-gnu.config /tmp/build-riscv/.config
cd /tmp/build-riscv
mkdir build
cd build
cp ../riscv64-unknown-linux-gnu.config .config
hide_output ct-ng build
cd ..
rm -rf build-riscv
rm -rf build
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash
set -ex

# Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y
CT_CONFIGURE_has_python_3_4_or_newer=y
CT_CONFIGURE_has_bison_2_7_or_newer=y
CT_CONFIGURE_has_python=y
CT_CONFIGURE_has_dtc=y
CT_CONFIGURE_has_svn=y
CT_CONFIGURE_has_git=y
CT_CONFIGURE_has_md5sum=y
CT_CONFIGURE_has_sha1sum=y
Expand Down
16 changes: 0 additions & 16 deletions src/ci/docker/host-x86_64/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends gcc-arm-embedded

COPY scripts/rustbuild-setup.sh host-x86_64/dist-various-1/build-riscv-toolchain.sh host-x86_64/dist-various-1/riscv64-unknown-linux-gnu.config host-x86_64/dist-various-1/crosstool-ng.sh /build/
RUN ./crosstool-ng.sh

# Crosstool-ng will refuse to build as root
RUN sh ./rustbuild-setup.sh
USER rustbuild

RUN ./build-riscv-toolchain.sh

USER root
ENV PATH=/x-tools/riscv64-unknown-linux-gnu/bin:$PATH

COPY host-x86_64/dist-various-1/build-rumprun.sh /build
RUN ./build-rumprun.sh

Expand Down Expand Up @@ -158,7 +146,6 @@ ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64gc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-gnu
ENV TARGETS=$TARGETS,armebv7r-none-eabi
ENV TARGETS=$TARGETS,armebv7r-none-eabihf
ENV TARGETS=$TARGETS,armv7r-none-eabi
Expand Down Expand Up @@ -186,9 +173,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CFLAGS_aarch64_unknown_none_softfloat=-mstrict-align -march=armv8-a+nofp+nosimd \
CC_aarch64_unknown_none=aarch64-none-elf-gcc \
CFLAGS_aarch64_unknown_none=-mstrict-align -march=armv8-a+fp+simd \
CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++ \
CC_riscv32i_unknown_none_elf=false \
CC_riscv32imc_unknown_none_elf=false \
CC_riscv32imac_unknown_none_elf=false \
Expand Down
3 changes: 3 additions & 0 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ jobs:
- name: dist-powerpc64le-linux
<<: *job-linux-xl

- name: dist-riscv64-linux
<<: *job-linux-xl

- name: dist-s390x-linux
<<: *job-linux-xl

Expand Down
1 change: 1 addition & 0 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ mod impls {
pub trait DiscriminantKind {
/// The type of the discriminant, which must satisfy the trait
/// bounds required by `mem::Discriminant`.
#[cfg_attr(not(bootstrap), lang = "discriminant_type")]
type Discriminant: Clone + Copy + Debug + Eq + PartialEq + Hash + Send + Sync + Unpin;
}

Expand Down
1 change: 1 addition & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
/// to allow `x?` (where `x` is an `Option<T>`) to be converted into your error type, you can
/// implement `impl From<NoneError>` for `YourErrorType`. In that case, `x?` within a function that
/// returns `Result<_, YourErrorType>` will translate a `None` value into an `Err` result.
#[rustc_diagnostic_item = "none_error"]
#[unstable(feature = "try_trait", issue = "42327")]
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
pub struct NoneError;
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_error_codes/error_codes/E0715.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ struct OverrideConst;
impl Marker for OverrideConst { // error!
const N: usize = 1;
}
fn main() {}
# fn main() {}
```

Because marker traits are allowed to have multiple implementations for the same
Expand Down
Loading

0 comments on commit e2e29de

Please sign in to comment.