about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/debuginfo-inline-callsite-location.rs4
-rw-r--r--tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh25
-rw-r--r--tests/ui/single-use-lifetime/dedup.rs9
-rw-r--r--tests/ui/single-use-lifetime/dedup.stderr11
4 files changed, 35 insertions, 14 deletions
diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs
index 833e8c0df91..f690c9c0937 100644
--- a/tests/codegen/debuginfo-inline-callsite-location.rs
+++ b/tests/codegen/debuginfo-inline-callsite-location.rs
@@ -4,9 +4,9 @@
 // can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail
 // calls to panic.
 
-// CHECK:       tail call void @_ZN4core6option13unwrap_failed17h{{([0-9a-z]{16})}}E
+// CHECK:       tail call void @{{[A-Za-z0-9_]+4core6option13unwrap_failed}}
 // CHECK-SAME:  !dbg ![[#first_dbg:]]
-// CHECK:       tail call void @_ZN4core6option13unwrap_failed17h{{([0-9a-z]{16})}}E
+// CHECK:       tail call void @{{[A-Za-z0-9_]+4core6option13unwrap_failed}}
 // CHECK-SAME:  !dbg ![[#second_dbg:]]
 
 // CHECK-DAG:   ![[#func_dbg:]] = distinct !DISubprogram(name: "unwrap<i32>"
diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
index a36ad916beb..a7c4ae13ecb 100644
--- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
+++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
@@ -1,20 +1,20 @@
-#!/bin/sh
+#!/bin/bash
 set -exuo pipefail
 
 function build {
     CRATE=enclave
 
-    mkdir -p $WORK_DIR
-    pushd $WORK_DIR
-        rm -rf $CRATE
-        cp -a $TEST_DIR/enclave .
+    mkdir -p "${WORK_DIR}"
+    pushd "${WORK_DIR}"
+        rm -rf "${CRATE}"
+        cp -a "${TEST_DIR}"/enclave .
         pushd $CRATE
-            echo ${WORK_DIR}
+            echo "${WORK_DIR}"
             # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
             # These come from the top-level Rust workspace, that this crate is not a
             # member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
             env RUSTC_BOOTSTRAP=1
-                cargo -v run --target $TARGET
+                cargo -v run --target "${TARGET}"
         popd
     popd
 }
@@ -22,17 +22,18 @@ function build {
 function check {
     local func_re="$1"
     local checks="${TEST_DIR}/$2"
-    local asm=$(mktemp)
+    local asm=""
     local objdump="${LLVM_BIN_DIR}/llvm-objdump"
     local filecheck="${LLVM_BIN_DIR}/FileCheck"
     local enclave=${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave
 
-    func="$(${objdump} --syms --demangle ${enclave} | \
+    asm=$(mktemp)
+    func="$(${objdump} --syms --demangle "${enclave}" | \
             grep --only-matching -E "[[:blank:]]+${func_re}\$" | \
             sed -e 's/^[[:space:]]*//' )"
     ${objdump} --disassemble-symbols="${func}" --demangle \
-      ${enclave} > ${asm}
-    ${filecheck} --input-file ${asm} ${checks}
+      "${enclave}" > "${asm}"
+    ${filecheck} --input-file "${asm}" "${checks}"
 
     if [ "${func_re}" != "rust_plus_one_global_asm" ] &&
          [ "${func_re}" != "cmake_plus_one_c_global_asm" ] &&
@@ -41,7 +42,7 @@ function check {
         # of `shlq $0x0, (%rsp); lfence; retq` are used instead.
         # https://www.intel.com/content/www/us/en/developer/articles/technical/
         #     software-security-guidance/technical-documentation/load-value-injection.html
-        ${filecheck} --implicit-check-not ret --input-file ${asm} ${checks}
+        ${filecheck} --implicit-check-not ret --input-file "${asm}" "${checks}"
     fi
 }
 
diff --git a/tests/ui/single-use-lifetime/dedup.rs b/tests/ui/single-use-lifetime/dedup.rs
new file mode 100644
index 00000000000..16b39609a6d
--- /dev/null
+++ b/tests/ui/single-use-lifetime/dedup.rs
@@ -0,0 +1,9 @@
+// Check that `unused_lifetimes` lint doesn't duplicate a "parameter is never used" error.
+// Fixed in <https://github.com/rust-lang/rust/pull/96833>.
+// Issue: <https://github.com/rust-lang/rust/issues/72587>.
+
+#![warn(unused_lifetimes)]
+struct Foo<'a>;
+//~^ ERROR parameter `'a` is never used
+
+fn main() {}
diff --git a/tests/ui/single-use-lifetime/dedup.stderr b/tests/ui/single-use-lifetime/dedup.stderr
new file mode 100644
index 00000000000..6d02cb3c714
--- /dev/null
+++ b/tests/ui/single-use-lifetime/dedup.stderr
@@ -0,0 +1,11 @@
+error[E0392]: lifetime parameter `'a` is never used
+  --> $DIR/dedup.rs:6:12
+   |
+LL | struct Foo<'a>;
+   |            ^^ unused lifetime parameter
+   |
+   = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0392`.