From ee89c088b057affb5bdb96195e107a218b64b1c5 Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Tue, 27 Nov 2018 02:59:49 +0000 Subject: Various minor/cosmetic improvements to code --- src/test/codegen/external-no-mangle-fns.rs | 2 +- src/test/codegen/external-no-mangle-statics.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test/codegen') diff --git a/src/test/codegen/external-no-mangle-fns.rs b/src/test/codegen/external-no-mangle-fns.rs index 58232852596..e6b952ec9f6 100644 --- a/src/test/codegen/external-no-mangle-fns.rs +++ b/src/test/codegen/external-no-mangle-fns.rs @@ -9,7 +9,7 @@ // except according to those terms. // compile-flags: -C no-prepopulate-passes -// `#[no_mangle]`d functions always have external linkage, i.e. no `internal` in their `define`s +// `#[no_mangle]`d functions always have external linkage, i.e., no `internal` in their `define`s #![crate_type = "lib"] #![no_std] diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs index 59d829633e5..b1488e3b8d0 100644 --- a/src/test/codegen/external-no-mangle-statics.rs +++ b/src/test/codegen/external-no-mangle-statics.rs @@ -9,7 +9,7 @@ // except according to those terms. // compile-flags: -O -// `#[no_mangle]`d static variables always have external linkage, i.e. no `internal` in their +// `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their // definitions #![crate_type = "lib"] -- cgit 1.4.1-3-g733a5 From 706e67b0a0143d651eb03f2fa2c30645899e81ff Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 9 Dec 2018 11:20:20 +0100 Subject: Bump minimum required LLVM version to 6.0 --- .travis.yml | 2 +- src/bootstrap/native.rs | 4 ++-- src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile | 27 ---------------------- src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile | 27 ++++++++++++++++++++++ src/librustc_codegen_llvm/builder.rs | 10 ++------ src/librustc_codegen_llvm/llvm/ffi.rs | 4 ++-- src/rustllvm/ArchiveWrapper.cpp | 7 +----- src/rustllvm/PassWrapper.cpp | 18 ++------------- src/rustllvm/RustWrapper.cpp | 15 ------------ src/test/codegen/function-arguments.rs | 1 - src/test/codegen/issue-44056-macos-tls-align.rs | 1 - src/test/codegen/issue-45222.rs | 1 - src/test/codegen/issue-45466.rs | 1 - src/test/codegen/simd-intrinsic-generic-gather.rs | 1 - src/test/codegen/simd-intrinsic-generic-scatter.rs | 1 - src/test/codegen/vtabletype.rs | 1 - .../run-pass/simd/simd-intrinsic-generic-gather.rs | 1 - src/test/run-pass/sse2.rs | 4 +--- src/test/ui/target-feature-gate.rs | 1 - src/test/ui/target-feature-gate.stderr | 2 +- 20 files changed, 39 insertions(+), 90 deletions(-) delete mode 100644 src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile create mode 100644 src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile (limited to 'src/test/codegen') diff --git a/.travis.yml b/.travis.yml index 3f2e43ab86d..9e46e6b8ef6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: fast_finish: true include: # Images used in testing PR and try-build should be run first. - - env: IMAGE=x86_64-gnu-llvm-5.0 RUST_BACKTRACE=1 + - env: IMAGE=x86_64-gnu-llvm-6.0 RUST_BACKTRACE=1 if: type = pull_request OR branch = auto - env: IMAGE=dist-x86_64-linux DEPLOY=1 diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 8ff175b0187..15851161486 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -278,11 +278,11 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) { let mut parts = version.split('.').take(2) .filter_map(|s| s.parse::().ok()); if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) { - if major >= 5 { + if major >= 6 { return } } - panic!("\n\nbad LLVM version: {}, need >=5.0\n\n", version) + panic!("\n\nbad LLVM version: {}, need >=6.0\n\n", version) } fn configure_cmake(builder: &Builder, diff --git a/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile deleted file mode 100644 index 4f90c509726..00000000000 --- a/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - g++ \ - make \ - file \ - curl \ - ca-certificates \ - python2.7 \ - git \ - cmake \ - sudo \ - gdb \ - llvm-5.0-tools \ - libedit-dev \ - zlib1g-dev \ - xz-utils - -COPY scripts/sccache.sh /scripts/ -RUN sh /scripts/sccache.sh - -# using llvm-link-shared due to libffi issues -- see #34486 -ENV RUST_CONFIGURE_ARGS \ - --build=x86_64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-5.0 \ - --enable-llvm-link-shared -ENV RUST_CHECK_TARGET check diff --git a/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile new file mode 100644 index 00000000000..160b23e0b00 --- /dev/null +++ b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu:16.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + g++ \ + make \ + file \ + curl \ + ca-certificates \ + python2.7 \ + git \ + cmake \ + sudo \ + gdb \ + llvm-6.0-tools \ + libedit-dev \ + zlib1g-dev \ + xz-utils + +COPY scripts/sccache.sh /scripts/ +RUN sh /scripts/sccache.sh + +# using llvm-link-shared due to libffi issues -- see #34486 +ENV RUST_CONFIGURE_ARGS \ + --build=x86_64-unknown-linux-gnu \ + --llvm-root=/usr/lib/llvm-6.0 \ + --enable-llvm-link-shared +ENV RUST_CHECK_TARGET check diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index a95ddefc869..01b1387d9cc 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -1024,17 +1024,11 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn minnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value { self.count_insn("minnum"); - unsafe { - let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs); - instr.expect("LLVMRustBuildMinNum is not available in LLVM version < 6.0") - } + unsafe { llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs) } } fn maxnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value { self.count_insn("maxnum"); - unsafe { - let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs); - instr.expect("LLVMRustBuildMaxNum is not available in LLVM version < 6.0") - } + unsafe { llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs) } } fn select( diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 127759a4326..4732db88ec1 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -1222,12 +1222,12 @@ extern "C" { B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value, - ) -> Option<&'a Value>; + ) -> &'a Value; pub fn LLVMRustBuildMaxNum( B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value, - ) -> Option<&'a Value>; + ) -> &'a Value; // Atomic Operations pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>, diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp index 1355c0377ce..2f8dc0d466f 100644 --- a/src/rustllvm/ArchiveWrapper.cpp +++ b/src/rustllvm/ArchiveWrapper.cpp @@ -216,16 +216,11 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers, Members.push_back(std::move(*MOrErr)); } } + auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false); -#if LLVM_VERSION_GE(6, 0) if (!Result) return LLVMRustResult::Success; LLVMRustSetLastError(toString(std::move(Result)).c_str()); -#else - if (!Result.second) - return LLVMRustResult::Success; - LLVMRustSetLastError(Result.second.message().c_str()); -#endif return LLVMRustResult::Failure; } diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index aa420bf6100..4d95368c00f 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -17,21 +17,15 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/AutoUpgrade.h" #include "llvm/IR/AssemblyAnnotationWriter.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" - -#if LLVM_VERSION_GE(6, 0) -#include "llvm/CodeGen/TargetSubtargetInfo.h" -#include "llvm/IR/IntrinsicInst.h" -#else -#include "llvm/Target/TargetSubtargetInfo.h" -#endif - #include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/FunctionImport.h" #include "llvm/Transforms/Utils/FunctionImportUtils.h" @@ -198,13 +192,9 @@ GEN_SUBTARGETS extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *Feature) { -#if LLVM_VERSION_GE(6, 0) TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); return MCInfo->checkFeatures(std::string("+") + Feature); -#else - return false; -#endif } enum class LLVMRustCodeModel { @@ -392,13 +382,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.ThreadModel = ThreadModel::Single; } -#if LLVM_VERSION_GE(6, 0) Options.EmitStackSizeSection = EmitStackSizeSection; Optional CM; -#else - CodeModel::Model CM = CodeModel::Model::Default; -#endif if (RustCM != LLVMRustCodeModel::None) CM = fromRust(RustCM); TargetMachine *TM = TheTarget->createTargetMachine( diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index b9a0b435d3e..86c5dfcfb98 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -297,11 +297,7 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn, // enable fpmath flag UnsafeAlgebra extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) { if (auto I = dyn_cast(unwrap(V))) { -#if LLVM_VERSION_GE(6, 0) I->setFast(true); -#else - I->setHasUnsafeAlgebra(true); -#endif } } @@ -1437,7 +1433,6 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) { return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN)); } -#if LLVM_VERSION_GE(6, 0) extern "C" LLVMValueRef LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS))); @@ -1446,13 +1441,3 @@ extern "C" LLVMValueRef LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS))); } -#else -extern "C" LLVMValueRef -LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -#endif diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index 5061d9a915e..52bdb1b103a 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -10,7 +10,6 @@ // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength -// min-llvm-version 6.0 #![crate_type = "lib"] #![feature(custom_attribute)] diff --git a/src/test/codegen/issue-44056-macos-tls-align.rs b/src/test/codegen/issue-44056-macos-tls-align.rs index b146e106aa1..ebd436cc647 100644 --- a/src/test/codegen/issue-44056-macos-tls-align.rs +++ b/src/test/codegen/issue-44056-macos-tls-align.rs @@ -11,7 +11,6 @@ // ignore-tidy-linelength // only-macos // no-system-llvm -// min-llvm-version 6.0 // compile-flags: -O #![crate_type = "rlib"] diff --git a/src/test/codegen/issue-45222.rs b/src/test/codegen/issue-45222.rs index 3544786e2e6..a6e633bf285 100644 --- a/src/test/codegen/issue-45222.rs +++ b/src/test/codegen/issue-45222.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -O -// min-llvm-version 6.0 #![crate_type = "lib"] diff --git a/src/test/codegen/issue-45466.rs b/src/test/codegen/issue-45466.rs index 14954763944..f916c1a0640 100644 --- a/src/test/codegen/issue-45466.rs +++ b/src/test/codegen/issue-45466.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -O -// min-llvm-version 6.0 #![crate_type="rlib"] diff --git a/src/test/codegen/simd-intrinsic-generic-gather.rs b/src/test/codegen/simd-intrinsic-generic-gather.rs index 6c47bf3e321..605a952e8ff 100644 --- a/src/test/codegen/simd-intrinsic-generic-gather.rs +++ b/src/test/codegen/simd-intrinsic-generic-gather.rs @@ -10,7 +10,6 @@ // ignore-emscripten // ignore-tidy-linelength -// min-llvm-version 6.0 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-generic-scatter.rs b/src/test/codegen/simd-intrinsic-generic-scatter.rs index 7b5b2e55e29..6645778468c 100644 --- a/src/test/codegen/simd-intrinsic-generic-scatter.rs +++ b/src/test/codegen/simd-intrinsic-generic-scatter.rs @@ -10,7 +10,6 @@ // ignore-emscripten // ignore-tidy-linelength -// min-llvm-version 6.0 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/vtabletype.rs b/src/test/codegen/vtabletype.rs index abd1eb3e2cc..cb96a844341 100644 --- a/src/test/codegen/vtabletype.rs +++ b/src/test/codegen/vtabletype.rs @@ -14,7 +14,6 @@ // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 6.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs index 5f6a72a8e1e..e5ac5775b0c 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs @@ -10,7 +10,6 @@ // run-pass // ignore-emscripten -// min-llvm-version 6.0 // Test that the simd_{gather,scatter} intrinsics produce the correct results. diff --git a/src/test/run-pass/sse2.rs b/src/test/run-pass/sse2.rs index 041286fe656..779c72b8df1 100644 --- a/src/test/run-pass/sse2.rs +++ b/src/test/run-pass/sse2.rs @@ -8,11 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(stable_features)] -// min-llvm-version 6.0 -// ^ needs MCSubtargetInfo::checkFeatures() // ignore-cloudabi no std::env +#![allow(stable_features)] #![feature(cfg_target_feature)] use std::env; diff --git a/src/test/ui/target-feature-gate.rs b/src/test/ui/target-feature-gate.rs index 8a045884cae..2d0fb78897d 100644 --- a/src/test/ui/target-feature-gate.rs +++ b/src/test/ui/target-feature-gate.rs @@ -24,7 +24,6 @@ // gate-test-mips_target_feature // gate-test-mmx_target_feature // gate-test-wasm_target_feature -// min-llvm-version 6.0 #[target_feature(enable = "avx512bw")] //~^ ERROR: currently unstable diff --git a/src/test/ui/target-feature-gate.stderr b/src/test/ui/target-feature-gate.stderr index f18bebc0c29..24141d0064f 100644 --- a/src/test/ui/target-feature-gate.stderr +++ b/src/test/ui/target-feature-gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839) - --> $DIR/target-feature-gate.rs:29:18 + --> $DIR/target-feature-gate.rs:28:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ -- cgit 1.4.1-3-g733a5 From 1091eee65b91a9968f2a0b2f0c7d6e8e27d8d033 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 15 Nov 2018 06:17:58 -0800 Subject: rustc: Switch `extern` functions to abort by default on panic This was intended to land way back in 1.24, but it was backed out due to breakage which has long since been fixed. An unstable `#[unwind]` attribute can be used to tweak the behavior here, but this is currently simply switching rustc's internal default to abort-by-default if an `extern` function panics, making our codegen sound primarily (as currently you can produce UB with safe code) Closes #52652 --- src/librustc_codegen_llvm/attributes.rs | 57 +++++++++++++++++----------- src/librustc_codegen_llvm/callee.rs | 2 +- src/librustc_codegen_llvm/context.rs | 1 - src/librustc_codegen_llvm/declare.rs | 11 +----- src/librustc_codegen_llvm/intrinsic.rs | 2 +- src/librustc_codegen_llvm/mono_item.rs | 7 +++- src/librustc_mir/build/mod.rs | 7 +--- src/test/codegen/nounwind-extern.rs | 16 ++++++++ src/test/run-pass/abort-on-c-abi.rs | 3 -- src/test/run-pass/extern/extern-call-deep.rs | 1 + 10 files changed, 61 insertions(+), 46 deletions(-) create mode 100644 src/test/codegen/nounwind-extern.rs (limited to 'src/test/codegen') diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index ffe5e123f9b..30edc4744ec 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -15,7 +15,7 @@ use rustc::hir::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::session::Session; use rustc::session::config::Sanitizer; -use rustc::ty::TyCtxt; +use rustc::ty::{self, TyCtxt, PolyFnSig}; use rustc::ty::layout::HasTyCtxt; use rustc::ty::query::Providers; use rustc_data_structures::sync::Lrc; @@ -23,6 +23,7 @@ use rustc_data_structures::fx::FxHashMap; use rustc_target::spec::PanicStrategy; use rustc_codegen_ssa::traits::*; +use abi::Abi; use attributes; use llvm::{self, Attribute}; use llvm::AttributePlace::Function; @@ -60,7 +61,7 @@ pub fn emit_uwtable(val: &'ll Value, emit: bool) { /// Tell LLVM whether the function can or cannot unwind. #[inline] -pub fn unwind(val: &'ll Value, can_unwind: bool) { +fn unwind(val: &'ll Value, can_unwind: bool) { Attribute::NoUnwind.toggle_llfn(Function, val, !can_unwind); } @@ -150,9 +151,10 @@ pub fn non_lazy_bind(sess: &Session, llfn: &'ll Value) { /// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`) /// attributes. pub fn from_fn_attrs( - cx: &CodegenCx<'ll, '_>, + cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, id: Option, + sig: PolyFnSig<'tcx>, ) { let codegen_fn_attrs = id.map(|id| cx.tcx.codegen_fn_attrs(id)) .unwrap_or_else(|| CodegenFnAttrs::new()); @@ -194,28 +196,37 @@ pub fn from_fn_attrs( llvm::AttributePlace::ReturnValue, llfn); } - let can_unwind = if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::UNWIND) { - Some(true) + unwind(llfn, if cx.tcx.sess.panic_strategy() != PanicStrategy::Unwind { + // In panic=abort mode we assume nothing can unwind anywhere, so + // optimize based on this! + false + } else if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::UNWIND) { + // If a specific #[unwind] attribute is present, use that + true } else if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND) { - Some(false) - - // Perhaps questionable, but we assume that anything defined - // *in Rust code* may unwind. Foreign items like `extern "C" { - // fn foo(); }` are assumed not to unwind **unless** they have - // a `#[unwind]` attribute. - } else if id.map(|id| !cx.tcx.is_foreign_item(id)).unwrap_or(false) { - Some(true) - } else { - None - }; - - match can_unwind { - Some(false) => attributes::unwind(llfn, false), - Some(true) if cx.tcx.sess.panic_strategy() == PanicStrategy::Unwind => { - attributes::unwind(llfn, true); + // Special attribute for allocator functions, which can't unwind + false + } else if let Some(id) = id { + let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig); + if cx.tcx.is_foreign_item(id) { + // Foreign items like `extern "C" { fn foo(); }` are assumed not to + // unwind + false + } else if sig.abi != Abi::Rust && sig.abi != Abi::RustCall { + // Any items defined in Rust that *don't* have the `extern` ABI are + // defined to not unwind. We insert shims to abort if an unwind + // happens to enforce this. + false + } else { + // Anything else defined in Rust is assumed that it can possibly + // unwind + true } - Some(true) | None => {} - } + } else { + // assume this can possibly unwind, avoiding the application of a + // `nounwind` attribute below. + true + }); // Always annotate functions with the target-cpu they are compiled for. // Without this, ThinLTO won't inline Rust functions into Clang generated diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs index f13eeb6692c..87185a20c50 100644 --- a/src/librustc_codegen_llvm/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -94,7 +94,7 @@ pub fn get_fn( if instance.def.is_inline(tcx) { attributes::inline(cx, llfn, attributes::InlineAttr::Hint); } - attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id())); + attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id()), sig); let instance_def_id = instance.def_id(); diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 6c90937de3f..0bd6146f5aa 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -409,7 +409,6 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { )); let llfn = self.declare_fn("rust_eh_unwind_resume", sig); - attributes::unwind(llfn, true); attributes::apply_target_cpu_attr(self, llfn); unwresume.set(Some(llfn)); llfn diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs index c23aab409a9..2964f2e5847 100644 --- a/src/librustc_codegen_llvm/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -26,8 +26,7 @@ use rustc::ty::{self, PolyFnSig}; use rustc::ty::layout::LayoutOf; use rustc::session::config::Sanitizer; use rustc_data_structures::small_c_str::SmallCStr; -use rustc_target::spec::PanicStrategy; -use abi::{Abi, FnType, FnTypeExt}; +use abi::{FnType, FnTypeExt}; use attributes; use context::CodegenCx; use type_::Type; @@ -86,10 +85,6 @@ fn declare_raw_fn( _ => {}, } - if cx.tcx.sess.panic_strategy() != PanicStrategy::Unwind { - attributes::unwind(llfn, false); - } - attributes::non_lazy_bind(cx.sess(), llfn); llfn @@ -132,10 +127,6 @@ impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx> { llvm::Attribute::NoReturn.apply_llfn(Function, llfn); } - if sig.abi != Abi::Rust && sig.abi != Abi::RustCall { - attributes::unwind(llfn, false); - } - fty.apply_attrs_llfn(llfn); llfn diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 59608b11939..2b82ebe0bc2 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1081,7 +1081,7 @@ fn gen_fn<'ll, 'tcx>( Abi::Rust )); let llfn = cx.define_internal_fn(name, rust_fn_sig); - attributes::from_fn_attrs(cx, llfn, None); + attributes::from_fn_attrs(cx, llfn, None, rust_fn_sig); let bx = Builder::new_block(cx, llfn, "entry-block"); codegen(bx); llfn diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs index 1d5bcc4ba39..9c69d7d8cf4 100644 --- a/src/librustc_codegen_llvm/mono_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -82,7 +82,12 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> { if instance.def.is_inline(self.tcx) { attributes::inline(self, lldecl, attributes::InlineAttr::Hint); } - attributes::from_fn_attrs(self, lldecl, Some(instance.def.def_id())); + attributes::from_fn_attrs( + self, + lldecl, + Some(instance.def.def_id()), + mono_sig, + ); self.instances.borrow_mut().insert(instance, lldecl); } diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index b0601b3bbef..ab52d9be6b8 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -628,12 +628,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, // unwind anyway. Don't stop them. let attrs = &tcx.get_attrs(fn_def_id); match attr::find_unwind_attr(Some(tcx.sess.diagnostic()), attrs) { - None => { - // FIXME(rust-lang/rust#48251) -- Had to disable - // abort-on-panic for backwards compatibility reasons. - false - } - + None => true, Some(UnwindAttr::Allowed) => false, Some(UnwindAttr::Aborts) => true, } diff --git a/src/test/codegen/nounwind-extern.rs b/src/test/codegen/nounwind-extern.rs new file mode 100644 index 00000000000..ed07cf1d6b2 --- /dev/null +++ b/src/test/codegen/nounwind-extern.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK: Function Attrs: norecurse nounwind +pub extern fn foo() {} diff --git a/src/test/run-pass/abort-on-c-abi.rs b/src/test/run-pass/abort-on-c-abi.rs index 17b2ee39c88..12b5b786766 100644 --- a/src/test/run-pass/abort-on-c-abi.rs +++ b/src/test/run-pass/abort-on-c-abi.rs @@ -15,14 +15,11 @@ // ignore-cloudabi no env and process // ignore-emscripten no processes -#![feature(unwind_attributes)] - use std::{env, panic}; use std::io::prelude::*; use std::io; use std::process::{Command, Stdio}; -#[unwind(aborts)] extern "C" fn panic_in_ffi() { panic!("Test"); } diff --git a/src/test/run-pass/extern/extern-call-deep.rs b/src/test/run-pass/extern/extern-call-deep.rs index f6eff601c4b..12df0f32134 100644 --- a/src/test/run-pass/extern/extern-call-deep.rs +++ b/src/test/run-pass/extern/extern-call-deep.rs @@ -10,6 +10,7 @@ // run-pass // ignore-wasm32-bare no libc to test ffi with +// ignore-emscripten blows the JS stack #![feature(rustc_private)] -- cgit 1.4.1-3-g733a5 From 5087aef79202e9f1411a0d0a0a74b0e63643a118 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 13 Dec 2018 12:50:42 -0800 Subject: rustc: Add an unstable `simd_select_bitmask` intrinsic This is going to be required for binding a number of AVX-512 intrinsics in the `stdsimd` repository, and this intrinsic is the same as `simd_select` except that it takes a bitmask as the first argument instead of a SIMD vector. This bitmask is then transmuted into a `` argument, depending on how many bits it is. cc rust-lang-nursery/stdsimd#310 --- src/librustc_codegen_llvm/intrinsic.rs | 21 +++++++++++++++ src/librustc_typeck/check/intrinsic.rs | 3 ++- src/test/codegen/simd-intrinsic-generic-select.rs | 12 +++++++++ .../run-pass/simd/simd-intrinsic-generic-select.rs | 30 ++++++++++++++++++++++ .../simd-intrinsic-generic-select.rs | 10 ++++++++ .../simd-intrinsic-generic-select.stderr | 26 ++++++++++++++++--- 6 files changed, 97 insertions(+), 5 deletions(-) (limited to 'src/test/codegen') diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 2b82ebe0bc2..8b26ada1576 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1171,6 +1171,27 @@ fn generic_simd_intrinsic( ); let arg_tys = sig.inputs(); + if name == "simd_select_bitmask" { + let in_ty = arg_tys[0]; + let m_len = match in_ty.sty { + // Note that this `.unwrap()` crashes for isize/usize, that's sort + // of intentional as there's not currently a use case for that. + ty::Int(i) => i.bit_width().unwrap(), + ty::Uint(i) => i.bit_width().unwrap(), + _ => return_error!("`{}` is not an integral type", in_ty), + }; + require_simd!(arg_tys[1], "argument"); + let v_len = arg_tys[1].simd_size(tcx); + require!(m_len == v_len, + "mismatched lengths: mask length `{}` != other vector length `{}`", + m_len, v_len + ); + let i1 = bx.type_i1(); + let i1xn = bx.type_vector(i1, m_len as u64); + let m_i1s = bx.bitcast(args[0].immediate(), i1xn); + return Ok(bx.select(m_i1s, args[1].immediate(), args[2].immediate())); + } + // every intrinsic takes a SIMD vector as its first argument require_simd!(arg_tys[0], "input"); let in_ty = arg_tys[0]; diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 5c0eef5b1f3..a40e56d68ae 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -435,7 +435,8 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, "simd_insert" => (2, vec![param(0), tcx.types.u32, param(1)], param(0)), "simd_extract" => (2, vec![param(0), tcx.types.u32], param(1)), "simd_cast" => (2, vec![param(0)], param(1)), - "simd_select" => (2, vec![param(0), param(1), param(1)], param(1)), + "simd_select" | + "simd_select_bitmask" => (2, vec![param(0), param(1), param(1)], param(1)), "simd_reduce_all" | "simd_reduce_any" => (1, vec![param(0)], tcx.types.bool), "simd_reduce_add_ordered" | "simd_reduce_mul_ordered" => (2, vec![param(0), param(1)], param(1)), diff --git a/src/test/codegen/simd-intrinsic-generic-select.rs b/src/test/codegen/simd-intrinsic-generic-select.rs index 8a64d7437d8..24a4b2b1b05 100644 --- a/src/test/codegen/simd-intrinsic-generic-select.rs +++ b/src/test/codegen/simd-intrinsic-generic-select.rs @@ -19,12 +19,17 @@ #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x4(pub f32, pub f32, pub f32, pub f32); +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +pub struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32); + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct b8x4(pub i8, pub i8, pub i8, pub i8); extern "platform-intrinsic" { fn simd_select(x: T, a: U, b: U) -> U; + fn simd_select_bitmask(x: T, a: U, b: U) -> U; } // CHECK-LABEL: @select @@ -33,3 +38,10 @@ pub unsafe fn select(m: b8x4, a: f32x4, b: f32x4) -> f32x4 { // CHECK: select <4 x i1> simd_select(m, a, b) } + +// CHECK-LABEL: @select_bitmask +#[no_mangle] +pub unsafe fn select_bitmask(m: i8, a: f32x8, b: f32x8) -> f32x8 { + // CHECK: select <8 x i1> + simd_select_bitmask(m, a, b) +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-select.rs b/src/test/run-pass/simd/simd-intrinsic-generic-select.rs index 590a2990270..74b99ca4950 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-select.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-select.rs @@ -26,6 +26,10 @@ struct i32x4(pub i32, pub i32, pub i32, pub i32); #[derive(Copy, Clone, PartialEq, Debug)] struct u32x4(pub u32, pub u32, pub u32, pub u32); +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct u32x8(u32, u32, u32, u32, u32, u32, u32, u32); + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct f32x4(pub f32, pub f32, pub f32, pub f32); @@ -36,6 +40,7 @@ struct b8x4(pub i8, pub i8, pub i8, pub i8); extern "platform-intrinsic" { fn simd_select(x: T, a: U, b: U) -> U; + fn simd_select_bitmask(x: T, a: U, b: U) -> U; } fn main() { @@ -146,4 +151,29 @@ fn main() { let e = b8x4(t, f, t, t); assert_eq!(r, e); } + + unsafe { + let a = u32x8(0, 1, 2, 3, 4, 5, 6, 7); + let b = u32x8(8, 9, 10, 11, 12, 13, 14, 15); + + let r: u32x8 = simd_select_bitmask(0u8, a, b); + let e = b; + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0xffu8, a, b); + let e = a; + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0b01010101u8, a, b); + let e = u32x8(0, 9, 2, 11, 4, 13, 6, 15); + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0b10101010u8, a, b); + let e = u32x8(8, 1, 10, 3, 12, 5, 14, 7); + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0b11110000u8, a, b); + let e = u32x8(8, 9, 10, 11, 4, 5, 6, 7); + assert_eq!(r, e); + } } diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs index d74d6815d5f..2a2d35e7bd9 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs @@ -33,6 +33,7 @@ struct b8x8(pub i8, pub i8, pub i8, pub i8, extern "platform-intrinsic" { fn simd_select(x: T, a: U, b: U) -> U; + fn simd_select_bitmask(x: T, a: U, b: U) -> U; } fn main() { @@ -52,5 +53,14 @@ fn main() { simd_select(z, z, z); //~^ ERROR mask element type is `f32`, expected `i_` + + simd_select_bitmask(0u8, x, x); + //~^ ERROR mask length `8` != other vector length `4` + + simd_select_bitmask(0.0f32, x, x); + //~^ ERROR `f32` is not an integral type + + simd_select_bitmask("x", x, x); + //~^ ERROR `&str` is not an integral type } } diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr index 61e42027039..584f3d53921 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr @@ -1,21 +1,39 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/simd-intrinsic-generic-select.rs:47:9 + --> $DIR/simd-intrinsic-generic-select.rs:48:9 | LL | simd_select(m8, x, x); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_` - --> $DIR/simd-intrinsic-generic-select.rs:50:9 + --> $DIR/simd-intrinsic-generic-select.rs:51:9 | LL | simd_select(x, x, x); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_` - --> $DIR/simd-intrinsic-generic-select.rs:53:9 + --> $DIR/simd-intrinsic-generic-select.rs:54:9 | LL | simd_select(z, z, z); | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: mismatched lengths: mask length `8` != other vector length `4` + --> $DIR/simd-intrinsic-generic-select.rs:57:9 + | +LL | simd_select_bitmask(0u8, x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: `f32` is not an integral type + --> $DIR/simd-intrinsic-generic-select.rs:60:9 + | +LL | simd_select_bitmask(0.0f32, x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: `&str` is not an integral type + --> $DIR/simd-intrinsic-generic-select.rs:63:9 + | +LL | simd_select_bitmask("x", x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0511`. -- cgit 1.4.1-3-g733a5 From 87c8cdd8efb60a9a4b57e5b959bc56d36ea511b5 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Fri, 21 Dec 2018 10:18:38 -0800 Subject: Stabilize #[repr(packed(N))] --- src/libsyntax/feature_gate.rs | 12 ++---------- src/test/codegen/packed.rs | 1 - src/test/run-pass/issues/issue-48159.rs | 1 - src/test/run-pass/packed/auxiliary/packed.rs | 2 -- .../run-pass/packed/packed-struct-borrow-element.rs | 2 -- .../run-pass/packed/packed-struct-generic-size.rs | 3 --- .../packed/packed-struct-generic-size.stderr | 12 ++++++------ src/test/run-pass/packed/packed-struct-match.rs | 1 - src/test/run-pass/packed/packed-struct-size.rs | 3 --- src/test/run-pass/packed/packed-struct-vec.rs | 1 - src/test/run-pass/packed/packed-tuple-struct-size.rs | 2 -- src/test/run-pass/structs-enums/align-struct.rs | 1 - src/test/run-pass/union/union-packed.rs | 1 - src/test/ui/conflicting-repr-hints.rs | 1 - src/test/ui/conflicting-repr-hints.stderr | 20 ++++++++++---------- .../ui/feature-gates/feature-gate-repr_packed.rs | 18 ------------------ .../ui/feature-gates/feature-gate-repr_packed.stderr | 19 ------------------- src/test/ui/print_type_sizes/packed.rs | 1 - 18 files changed, 18 insertions(+), 83 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-repr_packed.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-repr_packed.stderr (limited to 'src/test/codegen') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 844f49fe842..db84703afde 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -397,9 +397,6 @@ declare_features! ( // Multiple patterns with `|` in `if let` and `while let`. (active, if_while_or_patterns, "1.26.0", Some(48215), None), - // Allows `#[repr(packed)]` attribute on structs. - (active, repr_packed, "1.26.0", Some(33158), None), - // Allows macro invocations in `extern {}` blocks. (active, macros_in_extern, "1.27.0", Some(49476), None), @@ -695,6 +692,8 @@ declare_features! ( (accepted, self_in_typedefs, "1.32.0", Some(49303), None), // `use path as _;` and `extern crate c as _;` (accepted, underscore_imports, "1.33.0", Some(48216), None), + // Allows `#[repr(packed(N))]` attribute on structs. + (accepted, repr_packed, "1.33.0", Some(33158), None), ); // If you change this, please modify `src/doc/unstable-book` as well. You must @@ -1588,13 +1587,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, repr_simd, attr.span, "SIMD types are experimental and possibly buggy"); } - if let Some((name, _)) = item.name_value_literal() { - if name == "packed" { - gate_feature_post!(&self, repr_packed, attr.span, - "the `#[repr(packed(n))]` attribute \ - is experimental"); - } - } } } } diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index b50f5b6f16f..fb6507fd22a 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -13,7 +13,6 @@ // min-llvm-version 7.0 #![crate_type = "lib"] -#![feature(repr_packed)] #[repr(packed)] pub struct Packed1 { diff --git a/src/test/run-pass/issues/issue-48159.rs b/src/test/run-pass/issues/issue-48159.rs index 2f625747b25..0d5b211bca9 100644 --- a/src/test/run-pass/issues/issue-48159.rs +++ b/src/test/run-pass/issues/issue-48159.rs @@ -9,7 +9,6 @@ // except according to those terms. // run-pass -#![feature(repr_packed)] #![allow(non_camel_case_types)] use std::mem; diff --git a/src/test/run-pass/packed/auxiliary/packed.rs b/src/test/run-pass/packed/auxiliary/packed.rs index 828be41cd41..6884c360e4a 100644 --- a/src/test/run-pass/packed/auxiliary/packed.rs +++ b/src/test/run-pass/packed/auxiliary/packed.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(repr_packed)] - #[repr(packed)] pub struct P1S5 { a: u8, diff --git a/src/test/run-pass/packed/packed-struct-borrow-element.rs b/src/test/run-pass/packed/packed-struct-borrow-element.rs index 69969ba640f..87c26c597f5 100644 --- a/src/test/run-pass/packed/packed-struct-borrow-element.rs +++ b/src/test/run-pass/packed/packed-struct-borrow-element.rs @@ -12,8 +12,6 @@ #![allow(dead_code)] // ignore-emscripten weird assertion? -#![feature(repr_packed)] - #[repr(packed)] struct Foo1 { bar: u8, diff --git a/src/test/run-pass/packed/packed-struct-generic-size.rs b/src/test/run-pass/packed/packed-struct-generic-size.rs index 58cd5505ffc..9608ff4ec0e 100644 --- a/src/test/run-pass/packed/packed-struct-generic-size.rs +++ b/src/test/run-pass/packed/packed-struct-generic-size.rs @@ -10,11 +10,8 @@ // run-pass #![allow(dead_code)] -#![allow(stable_features)] #![allow(unused_comparisons)] -#![feature(repr_packed)] - use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/packed/packed-struct-generic-size.stderr b/src/test/run-pass/packed/packed-struct-generic-size.stderr index 994ea7c44fb..672952f6e9f 100644 --- a/src/test/run-pass/packed/packed-struct-generic-size.stderr +++ b/src/test/run-pass/packed/packed-struct-generic-size.stderr @@ -1,35 +1,35 @@ warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:49:14 + --> $DIR/packed-struct-generic-size.rs:46:14 | LL | check!(P1::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:50:14 + --> $DIR/packed-struct-generic-size.rs:47:14 | LL | check!(P1::, 1, 11); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:52:14 + --> $DIR/packed-struct-generic-size.rs:49:14 | LL | check!(P2::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:53:14 + --> $DIR/packed-struct-generic-size.rs:50:14 | LL | check!(P2::, 2, 12); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:55:15 + --> $DIR/packed-struct-generic-size.rs:52:15 | LL | check!(P4C::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:56:15 + --> $DIR/packed-struct-generic-size.rs:53:15 | LL | check!(P4C::, 4, 12); | ^^ try removing `::` diff --git a/src/test/run-pass/packed/packed-struct-match.rs b/src/test/run-pass/packed/packed-struct-match.rs index e349a4e7f54..21ef55e5a42 100644 --- a/src/test/run-pass/packed/packed-struct-match.rs +++ b/src/test/run-pass/packed/packed-struct-match.rs @@ -9,7 +9,6 @@ // except according to those terms. // run-pass -#![feature(repr_packed)] #[repr(packed)] struct Foo1 { diff --git a/src/test/run-pass/packed/packed-struct-size.rs b/src/test/run-pass/packed/packed-struct-size.rs index 27e07b87ff4..d6a236ffc6d 100644 --- a/src/test/run-pass/packed/packed-struct-size.rs +++ b/src/test/run-pass/packed/packed-struct-size.rs @@ -13,9 +13,6 @@ #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] -#![feature(repr_packed)] - - use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/packed/packed-struct-vec.rs b/src/test/run-pass/packed/packed-struct-vec.rs index d64bfe0033b..6fd24479c19 100644 --- a/src/test/run-pass/packed/packed-struct-vec.rs +++ b/src/test/run-pass/packed/packed-struct-vec.rs @@ -9,7 +9,6 @@ // except according to those terms. // run-pass -#![feature(repr_packed)] use std::fmt; use std::mem; diff --git a/src/test/run-pass/packed/packed-tuple-struct-size.rs b/src/test/run-pass/packed/packed-tuple-struct-size.rs index 011ff4c20f4..8b18bd33c74 100644 --- a/src/test/run-pass/packed/packed-tuple-struct-size.rs +++ b/src/test/run-pass/packed/packed-tuple-struct-size.rs @@ -12,8 +12,6 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(repr_packed)] - use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/structs-enums/align-struct.rs b/src/test/run-pass/structs-enums/align-struct.rs index a0d05a6d0d2..109d5b75590 100644 --- a/src/test/run-pass/structs-enums/align-struct.rs +++ b/src/test/run-pass/structs-enums/align-struct.rs @@ -11,7 +11,6 @@ // run-pass #![allow(dead_code)] #![feature(box_syntax)] -#![feature(repr_packed)] use std::mem; diff --git a/src/test/run-pass/union/union-packed.rs b/src/test/run-pass/union/union-packed.rs index a6aef9046ee..4c9e06a395c 100644 --- a/src/test/run-pass/union/union-packed.rs +++ b/src/test/run-pass/union/union-packed.rs @@ -13,7 +13,6 @@ #![allow(non_snake_case)] #![feature(untagged_unions)] -#![feature(repr_packed)] use std::mem::{size_of, size_of_val, align_of, align_of_val}; diff --git a/src/test/ui/conflicting-repr-hints.rs b/src/test/ui/conflicting-repr-hints.rs index 426f60c6b09..f16bd1003f9 100644 --- a/src/test/ui/conflicting-repr-hints.rs +++ b/src/test/ui/conflicting-repr-hints.rs @@ -9,7 +9,6 @@ // except according to those terms. #![allow(dead_code)] -#![feature(repr_packed)] #[repr(C)] enum A { A } diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 7a4e5a5488a..01b72d93823 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -1,47 +1,47 @@ warning[E0566]: conflicting representation hints - --> $DIR/conflicting-repr-hints.rs:20:8 + --> $DIR/conflicting-repr-hints.rs:19:8 | LL | #[repr(C, u64)] //~ WARNING conflicting representation hints | ^ ^^^ warning[E0566]: conflicting representation hints - --> $DIR/conflicting-repr-hints.rs:23:8 + --> $DIR/conflicting-repr-hints.rs:22:8 | LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints | ^^^ ^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:30:1 + --> $DIR/conflicting-repr-hints.rs:29:1 | LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:34:1 + --> $DIR/conflicting-repr-hints.rs:33:1 | LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:38:1 + --> $DIR/conflicting-repr-hints.rs:37:1 | LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints - --> $DIR/conflicting-repr-hints.rs:41:1 + --> $DIR/conflicting-repr-hints.rs:40:1 | LL | struct I(i32); //~ ERROR type has conflicting packed representation hints | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints - --> $DIR/conflicting-repr-hints.rs:45:1 + --> $DIR/conflicting-repr-hints.rs:44:1 | LL | struct J(i32); //~ ERROR type has conflicting packed representation hints | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:51:1 + --> $DIR/conflicting-repr-hints.rs:50:1 | LL | / union X { //~ ERROR type has conflicting packed and align representation hints LL | | i: i32 @@ -49,7 +49,7 @@ LL | | } | |_^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:57:1 + --> $DIR/conflicting-repr-hints.rs:56:1 | LL | / union Y { //~ ERROR type has conflicting packed and align representation hints LL | | i: i32 @@ -57,7 +57,7 @@ LL | | } | |_^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:63:1 + --> $DIR/conflicting-repr-hints.rs:62:1 | LL | / union Z { //~ ERROR type has conflicting packed and align representation hints LL | | i: i32 diff --git a/src/test/ui/feature-gates/feature-gate-repr_packed.rs b/src/test/ui/feature-gates/feature-gate-repr_packed.rs deleted file mode 100644 index 65e3be288fd..00000000000 --- a/src/test/ui/feature-gates/feature-gate-repr_packed.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental -struct Foo(u64); - -#[repr(C)] -#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental -struct Bar(u64); - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-repr_packed.stderr b/src/test/ui/feature-gates/feature-gate-repr_packed.stderr deleted file mode 100644 index ed89a3f6b31..00000000000 --- a/src/test/ui/feature-gates/feature-gate-repr_packed.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158) - --> $DIR/feature-gate-repr_packed.rs:11:1 - | -LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental - | ^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(repr_packed)] to the crate attributes to enable - -error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158) - --> $DIR/feature-gate-repr_packed.rs:15:1 - | -LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental - | ^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(repr_packed)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/print_type_sizes/packed.rs b/src/test/ui/print_type_sizes/packed.rs index bc11146aa85..9ff794178fc 100644 --- a/src/test/ui/print_type_sizes/packed.rs +++ b/src/test/ui/print_type_sizes/packed.rs @@ -21,7 +21,6 @@ #![allow(dead_code)] #![feature(start)] -#![feature(repr_packed)] #[derive(Default)] #[repr(packed)] -- cgit 1.4.1-3-g733a5