diff options
| author | bors <bors@rust-lang.org> | 2024-06-24 06:06:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-24 06:06:16 +0000 |
| commit | b8e1d7ef6fcec31db99ef82d8a913a2a703e8944 (patch) | |
| tree | 475052c1564920a30d5c4612177eafb17e7b72de /tests | |
| parent | aded2be375993cfb08c8d13be71c046bd048c5d2 (diff) | |
| parent | c660016cc1879d9714d134604856b5914f5d0aa0 (diff) | |
| download | rust-b8e1d7ef6fcec31db99ef82d8a913a2a703e8944.tar.gz rust-b8e1d7ef6fcec31db99ef82d8a913a2a703e8944.zip | |
Auto merge of #3706 - rust-lang:rustup-2024-06-24, r=oli-obk
Automatic Rustup
Diffstat (limited to 'tests')
50 files changed, 944 insertions, 204 deletions
diff --git a/tests/codegen/force-frame-pointers.rs b/tests/codegen/force-frame-pointers.rs index 84e0bcb39ad..88c918945d6 100644 --- a/tests/codegen/force-frame-pointers.rs +++ b/tests/codegen/force-frame-pointers.rs @@ -1,6 +1,18 @@ -//@ compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0 +//@ revisions: Always NonLeaf +//@ [Always] compile-flags: -Cforce-frame-pointers=yes +//@ [NonLeaf] compile-flags: -Cforce-frame-pointers=non-leaf +//@ compile-flags: -Zunstable-options +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ [NonLeaf] ignore-illumos +//@ [NonLeaf] ignore-openbsd +//@ [NonLeaf] ignore-x86 +//@ [NonLeaf] ignore-x86_64-apple-darwin +//@ [NonLeaf] ignore-windows-gnu +//@ [NonLeaf] ignore-thumb +// result is platform-dependent based on platform's frame pointer settings #![crate_type = "lib"] -// CHECK: attributes #{{.*}} "frame-pointer"="all" +// Always: attributes #{{.*}} "frame-pointer"="all" +// NonLeaf: attributes #{{.*}} "frame-pointer"="non-leaf" pub fn foo() {} diff --git a/tests/crashes/122587-1.rs b/tests/crashes/122587-1.rs deleted file mode 100644 index ea0e843a10c..00000000000 --- a/tests/crashes/122587-1.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ known-bug: #122587 -const b: f16 = 0.0f16; -pub fn main() { - let b = 0.0f16; -} diff --git a/tests/run-make/branch-protection-check-IBT/Makefile b/tests/run-make/branch-protection-check-IBT/Makefile index cabe951e1c5..ee0e034627f 100644 --- a/tests/run-make/branch-protection-check-IBT/Makefile +++ b/tests/run-make/branch-protection-check-IBT/Makefile @@ -7,6 +7,12 @@ include ../tools.mk # only-x86_64 +# ignore-test +# FIXME(jieyouxu): This test never runs because the `ifeq` check on line 17 +# compares `x86` to `x86_64`, which always evaluates to false. +# When the test does run, the compilation does not include `.note.gnu.property`. +# See https://github.com/rust-lang/rust/pull/126720 for more information. + all: ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64) $(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain diff --git a/tests/run-make/branch-protection-check-IBT/_rmake.rs b/tests/run-make/branch-protection-check-IBT/_rmake.rs new file mode 100644 index 00000000000..d66ecf9c005 --- /dev/null +++ b/tests/run-make/branch-protection-check-IBT/_rmake.rs @@ -0,0 +1,31 @@ +// Check for GNU Property Note + +// How to run this +// python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/ + +//@ only-x86_64 + +//@ ignore-test +// FIXME(jieyouxu): see the FIXME in the Makefile + +use run_make_support::llvm_readobj; +use run_make_support::rustc; +use run_make_support::{cwd, env_var}; + +fn main() { + let llvm_components = env_var("LLVM_COMPONENTS"); + if !format!(" {llvm_components} ").contains(" x86 ") { + return; + } + + rustc() + .input("main.rs") + .target("x86_64-unknown-linux-gnu") + .arg("-Zcf-protection=branch") + .arg(format!("-L{}", cwd().display())) + .arg("-Clink-args=-nostartfiles") + .arg("-Csave-temps") + .run(); + + llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property"); +} diff --git a/tests/run-make/relro-levels/Makefile b/tests/run-make/relro-levels/Makefile deleted file mode 100644 index 94f08bcb494..00000000000 --- a/tests/run-make/relro-levels/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# only-linux -# -# This tests the different -Crelro-level values, and makes sure that they work properly. - -all: - # Ensure that binaries built with the full relro level links them with both - # RELRO and BIND_NOW for doing eager symbol resolving. - $(RUSTC) -Crelro-level=full hello.rs - readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO - readelf -d $(TMPDIR)/hello | grep -q BIND_NOW - - $(RUSTC) -Crelro-level=partial hello.rs - readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO - - # Ensure that we're *not* built with RELRO when setting it to off. We do - # not want to check for BIND_NOW however, as the linker might have that - # enabled by default. - $(RUSTC) -Crelro-level=off hello.rs - ! readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO diff --git a/tests/run-make/relro-levels/rmake.rs b/tests/run-make/relro-levels/rmake.rs new file mode 100644 index 00000000000..56545ebc5aa --- /dev/null +++ b/tests/run-make/relro-levels/rmake.rs @@ -0,0 +1,28 @@ +// This tests the different -Crelro-level values, and makes sure that they work properly. + +//@ only-linux + +use run_make_support::llvm_readobj; +use run_make_support::rustc; + +fn compile(relro_level: &str) { + rustc().arg(format!("-Crelro-level={relro_level}")).input("hello.rs").run(); +} + +fn main() { + // Ensure that binaries built with the full relro level links them with both + // RELRO and BIND_NOW for doing eager symbol resolving. + + compile("full"); + llvm_readobj().program_headers().input("hello").run().assert_stdout_contains("GNU_RELRO"); + llvm_readobj().dynamic_table().input("hello").run().assert_stdout_contains("BIND_NOW"); + + compile("partial"); + llvm_readobj().program_headers().input("hello").run().assert_stdout_contains("GNU_RELRO"); + + // Ensure that we're *not* built with RELRO when setting it to off. We do + // not want to check for BIND_NOW however, as the linker might have that + // enabled by default. + compile("off"); + llvm_readobj().program_headers().input("hello").run().assert_stdout_not_contains("GNU_RELRO"); +} diff --git a/tests/run-make/static-pie/Makefile b/tests/run-make/static-pie/Makefile deleted file mode 100644 index 8379730cc3d..00000000000 --- a/tests/run-make/static-pie/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# only-x86_64 -# only-linux -# ignore-32bit - -# How to manually run this -# $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie - -all: test-clang test-gcc - -test-%: - if ./check_$*_version.sh; then\ - ${RUSTC} -Clinker=$* -Clinker-flavor=gcc --target ${TARGET} -C target-feature=+crt-static test-aslr.rs; \ - ! readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP) INTERP; \ - readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP) DYNAMIC; \ - $(call RUN,test-aslr) --test-aslr; \ - fi diff --git a/tests/run-make/static-pie/check_clang_version.sh b/tests/run-make/static-pie/check_clang_version.sh deleted file mode 100755 index b8e97c3da7d..00000000000 --- a/tests/run-make/static-pie/check_clang_version.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -if command -v clang > /dev/null -then - CLANG_VERSION=$(echo __clang_major__ | clang -E -x c - | grep -v -e '^#' ) - echo "clang version $CLANG_VERSION detected" - if (( $CLANG_VERSION >= 9 )) - then - echo "clang supports -static-pie" - exit 0 - else - echo "clang too old to support -static-pie, skipping test" - exit 1 - fi -else - echo "No clang version detected" - exit 2 -fi diff --git a/tests/run-make/static-pie/check_gcc_version.sh b/tests/run-make/static-pie/check_gcc_version.sh deleted file mode 100755 index d07e1d151df..00000000000 --- a/tests/run-make/static-pie/check_gcc_version.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -if command -v gcc > /dev/null -then - GCC_VERSION=$(echo __GNUC__ | gcc -E -x c - | grep -v -e '^#' ) - echo "gcc version $GCC_VERSION detected" - if (( $GCC_VERSION >= 8 )) - then - echo "gcc supports -static-pie" - exit 0 - else - echo "gcc too old to support -static-pie, skipping test" - exit 1 - fi -else - echo "No gcc version detected" - exit 2 -fi diff --git a/tests/run-make/static-pie/rmake.rs b/tests/run-make/static-pie/rmake.rs new file mode 100644 index 00000000000..77c5e253bc0 --- /dev/null +++ b/tests/run-make/static-pie/rmake.rs @@ -0,0 +1,73 @@ +// How to manually run this +// $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie + +//@ only-x86_64 +//@ only-linux +//@ ignore-32bit + +use std::process::Command; + +use run_make_support::llvm_readobj; +use run_make_support::regex::Regex; +use run_make_support::rustc; +use run_make_support::{cmd, run_with_args, target}; + +// Minimum major versions supporting -static-pie +const GCC_VERSION: u32 = 8; +const CLANG_VERSION: u32 = 9; + +// Return `true` if the `compiler` version supports `-static-pie`. +fn ok_compiler_version(compiler: &str) -> bool { + let (trigger, version_threshold) = match compiler { + "clang" => ("__clang_major__", CLANG_VERSION), + "gcc" => ("__GNUC__", GCC_VERSION), + other => panic!("unexpected compiler '{other}', expected 'clang' or 'gcc'"), + }; + + if Command::new(compiler).spawn().is_err() { + eprintln!("No {compiler} version detected"); + return false; + } + + let compiler_output = + cmd(compiler).stdin(trigger).arg("-").arg("-E").arg("-x").arg("c").run().stdout_utf8(); + let re = Regex::new(r"(?m)^(\d+)").unwrap(); + let version: u32 = + re.captures(&compiler_output).unwrap().get(1).unwrap().as_str().parse().unwrap(); + + if version >= version_threshold { + eprintln!("{compiler} supports -static-pie"); + true + } else { + eprintln!("{compiler} too old to support -static-pie, skipping test"); + false + } +} + +fn test(compiler: &str) { + if !ok_compiler_version(compiler) { + return; + } + + rustc() + .input("test-aslr.rs") + .target(&target()) + .linker(compiler) + .arg("-Clinker-flavor=gcc") + .arg("-Ctarget-feature=+crt-static") + .run(); + + llvm_readobj() + .symbols() + .input("test-aslr") + .run() + .assert_stdout_not_contains("INTERP") + .assert_stdout_contains("DYNAMIC"); + + run_with_args("test-aslr", &["--test-aslr"]); +} + +fn main() { + test("clang"); + test("gcc"); +} diff --git a/tests/run-make/symlinked-extern/rmake.rs b/tests/run-make/symlinked-extern/rmake.rs index 98f69aefbe6..9ed5b76edcb 100644 --- a/tests/run-make/symlinked-extern/rmake.rs +++ b/tests/run-make/symlinked-extern/rmake.rs @@ -9,6 +9,7 @@ // can result in successful compilation. //@ ignore-cross-compile +//@ needs-symlink use run_make_support::{create_symlink, cwd, fs_wrapper, rustc}; diff --git a/tests/run-make/symlinked-libraries/rmake.rs b/tests/run-make/symlinked-libraries/rmake.rs index 3f02f19ccd5..1d1dce5b5cf 100644 --- a/tests/run-make/symlinked-libraries/rmake.rs +++ b/tests/run-make/symlinked-libraries/rmake.rs @@ -6,6 +6,7 @@ // See https://github.com/rust-lang/rust/issues/12459 //@ ignore-cross-compile +//@ needs-symlink use run_make_support::{create_symlink, dynamic_lib_name, fs_wrapper, rustc}; diff --git a/tests/run-make/symlinked-rlib/rmake.rs b/tests/run-make/symlinked-rlib/rmake.rs index 3759ca25928..65ebb191428 100644 --- a/tests/run-make/symlinked-rlib/rmake.rs +++ b/tests/run-make/symlinked-rlib/rmake.rs @@ -6,6 +6,7 @@ // See https://github.com/rust-lang/rust/pull/32828 //@ ignore-cross-compile +//@ needs-symlink use run_make_support::{create_symlink, cwd, rustc}; diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index 9a7de60bf38..0582bd2cad3 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -1,7 +1,10 @@ // These tests verify that labels like "UNIX" and "Deprecated" stay on the same line as their symbol. // It also verifies the staggered layout on mobile. +include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +call-function: ("switch-theme", {"theme": "light"}) + // Desktop view set-window-size: (1080, 600) assert: (".stab.deprecated") diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index 7ce3be8a5b3..67152afbbaa 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -141,14 +141,15 @@ click: "#sidebar-button" wait-for-css: (".src .sidebar > *", {"visibility": "hidden"}) // We scroll to line 117 to change the scroll position. scroll-to: '//*[@id="117"]' -assert-window-property: {"pageYOffset": "2516"} +store-value: (y_offset, "2493") +assert-window-property: {"pageYOffset": |y_offset|} // Expanding the sidebar... click: "#sidebar-button" wait-for-css: (".sidebar", {"left": "0px"}) click: "#sidebar-button" wait-for-css: (".sidebar", {"left": "-1000px"}) // The "scrollTop" property should be the same. -assert-window-property: {"pageYOffset": "2516"} +assert-window-property: {"pageYOffset": |y_offset|} // We now check that opening the sidebar and clicking a link will close it. // The behavior here on mobile is different than the behavior on desktop, diff --git a/tests/ui/abi/variadic-ffi.rs b/tests/ui/abi/variadic-ffi.rs index de4844ac860..6cfae0f2a32 100644 --- a/tests/ui/abi/variadic-ffi.rs +++ b/tests/ui/abi/variadic-ffi.rs @@ -14,6 +14,10 @@ pub unsafe extern "C" fn test_valist_forward(n: u64, mut ap: ...) -> f64 { rust_valist_interesting_average(n, ap.as_va_list()) } +pub unsafe extern "C-unwind" fn c_unwind_can_forward(n: u64, mut ap: ...) -> f64 { + rust_valist_interesting_average(n, ap.as_va_list()) +} + pub unsafe extern "C" fn test_va_copy(_: u64, mut ap: ...) { let mut ap2 = ap.clone(); assert_eq!(rust_valist_interesting_average(2, ap2.as_va_list()) as i64, 30); @@ -73,6 +77,10 @@ pub fn main() { } unsafe { + assert_eq!(c_unwind_can_forward(2, 10i64, 10f64, 20i64, 20f64) as i64, 30); + } + + unsafe { test_va_copy(4, 10i64, 10f64, 20i64, 20f64, 30i64, 30f64, 40i64, 40f64); } } diff --git a/tests/ui/asm/arm-low-dreg.rs b/tests/ui/asm/arm-low-dreg.rs new file mode 100644 index 00000000000..e9ff0117e2d --- /dev/null +++ b/tests/ui/asm/arm-low-dreg.rs @@ -0,0 +1,33 @@ +//@ build-pass +//@ compile-flags: --target=armv7-unknown-linux-gnueabihf +//@ needs-llvm-components: arm +#![feature(no_core, rustc_attrs, decl_macro, lang_items)] +#![crate_type = "rlib"] +#![no_std] +#![no_core] + +// We accidentally classified "d0"..="d15" as dregs, even though they are in dreg_low16, +// and thus didn't compile them on platforms with only 16 dregs. +// Highlighted in https://github.com/rust-lang/rust/issues/126797 + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +impl Copy for f64 {} + +#[rustc_builtin_macro] +pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { + /* compiler built-in */ +} + + +fn f(x: f64) -> f64 { + let out: f64; + unsafe { + asm!("vmov.f64 d1, d0", out("d1") out, in("d0") x); + } + out +} diff --git a/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr index 1c07a5bf8ba..ea82bac6df0 100644 --- a/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr @@ -9,12 +9,6 @@ help: escape `unsafe` to use it as an identifier LL | #[unsafe(r#unsafe(no_mangle))] | ++ -error: cannot find attribute `r#unsafe` in this scope - --> $DIR/double-unsafe-attributes.rs:3:10 - | -LL | #[unsafe(unsafe(no_mangle))] - | ^^^^^^ - error: `r#unsafe` is not an unsafe attribute --> $DIR/double-unsafe-attributes.rs:3:3 | @@ -23,5 +17,11 @@ LL | #[unsafe(unsafe(no_mangle))] | = note: extraneous unsafe is not allowed in attributes +error: cannot find attribute `r#unsafe` in this scope + --> $DIR/double-unsafe-attributes.rs:3:10 + | +LL | #[unsafe(unsafe(no_mangle))] + | ^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 69e19e1d4d2..67a619e46d5 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -46,7 +46,7 @@ error: `...` must be the last argument of a C-variadic function LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/issue-86053-1.rs:11:12 | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { diff --git a/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr index 99f37fedd3d..54d45ee8ffb 100644 --- a/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr +++ b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr @@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-91827-extern-types-field-offset.rs:38:17 | LL | let field = &x.a; - | ^^^^ `extern type` does not have a known offset + | ^^^^ `extern type` field does not have a known offset error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/validation-ice-extern-type-field.rs b/tests/ui/consts/const-eval/validation-ice-extern-type-field.rs new file mode 100644 index 00000000000..3502409d576 --- /dev/null +++ b/tests/ui/consts/const-eval/validation-ice-extern-type-field.rs @@ -0,0 +1,15 @@ +#![feature(extern_types)] + +extern { + type Opaque; +} + +struct ThinDst { + x: u8, + tail: Opaque, +} + +const C1: &ThinDst = unsafe { std::mem::transmute(b"d".as_ptr()) }; +//~^ERROR: evaluation of constant value failed + +fn main() {} diff --git a/tests/ui/consts/const-eval/validation-ice-extern-type-field.stderr b/tests/ui/consts/const-eval/validation-ice-extern-type-field.stderr new file mode 100644 index 00000000000..1ec36abc2ec --- /dev/null +++ b/tests/ui/consts/const-eval/validation-ice-extern-type-field.stderr @@ -0,0 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/validation-ice-extern-type-field.rs:12:1 + | +LL | const C1: &ThinDst = unsafe { std::mem::transmute(b"d".as_ptr()) }; + | ^^^^^^^^^^^^^^^^^^ `extern type` field does not have a known offset + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const_in_pattern/f16-f128-const-reassign.rs b/tests/ui/consts/const_in_pattern/f16-f128-const-reassign.rs new file mode 100644 index 00000000000..99d0e472485 --- /dev/null +++ b/tests/ui/consts/const_in_pattern/f16-f128-const-reassign.rs @@ -0,0 +1,14 @@ +//@ check-pass +// issue: rust-lang/rust#122587 + +#![feature(f128)] +#![feature(f16)] +#![allow(non_upper_case_globals)] + +const h: f16 = 0.0f16; +const q: f128 = 0.0f128; + +pub fn main() { + let h = 0.0f16 else { unreachable!() }; + let q = 0.0f128 else { unreachable!() }; +} diff --git a/tests/ui/delegation/glob-traitless-qpath.rs b/tests/ui/delegation/glob-traitless-qpath.rs new file mode 100644 index 00000000000..abf4b3180ed --- /dev/null +++ b/tests/ui/delegation/glob-traitless-qpath.rs @@ -0,0 +1,11 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +struct S; + +impl S { + reuse <u8>::*; //~ ERROR qualified path without a trait in glob delegation + reuse <()>::*; //~ ERROR qualified path without a trait in glob delegation +} + +fn main() {} diff --git a/tests/ui/delegation/glob-traitless-qpath.stderr b/tests/ui/delegation/glob-traitless-qpath.stderr new file mode 100644 index 00000000000..e3257de347a --- /dev/null +++ b/tests/ui/delegation/glob-traitless-qpath.stderr @@ -0,0 +1,14 @@ +error: qualified path without a trait in glob delegation + --> $DIR/glob-traitless-qpath.rs:7:5 + | +LL | reuse <u8>::*; + | ^^^^^^^^^^^^^^ + +error: qualified path without a trait in glob delegation + --> $DIR/glob-traitless-qpath.rs:8:5 + | +LL | reuse <()>::*; + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs index 3487bac5282..38ade060cb1 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs @@ -4,6 +4,8 @@ // via `.contains(...)` and make sure the dynamic semantics match. #![allow(unreachable_patterns)] +#![feature(f128)] +#![feature(f16)] macro_rules! yes { ($scrutinee:expr, $($t:tt)+) => { @@ -39,6 +41,17 @@ fn range_to_inclusive() { assert!(yes!('a', ..='a')); assert!(!yes!('b', ..='a')); + // f16; `..=X` + // FIXME(f16_f128): remove gate when ABI issues are resolved + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + { + // FIXME(f16_f128): enable infinity tests when constants are available + // assert!(yes!(f16::NEG_INFINITY, ..=f16::NEG_INFINITY)); + // assert!(yes!(f16::NEG_INFINITY, ..=1.0f16)); + assert!(yes!(1.5f16, ..=1.5f16)); + assert!(!yes!(1.6f16, ..=-1.5f16)); + } + // f32; `..=X` assert!(yes!(f32::NEG_INFINITY, ..=f32::NEG_INFINITY)); assert!(yes!(f32::NEG_INFINITY, ..=1.0f32)); @@ -50,6 +63,17 @@ fn range_to_inclusive() { assert!(yes!(f64::NEG_INFINITY, ..=1.0f64)); assert!(yes!(1.5f64, ..=1.5f64)); assert!(!yes!(1.6f64, ..=-1.5f64)); + + // f128; `..=X` + // FIXME(f16_f128): remove gate when ABI issues are resolved + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + { + // FIXME(f16_f128): enable infinity tests when constants are available + // assert!(yes!(f128::NEG_INFINITY, ..=f128::NEG_INFINITY)); + // assert!(yes!(f128::NEG_INFINITY, ..=1.0f128)); + assert!(yes!(1.5f128, ..=1.5f128)); + assert!(!yes!(1.6f128, ..=-1.5f128)); + } } fn range_to() { @@ -83,6 +107,18 @@ fn range_to() { assert!(!yes!('a', ..'a')); assert!(!yes!('b', ..'a')); + // f16; `..X` + // FIXME(f16_f128): remove gate when ABI issues are resolved + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + { + // FIXME(f16_f128): enable infinity tests when constants are available + // assert!(yes!(f16::NEG_INFINITY, ..1.0f16)); + assert!(!yes!(1.5f16, ..1.5f16)); + const E16: f16 = 1.5f16 + f16::EPSILON; + assert!(yes!(1.5f16, ..E16)); + assert!(!yes!(1.6f16, ..1.5f16)); + } + // f32; `..X` assert!(yes!(f32::NEG_INFINITY, ..1.0f32)); assert!(!yes!(1.5f32, ..1.5f32)); @@ -96,6 +132,18 @@ fn range_to() { const E64: f64 = 1.5f64 + f64::EPSILON; assert!(yes!(1.5f64, ..E64)); assert!(!yes!(1.6f64, ..1.5f64)); + + // f128; `..X` + // FIXME(f16_f128): remove gate when ABI issues are resolved + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + { + // FIXME(f16_f128): enable infinity tests when constants are available + // assert!(yes!(f128::NEG_INFINITY, ..1.0f128)); + assert!(!yes!(1.5f128, ..1.5f128)); + const E128: f128 = 1.5f128 + f128::EPSILON; + assert!(yes!(1.5f128, ..E128)); + assert!(!yes!(1.6f128, ..1.5f128)); + } } fn range_from() { @@ -129,6 +177,21 @@ fn range_from() { assert!(!yes!('a', 'b'..)); assert!(yes!(core::char::MAX, core::char::MAX..)); + // f16; `X..` + // FIXME(f16_f128): remove gate when ABI issues are resolved + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + { + // FIXME(f16_f128): enable infinity tests when constants are available + // assert!(yes!(f16::NEG_INFINITY, f16::NEG_INFINITY..)); + // assert!(yes!(f16::INFINITY, f16::NEG_INFINITY..)); + // assert!(!yes!(f16::NEG_INFINITY, 1.0f16..)); + // assert!(yes!(f16::INFINITY, 1.0f16..)); + assert!(!yes!(1.0f16 - f16::EPSILON, 1.0f16..)); + assert!(yes!(1.0f16, 1.0f16..)); + // assert!(yes!(f16::INFINITY, 1.0f16..)); + // assert!(yes!(f16::INFINITY, f16::INFINITY..)); + } + // f32; `X..` assert!(yes!(f32::NEG_INFINITY, f32::NEG_INFINITY..)); assert!(yes!(f32::INFINITY, f32::NEG_INFINITY..)); @@ -148,6 +211,21 @@ fn range_from() { assert!(yes!(1.0f64, 1.0f64..)); assert!(yes!(f64::INFINITY, 1.0f64..)); assert!(yes!(f64::INFINITY, f64::INFINITY..)); + + // f128; `X..` + // FIXME(f16_f128): remove gate when ABI issues are resolved + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + { + // FIXME(f16_f128): enable infinity tests when constants are available + // assert!(yes!(f128::NEG_INFINITY, f128::NEG_INFINITY..)); + // assert!(yes!(f128::INFINITY, f128::NEG_INFINITY..)); + // assert!(!yes!(f128::NEG_INFINITY, 1.0f128..)); + // assert!(yes!(f128::INFINITY, 1.0f128..)); + assert!(!yes!(1.0f128 - f128::EPSILON, 1.0f128..)); + assert!(yes!(1.0f128, 1.0f128..)); + // assert!(yes!(f128::INFINITY, 1.0f128..)); + // assert!(yes!(f128::INFINITY, f128::INFINITY..)); + } } fn main() { diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs index 9ca8dd25ed7..a35bb51acbc 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs @@ -27,6 +27,7 @@ fn main() { m!(0, ..i128::MIN); //~^ ERROR lower range bound must be less than upper + // FIXME(f16_f128): add tests when NEG_INFINITY is available m!(0f32, ..f32::NEG_INFINITY); //~^ ERROR lower range bound must be less than upper m!(0f64, ..f64::NEG_INFINITY); diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr index 668b5c858f0..fb2f1841a6d 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr @@ -59,19 +59,19 @@ LL | m!(0, ..i128::MIN); | ^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:30:14 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:31:14 | LL | m!(0f32, ..f32::NEG_INFINITY); | ^^^^^^^^^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:32:14 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:33:14 | LL | m!(0f64, ..f64::NEG_INFINITY); | ^^^^^^^^^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:35:13 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:36:13 | LL | m!('a', ..'\u{0}'); | ^^^^^^^^^ diff --git a/tests/ui/match/match-float.rs b/tests/ui/match/match-float.rs index f8514568d15..70283eaeec5 100644 --- a/tests/ui/match/match-float.rs +++ b/tests/ui/match/match-float.rs @@ -1,7 +1,22 @@ //@ run-pass // Makes sure we use `==` (not bitwise) semantics for float comparison. -fn main() { +#![feature(f128)] +#![feature(f16)] + +// FIXME(f16_f128): remove gates when ABI issues are resolved + +#[cfg(all(target_arch = "aarch64", target_os = "linux"))] +fn check_f16() { + const F1: f16 = 0.0; + const F2: f16 = -0.0; + assert_eq!(F1, F2); + assert_ne!(F1.to_bits(), F2.to_bits()); + assert!(matches!(F1, F2)); + assert!(matches!(F2, F1)); +} + +fn check_f32() { const F1: f32 = 0.0; const F2: f32 = -0.0; assert_eq!(F1, F2); @@ -9,3 +24,31 @@ fn main() { assert!(matches!(F1, F2)); assert!(matches!(F2, F1)); } + +fn check_f64() { + const F1: f64 = 0.0; + const F2: f64 = -0.0; + assert_eq!(F1, F2); + assert_ne!(F1.to_bits(), F2.to_bits()); + assert!(matches!(F1, F2)); + assert!(matches!(F2, F1)); +} + +#[cfg(all(target_arch = "aarch64", target_os = "linux"))] +fn check_f128() { + const F1: f128 = 0.0; + const F2: f128 = -0.0; + assert_eq!(F1, F2); + assert_ne!(F1.to_bits(), F2.to_bits()); + assert!(matches!(F1, F2)); + assert!(matches!(F2, F1)); +} + +fn main() { + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + check_f16(); + check_f32(); + check_f64(); + #[cfg(all(target_arch = "aarch64", target_os = "linux"))] + check_f128(); +} diff --git a/tests/ui/mir/issue-83499-input-output-iteration-ice.rs b/tests/ui/mir/issue-83499-input-output-iteration-ice.rs index 0086d2ec18c..78e5c961802 100644 --- a/tests/ui/mir/issue-83499-input-output-iteration-ice.rs +++ b/tests/ui/mir/issue-83499-input-output-iteration-ice.rs @@ -5,6 +5,6 @@ fn main() {} fn foo(_: Bar, ...) -> impl {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR cannot find type `Bar` in this scope //~| ERROR at least one trait must be specified diff --git a/tests/ui/mir/issue-83499-input-output-iteration-ice.stderr b/tests/ui/mir/issue-83499-input-output-iteration-ice.stderr index 4eb3adc8b4f..80a8a94aea4 100644 --- a/tests/ui/mir/issue-83499-input-output-iteration-ice.stderr +++ b/tests/ui/mir/issue-83499-input-output-iteration-ice.stderr @@ -1,4 +1,4 @@ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/issue-83499-input-output-iteration-ice.rs:7:16 | LL | fn foo(_: Bar, ...) -> impl {} diff --git a/tests/ui/mismatched_types/mismatched-types-issue-126222.fixed b/tests/ui/mismatched_types/mismatched-types-issue-126222.fixed new file mode 100644 index 00000000000..30fd0028f19 --- /dev/null +++ b/tests/ui/mismatched_types/mismatched-types-issue-126222.fixed @@ -0,0 +1,34 @@ +//@ run-rustfix +#![allow(unreachable_code, dead_code)] + +fn main() { + fn mismatch_types1() -> i32 { + match 1 { + x => return dbg!(x), //~ ERROR mismatched types + } + todo!() + } + + fn mismatch_types2() -> i32 { + match 2 { + x => { + return dbg!(x) //~ ERROR mismatched types + } + } + todo!() + } + + fn mismatch_types3() -> i32 { + match 1 { + _ => return dbg!(1) //~ ERROR mismatched types + } + todo!() + } + + fn mismatch_types4() -> i32 { + match 1 { + _ => {return dbg!(1)} //~ ERROR mismatched types + } + todo!() + } +} diff --git a/tests/ui/mismatched_types/mismatched-types-issue-126222.rs b/tests/ui/mismatched_types/mismatched-types-issue-126222.rs new file mode 100644 index 00000000000..59178702489 --- /dev/null +++ b/tests/ui/mismatched_types/mismatched-types-issue-126222.rs @@ -0,0 +1,34 @@ +//@ run-rustfix +#![allow(unreachable_code, dead_code)] + +fn main() { + fn mismatch_types1() -> i32 { + match 1 { + x => dbg!(x), //~ ERROR mismatched types + } + todo!() + } + + fn mismatch_types2() -> i32 { + match 2 { + x => { + dbg!(x) //~ ERROR mismatched types + } + } + todo!() + } + + fn mismatch_types3() -> i32 { + match 1 { + _ => dbg!(1) //~ ERROR mismatched types + } + todo!() + } + + fn mismatch_types4() -> i32 { + match 1 { + _ => {dbg!(1)} //~ ERROR mismatched types + } + todo!() + } +} diff --git a/tests/ui/mismatched_types/mismatched-types-issue-126222.stderr b/tests/ui/mismatched_types/mismatched-types-issue-126222.stderr new file mode 100644 index 00000000000..2a8f9867abb --- /dev/null +++ b/tests/ui/mismatched_types/mismatched-types-issue-126222.stderr @@ -0,0 +1,51 @@ +error[E0308]: mismatched types + --> $DIR/mismatched-types-issue-126222.rs:7:18 + | +LL | x => dbg!(x), + | ^^^^^^^ expected `()`, found integer + | + = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you might have meant to return this value + | +LL | x => return dbg!(x), + | ++++++ + +error[E0308]: mismatched types + --> $DIR/mismatched-types-issue-126222.rs:15:17 + | +LL | dbg!(x) + | ^^^^^^^ expected `()`, found integer + | + = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you might have meant to return this value + | +LL | return dbg!(x) + | ++++++ + +error[E0308]: mismatched types + --> $DIR/mismatched-types-issue-126222.rs:23:18 + | +LL | _ => dbg!(1) + | ^^^^^^^ expected `()`, found integer + | + = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you might have meant to return this value + | +LL | _ => return dbg!(1) + | ++++++ + +error[E0308]: mismatched types + --> $DIR/mismatched-types-issue-126222.rs:30:19 + | +LL | _ => {dbg!(1)} + | ^^^^^^^ expected `()`, found integer + | + = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you might have meant to return this value + | +LL | _ => {return dbg!(1)} + | ++++++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs index 11126dbc65d..1cd6d13d56b 100644 --- a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs +++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs @@ -4,29 +4,29 @@ fn main() {} fn f1_1(x: isize, ...) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn f1_2(...) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg extern "C" fn f2_1(x: isize, ...) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg extern "C" fn f2_2(...) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg extern "C" fn f2_3(..., x: isize) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function extern "C" fn f3_1(x: isize, ...) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg extern "C" fn f3_2(...) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg extern "C" fn f3_3(..., x: isize) {} -//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function const unsafe extern "C" fn f4_1(x: isize, ...) {} @@ -35,12 +35,12 @@ const unsafe extern "C" fn f4_1(x: isize, ...) {} const extern "C" fn f4_2(x: isize, ...) {} //~^ ERROR functions cannot be both `const` and C-variadic -//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~| ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time const extern "C" fn f4_3(..., x: isize, ...) {} //~^ ERROR functions cannot be both `const` and C-variadic -//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~| ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function extern "C" { @@ -52,34 +52,34 @@ struct X; impl X { fn i_f1(x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn i_f2(...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn i_f3(..., x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function fn i_f4(..., x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function const fn i_f5(x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR functions cannot be both `const` and C-variadic //~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time } trait T { fn t_f1(x: isize, ...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn t_f2(x: isize, ...); - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn t_f3(...) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn t_f4(...); - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg fn t_f5(..., x: isize) {} - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function fn t_f6(..., x: isize); - //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg //~| ERROR `...` must be the last argument of a C-variadic function } diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr index f71e3863440..b740cef0200 100644 --- a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr +++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr @@ -1,22 +1,22 @@ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:6:19 | LL | fn f1_1(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:9:9 | LL | fn f1_2(...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:12:30 | LL | extern "C" fn f2_1(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:15:20 | LL | extern "C" fn f2_2(...) {} @@ -28,19 +28,19 @@ error: `...` must be the last argument of a C-variadic function LL | extern "C" fn f2_3(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:18:20 | LL | extern "C" fn f2_3(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:22:30 | LL | extern "C" fn f3_1(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:25:20 | LL | extern "C" fn f3_2(...) {} @@ -52,7 +52,7 @@ error: `...` must be the last argument of a C-variadic function LL | extern "C" fn f3_3(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:28:20 | LL | extern "C" fn f3_3(..., x: isize) {} @@ -70,7 +70,7 @@ error: functions cannot be both `const` and C-variadic LL | const extern "C" fn f4_2(x: isize, ...) {} | ^^^^^ `const` because of this ^^^ C-variadic because of this -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:36:36 | LL | const extern "C" fn f4_2(x: isize, ...) {} @@ -91,7 +91,7 @@ LL | const extern "C" fn f4_3(..., x: isize, ...) {} | | C-variadic because of this | `const` because of this -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:41:26 | LL | const extern "C" fn f4_3(..., x: isize, ...) {} @@ -103,13 +103,13 @@ error: `...` must be the last argument of a C-variadic function LL | fn e_f2(..., x: isize); | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:54:23 | LL | fn i_f1(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:56:13 | LL | fn i_f2(...) {} @@ -121,7 +121,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn i_f3(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:58:13 | LL | fn i_f3(..., x: isize, ...) {} @@ -133,7 +133,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn i_f4(..., x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:61:13 | LL | fn i_f4(..., x: isize, ...) {} @@ -147,31 +147,31 @@ LL | const fn i_f5(x: isize, ...) {} | | | `const` because of this -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:64:29 | LL | const fn i_f5(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:71:23 | LL | fn t_f1(x: isize, ...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:73:23 | LL | fn t_f2(x: isize, ...); | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:75:13 | LL | fn t_f3(...) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:77:13 | LL | fn t_f4(...); @@ -183,7 +183,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn t_f5(..., x: isize) {} | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:79:13 | LL | fn t_f5(..., x: isize) {} @@ -195,7 +195,7 @@ error: `...` must be the last argument of a C-variadic function LL | fn t_f6(..., x: isize); | ^^^ -error: only foreign or `unsafe extern "C"` functions may be C-variadic +error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg --> $DIR/variadic-ffi-semantic-restrictions.rs:82:13 | LL | fn t_f6(..., x: isize); diff --git a/tests/ui/pattern/usefulness/floats.rs b/tests/ui/pattern/usefulness/floats.rs index b3d49ba8e15..0b27e33e4ef 100644 --- a/tests/ui/pattern/usefulness/floats.rs +++ b/tests/ui/pattern/usefulness/floats.rs @@ -1,4 +1,6 @@ #![deny(unreachable_patterns)] +#![feature(f128)] +#![feature(f16)] fn main() { match 0.0 { @@ -11,6 +13,32 @@ fn main() { 0.0..=1.0 => {} } + match 1.0f16 { + 0.01f16..=6.5f16 => {} + 0.01f16 => {} //~ ERROR unreachable pattern + 0.02f16 => {} //~ ERROR unreachable pattern + 6.5f16 => {} //~ ERROR unreachable pattern + _ => {} + }; + match 1.0f16 { + 0.01f16..6.5f16 => {} + 6.5f16 => {} // this is reachable + _ => {} + }; + + match 1.0f32 { + 0.01f32..=6.5f32 => {} + 0.01f32 => {} //~ ERROR unreachable pattern + 0.02f32 => {} //~ ERROR unreachable pattern + 6.5f32 => {} //~ ERROR unreachable pattern + _ => {} + }; + match 1.0f32 { + 0.01f32..6.5f32 => {} + 6.5f32 => {} // this is reachable + _ => {} + }; + match 1.0f64 { 0.01f64..=6.5f64 => {} 0.005f64 => {} @@ -28,16 +56,20 @@ fn main() { _ => {} }; - match 1.0f32 { - 0.01f32..=6.5f32 => {} - 0.01f32 => {} //~ ERROR unreachable pattern - 0.02f32 => {} //~ ERROR unreachable pattern - 6.5f32 => {} //~ ERROR unreachable pattern + match 1.0f128 { + 0.01f128..=6.5f128 => {} + 0.005f128 => {} + 0.01f128 => {} //~ ERROR unreachable pattern + 0.02f128 => {} //~ ERROR unreachable pattern + 6.5f128 => {} //~ ERROR unreachable pattern + 6.6f128 => {} + 1.0f128..=4.0f128 => {} //~ ERROR unreachable pattern + 5.0f128..=7.0f128 => {} _ => {} }; - match 1.0f32 { - 0.01f32..6.5f32 => {} - 6.5f32 => {} // this is reachable + match 1.0f128 { + 0.01f128..6.5f128 => {} + 6.5f128 => {} // this is reachable _ => {} }; } diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index 04f2fe3cd94..684f6c93a16 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/floats.rs:9:11 + --> $DIR/floats.rs:11:11 | LL | match 0.0 { | ^^^ pattern `_` not covered @@ -12,9 +12,9 @@ LL + _ => todo!() | error: unreachable pattern - --> $DIR/floats.rs:17:9 + --> $DIR/floats.rs:18:9 | -LL | 0.01f64 => {} +LL | 0.01f16 => {} | ^^^^^^^ | note: the lint level is defined here @@ -24,41 +24,83 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:18:9 + --> $DIR/floats.rs:19:9 + | +LL | 0.02f16 => {} + | ^^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:20:9 + | +LL | 6.5f16 => {} + | ^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:31:9 + | +LL | 0.01f32 => {} + | ^^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:32:9 + | +LL | 0.02f32 => {} + | ^^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:33:9 + | +LL | 6.5f32 => {} + | ^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:45:9 + | +LL | 0.01f64 => {} + | ^^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:46:9 | LL | 0.02f64 => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:19:9 + --> $DIR/floats.rs:47:9 | LL | 6.5f64 => {} | ^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:21:9 + --> $DIR/floats.rs:49:9 | LL | 1.0f64..=4.0f64 => {} | ^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:33:9 + --> $DIR/floats.rs:62:9 | -LL | 0.01f32 => {} - | ^^^^^^^ +LL | 0.01f128 => {} + | ^^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:34:9 + --> $DIR/floats.rs:63:9 | -LL | 0.02f32 => {} +LL | 0.02f128 => {} + | ^^^^^^^^ + +error: unreachable pattern + --> $DIR/floats.rs:64:9 + | +LL | 6.5f128 => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:35:9 + --> $DIR/floats.rs:66:9 | -LL | 6.5f32 => {} - | ^^^^^^ +LL | 1.0f128..=4.0f128 => {} + | ^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs new file mode 100644 index 00000000000..c6f9115cde7 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs @@ -0,0 +1,9 @@ +#![deny(rust_2024_compatibility)] +#![feature(unsafe_attributes)] + +#[no_mangle] +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +extern "C" fn foo() {} + +fn main() {} diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr new file mode 100644 index 00000000000..f0689d9883c --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr @@ -0,0 +1,21 @@ +error: unsafe attribute used without unsafe + --> $DIR/in_2024_compatibility.rs:4:3 + | +LL | #[no_mangle] + | ^^^^^^^^^ usage of unsafe attribute + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> +note: the lint level is defined here + --> $DIR/in_2024_compatibility.rs:1:9 + | +LL | #![deny(rust_2024_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[deny(unsafe_attr_outside_unsafe)]` implied by `#[deny(rust_2024_compatibility)]` +help: wrap the attribute in `unsafe(...)` + | +LL | #[unsafe(no_mangle)] + | +++++++ + + +error: aborting due to 1 previous error + diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs new file mode 100644 index 00000000000..279ced2525a --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs @@ -0,0 +1,12 @@ +//@ revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 +//@[edition2024] compile-flags: -Zunstable-options +//@ check-pass + +#![feature(unsafe_attributes)] + +#[unsafe(no_mangle)] +extern "C" fn foo() {} + +fn main() {} diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed new file mode 100644 index 00000000000..6ebdff0334c --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed @@ -0,0 +1,61 @@ +//@ run-rustfix +#![feature(unsafe_attributes)] +#![deny(unsafe_attr_outside_unsafe)] + +macro_rules! tt { + ($e:tt) => { + #$e + extern fn foo() {} + } +} + +macro_rules! ident { + ($e:ident) => { + #[unsafe($e)] + //~^ ERROR: unsafe attribute used without unsafe + //~| WARN this is accepted in the current edition + extern fn bar() {} + } +} + +macro_rules! ident2 { + ($e:ident, $l:literal) => { + #[unsafe($e = $l)] + //~^ ERROR: unsafe attribute used without unsafe + //~| WARN this is accepted in the current edition + extern fn bars() {} + } +} + +macro_rules! meta { + ($m:meta) => { + #[$m] + extern fn baz() {} + } +} + +macro_rules! meta2 { + ($m:meta) => { + #[$m] + extern fn baw() {} + } +} + +tt!([unsafe(no_mangle)]); +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +ident!(no_mangle); +meta!(unsafe(no_mangle)); +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +meta2!(unsafe(export_name = "baw")); +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +ident2!(export_name, "bars"); + +#[unsafe(no_mangle)] +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +extern "C" fn one() {} + +fn main() {} diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs new file mode 100644 index 00000000000..c78ff45ea4c --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs @@ -0,0 +1,61 @@ +//@ run-rustfix +#![feature(unsafe_attributes)] +#![deny(unsafe_attr_outside_unsafe)] + +macro_rules! tt { + ($e:tt) => { + #$e + extern fn foo() {} + } +} + +macro_rules! ident { + ($e:ident) => { + #[$e] + //~^ ERROR: unsafe attribute used without unsafe + //~| WARN this is accepted in the current edition + extern fn bar() {} + } +} + +macro_rules! ident2 { + ($e:ident, $l:literal) => { + #[$e = $l] + //~^ ERROR: unsafe attribute used without unsafe + //~| WARN this is accepted in the current edition + extern fn bars() {} + } +} + +macro_rules! meta { + ($m:meta) => { + #[$m] + extern fn baz() {} + } +} + +macro_rules! meta2 { + ($m:meta) => { + #[$m] + extern fn baw() {} + } +} + +tt!([no_mangle]); +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +ident!(no_mangle); +meta!(no_mangle); +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +meta2!(export_name = "baw"); +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +ident2!(export_name, "bars"); + +#[no_mangle] +//~^ ERROR: unsafe attribute used without unsafe +//~| WARN this is accepted in the current edition +extern "C" fn one() {} + +fn main() {} diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr new file mode 100644 index 00000000000..c95984f58ec --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr @@ -0,0 +1,93 @@ +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes-fix.rs:44:6 + | +LL | tt!([no_mangle]); + | ^^^^^^^^^ usage of unsafe attribute + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> +note: the lint level is defined here + --> $DIR/unsafe-attributes-fix.rs:3:9 + | +LL | #![deny(unsafe_attr_outside_unsafe)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: wrap the attribute in `unsafe(...)` + | +LL | tt!([unsafe(no_mangle)]); + | +++++++ + + +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes-fix.rs:14:11 + | +LL | #[$e] + | ^^ usage of unsafe attribute +... +LL | ident!(no_mangle); + | ----------------- in this macro invocation + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> + = note: this error originates in the macro `ident` (in Nightly builds, run with -Z macro-backtrace for more info) +help: wrap the attribute in `unsafe(...)` + | +LL | #[unsafe($e)] + | +++++++ + + +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes-fix.rs:48:7 + | +LL | meta!(no_mangle); + | ^^^^^^^^^ usage of unsafe attribute + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> +help: wrap the attribute in `unsafe(...)` + | +LL | meta!(unsafe(no_mangle)); + | +++++++ + + +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes-fix.rs:51:8 + | +LL | meta2!(export_name = "baw"); + | ^^^^^^^^^^^ usage of unsafe attribute + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> +help: wrap the attribute in `unsafe(...)` + | +LL | meta2!(unsafe(export_name = "baw")); + | +++++++ + + +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes-fix.rs:23:11 + | +LL | #[$e = $l] + | ^^ usage of unsafe attribute +... +LL | ident2!(export_name, "bars"); + | ---------------------------- in this macro invocation + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> + = note: this error originates in the macro `ident2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: wrap the attribute in `unsafe(...)` + | +LL | #[unsafe($e = $l)] + | +++++++ + + +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes-fix.rs:56:3 + | +LL | #[no_mangle] + | ^^^^^^^^^ usage of unsafe attribute + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> +help: wrap the attribute in `unsafe(...)` + | +LL | #[unsafe(no_mangle)] + | +++++++ + + +error: aborting due to 6 previous errors + diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr new file mode 100644 index 00000000000..35475d66716 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr @@ -0,0 +1,13 @@ +error: unsafe attribute used without unsafe + --> $DIR/unsafe-attributes.rs:9:3 + | +LL | #[no_mangle] + | ^^^^^^^^^ usage of unsafe attribute + | +help: wrap the attribute in `unsafe(...)` + | +LL | #[unsafe(no_mangle)] + | +++++++ + + +error: aborting due to 1 previous error + diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs new file mode 100644 index 00000000000..3a6af9dfb2b --- /dev/null +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs @@ -0,0 +1,12 @@ +//@ revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2021] check-pass +//@[edition2024] edition:2024 +//@[edition2024] compile-flags: -Zunstable-options + +#![feature(unsafe_attributes)] + +#[no_mangle] //[edition2024]~ ERROR: unsafe attribute used without unsafe +extern "C" fn foo() {} + +fn main() {} diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr index 3f8011d961a..6bbd81ae3e1 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr @@ -9,15 +9,11 @@ LL | const _: *const Foo = 0 as _; | ^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0080]: it is undefined behavior to use this value +error[E0080]: evaluation of constant value failed --> $DIR/stack-overflow-trait-infer-98842.rs:15:1 | LL | const _: *const Foo = 0 as _; | ^^^^^^^^^^^^^^^^^^^ a cycle occurred during layout computation - | - = note: the raw bytes of the constant (size: 4, align: 4) { - 00 00 00 00 │ .... - } error: aborting due to 2 previous errors diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr index 04e2c4483bf..6bbd81ae3e1 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr @@ -9,15 +9,11 @@ LL | const _: *const Foo = 0 as _; | ^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0080]: it is undefined behavior to use this value +error[E0080]: evaluation of constant value failed --> $DIR/stack-overflow-trait-infer-98842.rs:15:1 | LL | const _: *const Foo = 0 as _; | ^^^^^^^^^^^^^^^^^^^ a cycle occurred during layout computation - | - = note: the raw bytes of the constant (size: 8, align: 8) { - 00 00 00 00 00 00 00 00 │ ........ - } error: aborting due to 2 previous errors diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.rs b/tests/ui/sized/stack-overflow-trait-infer-98842.rs index 54d50346cc8..be4807b2e4a 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.rs +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.rs @@ -13,6 +13,6 @@ struct Foo(<&'static Foo as ::core::ops::Deref>::Target); // and it will infinitely recurse somewhere trying to figure out the // size of this pointer (is my guess): const _: *const Foo = 0 as _; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed pub fn main() {} diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.stderr deleted file mode 100644 index 8ddddeb5bf2..00000000000 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0391]: cycle detected when computing layout of `Foo` - | - = note: ...which requires computing layout of `<&'static Foo as core::ops::deref::Deref>::Target`... - = note: ...which again requires computing layout of `Foo`, completing the cycle -note: cycle used when const-evaluating + checking `_` - --> $DIR/stack-overflow-trait-infer-98842.rs:13:1 - | -LL | const _: *const Foo = 0 as _; - | ^^^^^^^^^^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error[E0080]: it is undefined behavior to use this value - --> $DIR/stack-overflow-trait-infer-98842.rs:13:1 - | -LL | const _: *const Foo = 0 as _; - | ^^^^^^^^^^^^^^^^^^^ a cycle occurred during layout computation - | - = note: the raw bytes of the constant (size: 8, align: 8) { - 00 00 00 00 00 00 00 00 │ ........ - } - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0080, E0391. -For more information about an error, try `rustc --explain E0080`. |
