From 4810c4712f9edc4c378142ace1b868fc2fd1eeea Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 13 Feb 2020 09:50:20 -0800 Subject: [PATCH 1/8] Add shared script for linkchecking books. --- src/tools/linkchecker/linkcheck.sh | 113 +++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100755 src/tools/linkchecker/linkcheck.sh diff --git a/src/tools/linkchecker/linkcheck.sh b/src/tools/linkchecker/linkcheck.sh new file mode 100755 index 0000000000000..bbccc17e494c8 --- /dev/null +++ b/src/tools/linkchecker/linkcheck.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# +# This is a script that can be used in each book's CI to validate links using +# the same tool as rust-lang/rust. +# +# This requires the rust-docs rustup component to be installed in the nightly +# toolchain. +# +# Usage: +# ./linkcheck.sh +# +# Options: +# +# -i "Iterative" mode. The script will not clean up after it is done so +# you can inspect the result, and re-run more quickly. +# +# --all Check all books. This can help make sure you don't break links +# from other books into your book. + +set -e + +if [ ! -f book.toml ] && [ ! -f src/SUMMARY.md ] +then + echo "Run command in root directory of the book." + exit 1 +fi + +html_dir="$(rustc +nightly --print sysroot)/share/doc/rust/html" + +if [ ! -d "$html_dir" ] +then + echo "HTML docs are missing from sysroot: $html_dir" + echo "Make sure the nightly rust-docs rustup component is installed." + exit 1 +fi + +book_name="" +# Iterative will avoid cleaning up, so you can quickly run it repeatedly. +iterative=0 +# If "1", test all books, else only this book. +all_books=0 + +while [ "$1" != "" ] +do + case "$1" in + -i) + iterative=1 + ;; + --all) + all_books=1 + ;; + *) + if [ -n "$book_name" ] + then + echo "only one argument allowed" + exit 1 + fi + book_name="$1" + ;; + esac + shift +done + +if [ -z "$book_name" ] +then + echo "usage: $0 " + exit 1 +fi + +if [ ! -d "$html_dir/$book_name" ] +then + echo "book name \"$book_name\" not found in sysroot \"$html_dir\"" + exit 1 +fi + +if [ "$iterative" = "0" ] +then + echo "Cleaning old directories..." + rm -rf linkcheck linkchecker +fi + +if [ ! -e "linkchecker/main.rs" ] || [ "$iterative" = "0" ] +then + echo "Downloading linkchecker source..." + mkdir linkchecker + curl -o linkchecker/Cargo.toml \ + https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/Cargo.toml + curl -o linkchecker/main.rs \ + https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/main.rs +fi + +echo "Building book \"$book_name\"..." +mdbook build + +cp -R "$html_dir" linkcheck +rm -rf "linkcheck/$book_name" +cp -R book "linkcheck/$book_name" + +if [ "$all_books" = "1" ] +then + check_path="linkcheck" +else + check_path="linkcheck/$book_name" +fi +echo "Running linkchecker on \"$check_path\"..." +cargo run --manifest-path=linkchecker/Cargo.toml -- "$check_path" + +if [ "$iterative" = "0" ] +then + rm -rf linkcheck linkchecker +fi + +echo "Link check completed successfully!" From 79c166ef73df00eac96aaeadcb326c972c22068c Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 5 Feb 2020 15:47:01 +0100 Subject: [PATCH 2/8] ci: switch macOS builders to 10.15 --- src/bootstrap/test.rs | 4 ++-- src/ci/azure-pipelines/auto.yml | 2 +- src/ci/azure-pipelines/steps/run.yml | 4 ---- src/ci/azure-pipelines/try.yml | 2 +- src/ci/scripts/install-clang.sh | 4 +--- src/ci/scripts/switch-xcode.sh | 13 ------------- 6 files changed, 5 insertions(+), 24 deletions(-) delete mode 100755 src/ci/scripts/switch-xcode.sh diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 43561fa4f2fc1..3d6d4065fe80c 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1051,10 +1051,10 @@ impl Step for Compiletest { cmd.arg("--docck-python").arg(builder.python()); if builder.config.build.ends_with("apple-darwin") { - // Force /usr/bin/python on macOS for LLDB tests because we're loading the + // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the // LLDB plugin's compiled module which only works with the system python // (namely not Homebrew-installed python) - cmd.arg("--lldb-python").arg("/usr/bin/python"); + cmd.arg("--lldb-python").arg("/usr/bin/python3"); } else { cmd.arg("--lldb-python").arg(builder.python()); } diff --git a/src/ci/azure-pipelines/auto.yml b/src/ci/azure-pipelines/auto.yml index 79a49fc48be72..74b7469ea27b7 100644 --- a/src/ci/azure-pipelines/auto.yml +++ b/src/ci/azure-pipelines/auto.yml @@ -63,7 +63,7 @@ jobs: - job: macOS timeoutInMinutes: 600 pool: - vmImage: macos-10.13 + vmImage: macos-10.15 steps: - template: steps/run.yml strategy: diff --git a/src/ci/azure-pipelines/steps/run.yml b/src/ci/azure-pipelines/steps/run.yml index f536388b25b96..1532608f0c020 100644 --- a/src/ci/azure-pipelines/steps/run.yml +++ b/src/ci/azure-pipelines/steps/run.yml @@ -48,10 +48,6 @@ steps: displayName: Install clang condition: and(succeeded(), not(variables.SKIP_JOB)) -- bash: src/ci/scripts/switch-xcode.sh - displayName: Switch to Xcode 9.3 - condition: and(succeeded(), not(variables.SKIP_JOB)) - - bash: src/ci/scripts/install-wix.sh displayName: Install wix condition: and(succeeded(), not(variables.SKIP_JOB)) diff --git a/src/ci/azure-pipelines/try.yml b/src/ci/azure-pipelines/try.yml index b6177b2cc9b25..f8ddf0eb46cfd 100644 --- a/src/ci/azure-pipelines/try.yml +++ b/src/ci/azure-pipelines/try.yml @@ -25,7 +25,7 @@ jobs: # - job: macOS # timeoutInMinutes: 600 # pool: -# vmImage: macos-10.13 +# vmImage: macos-10.15 # steps: # - template: steps/run.yml # strategy: diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh index e16a4814197b3..c242f5d456269 100755 --- a/src/ci/scripts/install-clang.sh +++ b/src/ci/scripts/install-clang.sh @@ -19,9 +19,7 @@ if isMacOS; then # native clang is configured to use the correct path, but our custom one # doesn't. This sets the SDKROOT environment variable to the SDK so that # our own clang can figure out the correct include path on its own. - if ! [[ -d "/usr/include" ]]; then - ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)" - fi + ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)" # Configure `AR` specifically so rustbuild doesn't try to infer it as # `clang-ar` by accident. diff --git a/src/ci/scripts/switch-xcode.sh b/src/ci/scripts/switch-xcode.sh deleted file mode 100755 index 2cbb2ddbc7046..0000000000000 --- a/src/ci/scripts/switch-xcode.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Switch to XCode 9.3 on OSX since it seems to be the last version that supports -# i686-apple-darwin. We'll eventually want to upgrade this and it will probably -# force us to drop i686-apple-darwin, but let's keep the wheels turning for now. - -set -euo pipefail -IFS=$'\n\t' - -source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" - -if isMacOS; then - sudo xcode-select --switch /Applications/Xcode_9.3.app -fi From c9b87ac4b306cf43ca6e46defb91267fe257e45b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 17 Feb 2020 21:44:32 +0100 Subject: [PATCH 3/8] Don't eliminate frame pointers on thumb targets --- src/librustc_target/spec/thumb_base.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc_target/spec/thumb_base.rs b/src/librustc_target/spec/thumb_base.rs index 204f4723b70ba..6ab6fcb58bdda 100644 --- a/src/librustc_target/spec/thumb_base.rs +++ b/src/librustc_target/spec/thumb_base.rs @@ -50,6 +50,9 @@ pub fn opts() -> TargetOptions { // until we figure a way to add the pretty printers without requiring a volatile load cf. // rust-lang/rust#44993. emit_debug_gdb_scripts: false, + // LLVM is eager to trash the link register when calling `nounwind` functions, which + // breaks debugging. Preserve LR by default to prevent that from happening. + eliminate_frame_pointer: false, ..Default::default() } } From 27cfb2b9c2baacc7110cd73a96d0989b73e2a597 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 18 Feb 2020 00:00:06 +0100 Subject: [PATCH 4/8] Fix typo --- src/librustc_target/spec/thumb_base.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_target/spec/thumb_base.rs b/src/librustc_target/spec/thumb_base.rs index 6ab6fcb58bdda..99ab996be959d 100644 --- a/src/librustc_target/spec/thumb_base.rs +++ b/src/librustc_target/spec/thumb_base.rs @@ -50,7 +50,7 @@ pub fn opts() -> TargetOptions { // until we figure a way to add the pretty printers without requiring a volatile load cf. // rust-lang/rust#44993. emit_debug_gdb_scripts: false, - // LLVM is eager to trash the link register when calling `nounwind` functions, which + // LLVM is eager to trash the link register when calling `noreturn` functions, which // breaks debugging. Preserve LR by default to prevent that from happening. eliminate_frame_pointer: false, ..Default::default() From d194676667f256e08dfb9fbc536d53d92bf8910f Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Tue, 18 Feb 2020 21:28:56 -0800 Subject: [PATCH 5/8] Remove special case for `simd_shuffle` arg promotion After rust-lang/stdarch#825, these intrinsics are now defined with `#[rustc_args_required_const(2)]`, so the special-case is no longer necessary. --- src/librustc_mir/transform/promote_consts.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index a5d59860c3d16..9db9ab0de0b7f 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -24,7 +24,6 @@ use rustc_span::{Span, DUMMY_SP}; use syntax::ast::LitKind; use rustc_index::vec::{Idx, IndexVec}; -use rustc_target::spec::abi::Abi; use std::cell::Cell; use std::{cmp, iter, mem, usize}; @@ -218,17 +217,6 @@ impl<'tcx> Visitor<'tcx> for Collector<'_, 'tcx> { if let TerminatorKind::Call { ref func, .. } = *kind { if let ty::FnDef(def_id, _) = func.ty(self.body, self.tcx).kind { - let fn_sig = self.tcx.fn_sig(def_id); - if let Abi::RustIntrinsic | Abi::PlatformIntrinsic = fn_sig.abi() { - let name = self.tcx.item_name(def_id); - // FIXME(eddyb) use `#[rustc_args_required_const(2)]` for shuffles. - if name.as_str().starts_with("simd_shuffle") { - self.candidates.push(Candidate::Argument { bb: location.block, index: 2 }); - - return; // Don't double count `simd_shuffle` candidates - } - } - if let Some(constant_args) = args_required_const(self.tcx, def_id) { for index in constant_args { self.candidates.push(Candidate::Argument { bb: location.block, index }); From f581b559a3c9f0c33df09312678dad836334ae22 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Tue, 18 Feb 2020 21:32:38 -0800 Subject: [PATCH 6/8] Remove mention of `simd_shuffle` promotion from comments --- src/librustc_mir/const_eval/eval_queries.rs | 4 ++-- src/librustc_mir/transform/promote_consts.rs | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index 4d5464f774ff5..1cec5d30e9b9b 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -72,8 +72,8 @@ fn eval_body_using_ecx<'mir, 'tcx>( Ok(ret) } -/// The `InterpCx` is only meant to be used to do field and index projections into constants for -/// `simd_shuffle` and const patterns in match arms. +/// The `InterpCx` is only meant to be used to do field and index projections into promoteds +/// and const patterns in match arms. /// /// The function containing the `match` that is currently being analyzed may have generic bounds /// that inform us about the generic bounds of the constant. E.g., using an associated constant diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 9db9ab0de0b7f..a11ee57f46529 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -105,11 +105,10 @@ pub enum Candidate { /// Promotion of the `x` in `[x; 32]`. Repeat(Location), - /// Currently applied to function calls where the callee has the unstable - /// `#[rustc_args_required_const]` attribute as well as the SIMD shuffle - /// intrinsic. The intrinsic requires the arguments are indeed constant and - /// the attribute currently provides the semantic requirement that arguments - /// must be constant. + /// Function calls where the callee has the unstable + /// `#[rustc_args_required_const]` attribute. The attribute requires that + /// the arguments be constant, usually because they are encoded as an + /// immediate operand in a platform intrinsic. Argument { bb: BasicBlock, index: usize }, } @@ -718,8 +717,7 @@ pub fn validate_candidates( .filter(|&candidate| { validator.explicit = candidate.forces_explicit_promotion(); - // FIXME(eddyb) also emit the errors for shuffle indices - // and `#[rustc_args_required_const]` arguments here. + // FIXME(eddyb) also emit the errors for `#[rustc_args_required_const]` arguments here. let is_promotable = validator.validate_candidate(candidate).is_ok(); match candidate { From b43dc806ae3d5fd11ff0bdea288cf16f4b1e4c13 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Tue, 18 Feb 2020 23:17:21 -0800 Subject: [PATCH 7/8] Add `#[rustc_args_required_const]` to `simd_shuffle` tests --- src/test/incremental/issue-61530.rs | 3 +- src/test/ui/issues/issue-38074.rs | 3 +- .../simd-intrinsic-generic-elements.rs | 4 +++ .../simd-intrinsic-generic-elements.stderr | 30 +++++++++---------- .../simd-intrinsic-inlining-issue67557-ice.rs | 3 +- .../simd-intrinsic-inlining-issue67557.rs | 3 +- .../simd/simd-intrinsic-generic-elements.rs | 6 +++- 7 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/test/incremental/issue-61530.rs b/src/test/incremental/issue-61530.rs index 06b2957ac62c9..c9c600efed890 100644 --- a/src/test/incremental/issue-61530.rs +++ b/src/test/incremental/issue-61530.rs @@ -1,4 +1,4 @@ -#![feature(repr_simd, platform_intrinsics)] +#![feature(repr_simd, platform_intrinsics, rustc_attrs)] // revisions:rpass1 rpass2 @@ -6,6 +6,7 @@ struct I32x2(i32, i32); extern "platform-intrinsic" { + #[rustc_args_required_const(2)] fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; } diff --git a/src/test/ui/issues/issue-38074.rs b/src/test/ui/issues/issue-38074.rs index 214d6752cef1d..8f7905b31ecde 100644 --- a/src/test/ui/issues/issue-38074.rs +++ b/src/test/ui/issues/issue-38074.rs @@ -1,9 +1,10 @@ // run-pass // ignore-emscripten FIXME(#45351) -#![feature(platform_intrinsics, repr_simd)] +#![feature(platform_intrinsics, repr_simd, rustc_attrs)] extern "platform-intrinsic" { + #[rustc_args_required_const(2)] fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; } diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs index 5929d05f4de31..c9c9ab879f27e 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs @@ -42,9 +42,13 @@ extern "platform-intrinsic" { fn simd_insert(x: T, idx: u32, y: E) -> T; fn simd_extract(x: T, idx: u32) -> E; + #[rustc_args_required_const(2)] fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; + #[rustc_args_required_const(2)] fn simd_shuffle3(x: T, y: T, idx: [u32; 3]) -> U; + #[rustc_args_required_const(2)] fn simd_shuffle4(x: T, y: T, idx: [u32; 4]) -> U; + #[rustc_args_required_const(2)] fn simd_shuffle8(x: T, y: T, idx: [u32; 8]) -> U; } diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr index 78022c0c8bd98..29916f85902b2 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr @@ -1,89 +1,89 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:55:9 + --> $DIR/simd-intrinsic-generic-elements.rs:59:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/simd-intrinsic-generic-elements.rs:57:9 + --> $DIR/simd-intrinsic-generic-elements.rs:61:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:59:9 + --> $DIR/simd-intrinsic-generic-elements.rs:63:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:62:9 + --> $DIR/simd-intrinsic-generic-elements.rs:66:9 | LL | simd_shuffle2::(0, 0, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:64:9 + --> $DIR/simd-intrinsic-generic-elements.rs:68:9 | LL | simd_shuffle3::(0, 0, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:66:9 + --> $DIR/simd-intrinsic-generic-elements.rs:70:9 | LL | simd_shuffle4::(0, 0, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:68:9 + --> $DIR/simd-intrinsic-generic-elements.rs:72:9 | LL | simd_shuffle8::(0, 0, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:71:9 + --> $DIR/simd-intrinsic-generic-elements.rs:75:9 | LL | simd_shuffle2::<_, f32x2>(x, x, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x3` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:73:9 + --> $DIR/simd-intrinsic-generic-elements.rs:77:9 | LL | simd_shuffle3::<_, f32x3>(x, x, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:75:9 + --> $DIR/simd-intrinsic-generic-elements.rs:79:9 | LL | simd_shuffle4::<_, f32x4>(x, x, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:77:9 + --> $DIR/simd-intrinsic-generic-elements.rs:81:9 | LL | simd_shuffle8::<_, f32x8>(x, x, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/simd-intrinsic-generic-elements.rs:80:9 + --> $DIR/simd-intrinsic-generic-elements.rs:84:9 | LL | simd_shuffle2::<_, i32x8>(x, x, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return type of length 3, found `i32x4` with length 4 - --> $DIR/simd-intrinsic-generic-elements.rs:82:9 + --> $DIR/simd-intrinsic-generic-elements.rs:86:9 | LL | simd_shuffle3::<_, i32x4>(x, x, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x3` with length 3 - --> $DIR/simd-intrinsic-generic-elements.rs:84:9 + --> $DIR/simd-intrinsic-generic-elements.rs:88:9 | LL | simd_shuffle4::<_, i32x3>(x, x, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/simd-intrinsic-generic-elements.rs:86:9 + --> $DIR/simd-intrinsic-generic-elements.rs:90:9 | LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs index 4c09ae25c5f3e..b03b0ef50895b 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557-ice.rs @@ -3,9 +3,10 @@ // // run-pass // compile-flags: -Zmir-opt-level=3 -#![feature(platform_intrinsics, repr_simd)] +#![feature(platform_intrinsics, repr_simd, rustc_attrs)] extern "platform-intrinsic" { + #[rustc_args_required_const(2)] fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; } diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs index 7a0d955686bb6..2741dc1333696 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-inlining-issue67557.rs @@ -3,9 +3,10 @@ // // run-pass // compile-flags: -Zmir-opt-level=3 -#![feature(platform_intrinsics, repr_simd)] +#![feature(platform_intrinsics, repr_simd, rustc_attrs)] extern "platform-intrinsic" { + #[rustc_args_required_const(2)] fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; } diff --git a/src/test/ui/simd/simd-intrinsic-generic-elements.rs b/src/test/ui/simd/simd-intrinsic-generic-elements.rs index ea3d4b1894416..abff59fea78e5 100644 --- a/src/test/ui/simd/simd-intrinsic-generic-elements.rs +++ b/src/test/ui/simd/simd-intrinsic-generic-elements.rs @@ -1,7 +1,7 @@ // run-pass // ignore-emscripten FIXME(#45351) hits an LLVM assert -#![feature(repr_simd, platform_intrinsics)] +#![feature(repr_simd, platform_intrinsics, rustc_attrs)] #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] @@ -25,9 +25,13 @@ extern "platform-intrinsic" { fn simd_insert(x: T, idx: u32, y: E) -> T; fn simd_extract(x: T, idx: u32) -> E; + #[rustc_args_required_const(2)] fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; + #[rustc_args_required_const(2)] fn simd_shuffle3(x: T, y: T, idx: [u32; 3]) -> U; + #[rustc_args_required_const(2)] fn simd_shuffle4(x: T, y: T, idx: [u32; 4]) -> U; + #[rustc_args_required_const(2)] fn simd_shuffle8(x: T, y: T, idx: [u32; 8]) -> U; } From c899dc14011a67b127bf59622cb13b7ff4a11e9a Mon Sep 17 00:00:00 2001 From: jumbatm Date: Wed, 19 Feb 2020 19:57:32 +1000 Subject: [PATCH 8/8] Reword OpenOptions::{create, create_new} doc. --- src/libstd/fs.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index cff7bbe5ef183..09be3f1305052 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -844,10 +844,7 @@ impl OpenOptions { self } - /// Sets the option for creating a new file. - /// - /// This option indicates whether a new file will be created if the file - /// does not yet already exist. + /// Sets the option to create a new file, or open it if it already exists. /// /// In order for the file to be created, [`write`] or [`append`] access must /// be used. @@ -868,11 +865,10 @@ impl OpenOptions { self } - /// Sets the option to always create a new file. + /// Sets the option to create a new file, failing if it already exists. /// - /// This option indicates whether a new file will be created. - /// No file is allowed to exist at the target location, also no (dangling) - /// symlink. + /// No file is allowed to exist at the target location, also no (dangling) symlink. In this + /// way, if the call succeeds, the file returned is guaranteed to be new. /// /// This option is useful because it is atomic. Otherwise between checking /// whether a file exists and creating a new one, the file may have been