diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2024-10-22 05:07:39 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2024-10-22 05:07:39 +0000 |
| commit | 865acc2e83dba0ac601aab19a41f769126b396a7 (patch) | |
| tree | 0f4df924e413618b03d4eba03fe65c2aeeae4696 /tests | |
| parent | 499820a494fcd739a7c3d3f2ee2f8e4c0aff7a03 (diff) | |
| parent | 814df6e50eaf89b90793e7d9618bb60f1f18377a (diff) | |
| download | rust-865acc2e83dba0ac601aab19a41f769126b396a7.tar.gz rust-865acc2e83dba0ac601aab19a41f769126b396a7.zip | |
Merge from rustc
Diffstat (limited to 'tests')
53 files changed, 510 insertions, 603 deletions
diff --git a/tests/codegen/atomicptr.rs b/tests/codegen/atomicptr.rs index ea8b382c8fc..e8c5e6a6749 100644 --- a/tests/codegen/atomicptr.rs +++ b/tests/codegen/atomicptr.rs @@ -6,7 +6,6 @@ //@ compile-flags: -O -Cno-prepopulate-passes #![crate_type = "lib"] -#![feature(strict_provenance)] #![feature(strict_provenance_atomic_ptr)] use std::ptr::without_provenance_mut; diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs index d4a74b3d782..122f02fbbc5 100644 --- a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs +++ b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs @@ -1,7 +1,6 @@ //@ compile-flags: -O -C debug-assertions=yes #![crate_type = "lib"] -#![feature(strict_provenance)] #[no_mangle] pub fn test(src: *const u8, dst: *const u8) -> usize { diff --git a/tests/debuginfo/constant-ordering-prologue.rs b/tests/debuginfo/constant-ordering-prologue.rs index f2d4fd37ce3..3136aff238a 100644 --- a/tests/debuginfo/constant-ordering-prologue.rs +++ b/tests/debuginfo/constant-ordering-prologue.rs @@ -20,11 +20,11 @@ // lldb-command:run // lldb-command:print a -// lldb-check: = 19 +// lldb-check: 19 // lldb-command:print b -// lldb-check: = 20 +// lldb-check: 20 // lldb-command:print c -// lldb-check: = 21.5 +// lldb-check: 21.5 fn binding(a: i64, b: u64, c: f64) { let x = 0; diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs index 4e6fb71bf75..85eded09980 100644 --- a/tests/mir-opt/dest-prop/union.rs +++ b/tests/mir-opt/dest-prop/union.rs @@ -1,4 +1,3 @@ -// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //! Tests that we can propagate into places that are projections into unions //@ compile-flags: -Zunsound-mir-opts -C debuginfo=full @@ -8,7 +7,7 @@ fn val() -> u32 { // EMIT_MIR union.main.DestinationPropagation.diff fn main() { - // CHECK-LABEL: fn args( + // CHECK-LABEL: fn main( // CHECK: {{_.*}} = Un { us: const 1_u32 }; union Un { us: u32, diff --git a/tests/mir-opt/gvn_ptr_eq_with_constant.rs b/tests/mir-opt/gvn_ptr_eq_with_constant.rs index d8025072ee3..05445208e07 100644 --- a/tests/mir-opt/gvn_ptr_eq_with_constant.rs +++ b/tests/mir-opt/gvn_ptr_eq_with_constant.rs @@ -5,8 +5,6 @@ // Regression for <https://github.com/rust-lang/rust/issues/127089> -#![feature(strict_provenance)] - struct Foo<T>(std::marker::PhantomData<T>); impl<T> Foo<T> { diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs index 5c06b7e56f7..9024dc976e4 100644 --- a/tests/mir-opt/issues/issue_59352.rs +++ b/tests/mir-opt/issues/issue_59352.rs @@ -1,4 +1,3 @@ -// skip-filecheck // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // This test is a mirror of codegen/issue-59352.rs. // The LLVM inliner doesn't inline `char::method::is_digit()` and so it doesn't recognize this case diff --git a/tests/run-make/rustc-crates-on-stable/rmake.rs b/tests/run-make/rustc-crates-on-stable/rmake.rs index 81cc775c919..9fbc675cc9a 100644 --- a/tests/run-make/rustc-crates-on-stable/rmake.rs +++ b/tests/run-make/rustc-crates-on-stable/rmake.rs @@ -31,6 +31,10 @@ fn main() { "rustc_pattern_analysis", "-p", "rustc_lexer", + "-p", + "rustc_abi", + "-p", + "rustc_parse_format", ]) .run(); } diff --git a/tests/rustdoc/impossible-default.rs b/tests/rustdoc/impossible-default.rs index fad64068010..c9444004d5c 100644 --- a/tests/rustdoc/impossible-default.rs +++ b/tests/rustdoc/impossible-default.rs @@ -18,3 +18,11 @@ pub trait Foo { pub struct Bar([u8]); impl Foo for Bar {} + +//@ has foo/struct.Generic.html '//*[@id="method.needs_sized"]//h4[@class="code-header"]' \ +// "fn needs_sized" +//@ has foo/struct.Generic.html '//*[@id="method.no_needs_sized"]//h4[@class="code-header"]' \ +// "fn no_needs_sized" +pub struct Generic<T: ?Sized>(T); + +impl<T: ?Sized> Foo for Generic<T> {} diff --git a/tests/ui/argument-suggestions/issue-109425.fixed b/tests/ui/argument-suggestions/issue-109425.fixed index 5d96f457c88..4b3aaa46d86 100644 --- a/tests/ui/argument-suggestions/issue-109425.fixed +++ b/tests/ui/argument-suggestions/issue-109425.fixed @@ -15,6 +15,10 @@ fn main() { //~^ error: this function takes 1 argument but 3 arguments were supplied is(0, ""); // is(0, "") //~^ error: this function takes 2 arguments but 4 arguments were supplied + is(1, ""); + //~^ error: this function takes 2 arguments but 4 arguments were supplied + is(1, ""); + //~^ error: this function takes 2 arguments but 4 arguments were supplied s(""); // s("") //~^ error: this function takes 1 argument but 3 arguments were supplied } diff --git a/tests/ui/argument-suggestions/issue-109425.rs b/tests/ui/argument-suggestions/issue-109425.rs index bb9d37ee0ff..56816681337 100644 --- a/tests/ui/argument-suggestions/issue-109425.rs +++ b/tests/ui/argument-suggestions/issue-109425.rs @@ -15,6 +15,10 @@ fn main() { //~^ error: this function takes 1 argument but 3 arguments were supplied is(0, 1, 2, ""); // is(0, "") //~^ error: this function takes 2 arguments but 4 arguments were supplied + is((), 1, "", ()); + //~^ error: this function takes 2 arguments but 4 arguments were supplied + is(1, (), "", ()); + //~^ error: this function takes 2 arguments but 4 arguments were supplied s(0, 1, ""); // s("") //~^ error: this function takes 1 argument but 3 arguments were supplied } diff --git a/tests/ui/argument-suggestions/issue-109425.stderr b/tests/ui/argument-suggestions/issue-109425.stderr index bfe007793d4..2cd53ed528e 100644 --- a/tests/ui/argument-suggestions/issue-109425.stderr +++ b/tests/ui/argument-suggestions/issue-109425.stderr @@ -74,9 +74,47 @@ LL - is(0, 1, 2, ""); // is(0, "") LL + is(0, ""); // is(0, "") | -error[E0061]: this function takes 1 argument but 3 arguments were supplied +error[E0061]: this function takes 2 arguments but 4 arguments were supplied --> $DIR/issue-109425.rs:18:5 | +LL | is((), 1, "", ()); + | ^^ -- -- unexpected argument #4 of type `()` + | | + | unexpected argument #1 of type `()` + | +note: function defined here + --> $DIR/issue-109425.rs:5:4 + | +LL | fn is(_: u32, _: &str) {} + | ^^ ------ ------- +help: remove the extra arguments + | +LL - is((), 1, "", ()); +LL + is(1, ""); + | + +error[E0061]: this function takes 2 arguments but 4 arguments were supplied + --> $DIR/issue-109425.rs:20:5 + | +LL | is(1, (), "", ()); + | ^^ -- -- unexpected argument #4 of type `()` + | | + | unexpected argument #2 of type `()` + | +note: function defined here + --> $DIR/issue-109425.rs:5:4 + | +LL | fn is(_: u32, _: &str) {} + | ^^ ------ ------- +help: remove the extra arguments + | +LL - is(1, (), "", ()); +LL + is(1, ""); + | + +error[E0061]: this function takes 1 argument but 3 arguments were supplied + --> $DIR/issue-109425.rs:22:5 + | LL | s(0, 1, ""); // s("") | ^ - - unexpected argument #2 of type `{integer}` | | @@ -93,6 +131,6 @@ LL - s(0, 1, ""); // s("") LL + s(""); // s("") | -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/argument-suggestions/issue-112507.stderr b/tests/ui/argument-suggestions/issue-112507.stderr index 908ed35c669..e2ea9af7dc2 100644 --- a/tests/ui/argument-suggestions/issue-112507.stderr +++ b/tests/ui/argument-suggestions/issue-112507.stderr @@ -18,8 +18,9 @@ LL | Float(Option<f64>), | ^^^^^ help: remove the extra arguments | -LL ~ , -LL ~ None); +LL - 0, +LL - None, +LL + None); | error: aborting due to 1 previous error diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs index 0c9df7ecd78..b2b4934aa5f 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs @@ -2,8 +2,6 @@ //@ compile-flags: -Copt-level=2 //@ run-pass -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs index b188b794d1f..bf130c9f759 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908 -#![feature(exposed_provenance)] - use std::ptr; fn f() -> usize { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs index 7f64e23b9c1..cdf07eade87 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(exposed_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs index 3417296ce12..f128e1bb084 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(exposed_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs index e1e9e3f46b8..0baf8886395 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs index 8d581e8c9e9..c7f46318aae 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs index 506f114cd2a..b163c282d93 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(exposed_provenance)] - use std::{ cell::{Ref, RefCell}, ptr, diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs index 603db5e08f4..7ccff8d0848 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs @@ -4,8 +4,6 @@ // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(exposed_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs index 0243c2bfe95..4602ec654d1 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs @@ -2,8 +2,6 @@ //@ compile-flags: -Copt-level=2 //@ run-pass -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs index 29758036a21..789a78c15b4 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1434203908 -#![feature(strict_provenance)] - use std::ptr; fn f() -> usize { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs index 11925261a65..5f4ee731f7d 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(strict_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs index e628bb90faa..0414879804a 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs @@ -4,8 +4,6 @@ // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 -#![feature(strict_provenance)] - use std::ptr; #[inline(never)] diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs index 075e3475a32..b7165ce1e5c 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs index 6d7b6fa33e0..a02ff30918d 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499 -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs index 67660d285a4..fea41e03612 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs @@ -4,8 +4,6 @@ // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(strict_provenance)] - use std::{ cell::{Ref, RefCell}, ptr, diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs index a89310f9930..d963e45e4cd 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs @@ -4,8 +4,6 @@ // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 -#![feature(strict_provenance)] - use std::ptr; fn main() { diff --git a/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs b/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs deleted file mode 100644 index dda317aecc3..00000000000 --- a/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs +++ /dev/null @@ -1,99 +0,0 @@ -#![allow(dead_code)] -#![deny(improper_ctypes)] -#![feature(ptr_internals)] - -use std::num; - -enum Z {} - -#[repr(transparent)] -struct TransparentStruct<T>(T, std::marker::PhantomData<Z>); - -#[repr(transparent)] -enum TransparentEnum<T> { - Variant(T, std::marker::PhantomData<Z>), -} - -struct NoField; - -extern "C" { - fn result_ref_t(x: Result<&'static u8, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_fn_t(x: Result<extern "C" fn(), ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); - //~^ ERROR `extern` block uses type `Result - fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); - //~^ ERROR `extern` block uses type `Result - fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>); - //~^ ERROR `extern` block uses type `Result - fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>); - //~^ ERROR `extern` block uses type `Result - - fn result_ref_e(x: Result<(), &'static u8>); - //~^ ERROR `extern` block uses type `Result - fn result_fn_e(x: Result<(), extern "C" fn()>); - //~^ ERROR `extern` block uses type `Result - fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>); - //~^ ERROR `extern` block uses type `Result - fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); - //~^ ERROR `extern` block uses type `Result - fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); - //~^ ERROR `extern` block uses type `Result - fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); - //~^ ERROR `extern` block uses type `Result - fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); - //~^ ERROR `extern` block uses type `Result - fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); - //~^ ERROR `extern` block uses type `Result - fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>); - //~^ ERROR `extern` block uses type `Result - fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>); - //~^ ERROR `extern` block uses type `Result -} - -pub fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.stderr b/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.stderr deleted file mode 100644 index 94416eb99c8..00000000000 --- a/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.stderr +++ /dev/null @@ -1,349 +0,0 @@ -error: `extern` block uses type `Result<&u8, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:20:24 - | -LL | fn result_ref_t(x: Result<&'static u8, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint -note: the lint level is defined here - --> $DIR/feature-gate-result_ffi_guarantees.rs:2:9 - | -LL | #![deny(improper_ctypes)] - | ^^^^^^^^^^^^^^^ - -error: `extern` block uses type `Result<extern "C" fn(), ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:22:23 - | -LL | fn result_fn_t(x: Result<extern "C" fn(), ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonNull<u8>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:24:28 - | -LL | fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<Unique<u8>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:26:27 - | -LL | fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u8>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:28:31 - | -LL | fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u16>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:30:32 - | -LL | fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u32>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:32:32 - | -LL | fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u64>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:34:32 - | -LL | fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<usize>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:36:34 - | -LL | fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<i8>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:38:31 - | -LL | fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<i16>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:40:32 - | -LL | fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<i32>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:42:32 - | -LL | fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<i64>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:44:32 - | -LL | fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<isize>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:46:34 - | -LL | fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<TransparentStruct<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:48:39 - | -LL | fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<TransparentEnum<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:50:37 - | -LL | fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u8>, PhantomData<()>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:52:28 - | -LL | fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u8>, Z>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:54:47 - | -LL | fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u8>, NoField>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:56:45 - | -LL | fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), &u8>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:59:24 - | -LL | fn result_ref_e(x: Result<(), &'static u8>); - | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), extern "C" fn()>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:61:23 - | -LL | fn result_fn_e(x: Result<(), extern "C" fn()>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonNull<u8>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:63:28 - | -LL | fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), Unique<u8>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:65:27 - | -LL | fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<u8>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:67:31 - | -LL | fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<u16>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:69:32 - | -LL | fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<u32>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:71:32 - | -LL | fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<u64>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:73:32 - | -LL | fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<usize>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:75:34 - | -LL | fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<i8>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:77:31 - | -LL | fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<i16>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:79:32 - | -LL | fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:81:32 - | -LL | fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<i64>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:83:32 - | -LL | fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), NonZero<isize>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:85:34 - | -LL | fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), TransparentStruct<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:87:39 - | -LL | fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<(), TransparentEnum<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:89:37 - | -LL | fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NonZero<u8>, PhantomData<()>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:91:28 - | -LL | fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<Z, NonZero<u8>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:93:47 - | -LL | fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: `extern` block uses type `Result<NoField, NonZero<u8>>`, which is not FFI-safe - --> $DIR/feature-gate-result_ffi_guarantees.rs:95:45 - | -LL | fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - -error: aborting due to 38 previous errors - diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance.rs b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.rs index 738c8daa168..738c8daa168 100644 --- a/tests/ui/feature-gates/feature-gate-strict_provenance.rs +++ b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.rs diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr index 82078d576ad..15428cbd4be 100644 --- a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr +++ b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr @@ -1,24 +1,24 @@ warning: unknown lint: `fuzzy_provenance_casts` - --> $DIR/feature-gate-strict_provenance.rs:3:1 + --> $DIR/feature-gate-strict_provenance_lints.rs:3:1 | LL | #![deny(fuzzy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `fuzzy_provenance_casts` lint is unstable - = note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information - = help: add `#![feature(strict_provenance)]` to the crate attributes to enable + = note: see issue #130351 <https://github.com/rust-lang/rust/issues/130351> for more information + = help: add `#![feature(strict_provenance_lints)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `lossy_provenance_casts` - --> $DIR/feature-gate-strict_provenance.rs:5:1 + --> $DIR/feature-gate-strict_provenance_lints.rs:5:1 | LL | #![deny(lossy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `lossy_provenance_casts` lint is unstable - = note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information - = help: add `#![feature(strict_provenance)]` to the crate attributes to enable + = note: see issue #130351 <https://github.com/rust-lang/rust/issues/130351> for more information + = help: add `#![feature(strict_provenance_lints)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: 2 warnings emitted diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs index cb8e9e80675..19af1de9576 100644 --- a/tests/ui/lint/lint-ctypes-enum.rs +++ b/tests/ui/lint/lint-ctypes-enum.rs @@ -2,7 +2,6 @@ #![deny(improper_ctypes)] #![feature(ptr_internals)] #![feature(transparent_unions)] -#![feature(result_ffi_guarantees)] use std::num; diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index bba5b09b69c..8e92e7e6946 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -1,5 +1,5 @@ error: `extern` block uses type `U`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:69:14 + --> $DIR/lint-ctypes-enum.rs:68:14 | LL | fn uf(x: U); | ^ not FFI-safe @@ -7,7 +7,7 @@ LL | fn uf(x: U); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:10:1 + --> $DIR/lint-ctypes-enum.rs:9:1 | LL | enum U { | ^^^^^^ @@ -18,7 +18,7 @@ LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ error: `extern` block uses type `B`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:70:14 + --> $DIR/lint-ctypes-enum.rs:69:14 | LL | fn bf(x: B); | ^ not FFI-safe @@ -26,13 +26,13 @@ LL | fn bf(x: B); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:13:1 + --> $DIR/lint-ctypes-enum.rs:12:1 | LL | enum B { | ^^^^^^ error: `extern` block uses type `T`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:71:14 + --> $DIR/lint-ctypes-enum.rs:70:14 | LL | fn tf(x: T); | ^ not FFI-safe @@ -40,13 +40,13 @@ LL | fn tf(x: T); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:17:1 + --> $DIR/lint-ctypes-enum.rs:16:1 | LL | enum T { | ^^^^^^ error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:83:31 + --> $DIR/lint-ctypes-enum.rs:82:31 | LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -54,7 +54,7 @@ LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:90:31 + --> $DIR/lint-ctypes-enum.rs:89:31 | LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -62,7 +62,7 @@ LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:95:36 + --> $DIR/lint-ctypes-enum.rs:94:36 | LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -71,7 +71,7 @@ LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8> = note: enum has no representation hint error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:97:28 + --> $DIR/lint-ctypes-enum.rs:96:28 | LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -80,7 +80,7 @@ LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:107:33 + --> $DIR/lint-ctypes-enum.rs:106:33 | LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -88,7 +88,7 @@ LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:114:33 + --> $DIR/lint-ctypes-enum.rs:113:33 | LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -96,7 +96,7 @@ LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:119:38 + --> $DIR/lint-ctypes-enum.rs:118:38 | LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -105,7 +105,7 @@ LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u = note: enum has no representation hint error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:121:30 + --> $DIR/lint-ctypes-enum.rs:120:30 | LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -114,7 +114,7 @@ LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:125:51 + --> $DIR/lint-ctypes-enum.rs:124:51 | LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -123,7 +123,7 @@ LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:127:53 + --> $DIR/lint-ctypes-enum.rs:126:53 | LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -132,7 +132,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8> = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:129:51 + --> $DIR/lint-ctypes-enum.rs:128:51 | LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -141,7 +141,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:132:49 + --> $DIR/lint-ctypes-enum.rs:131:49 | LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -150,7 +150,7 @@ LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Fi = note: enum has no representation hint error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:134:30 + --> $DIR/lint-ctypes-enum.rs:133:30 | LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -159,7 +159,7 @@ LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); = note: enum has no representation hint error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:145:33 + --> $DIR/lint-ctypes-enum.rs:144:33 | LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -167,7 +167,7 @@ LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:152:33 + --> $DIR/lint-ctypes-enum.rs:151:33 | LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -175,7 +175,7 @@ LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:157:38 + --> $DIR/lint-ctypes-enum.rs:156:38 | LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -184,7 +184,7 @@ LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZe = note: enum has no representation hint error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:159:30 + --> $DIR/lint-ctypes-enum.rs:158:30 | LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -193,7 +193,7 @@ LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:163:51 + --> $DIR/lint-ctypes-enum.rs:162:51 | LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -202,7 +202,7 @@ LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8 = note: enum has no representation hint error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:165:53 + --> $DIR/lint-ctypes-enum.rs:164:53 | LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -211,7 +211,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero< = note: enum has no representation hint error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:167:51 + --> $DIR/lint-ctypes-enum.rs:166:51 | LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -220,7 +220,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num = note: enum has no representation hint error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:170:49 + --> $DIR/lint-ctypes-enum.rs:169:49 | LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -229,7 +229,7 @@ LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero< = note: enum has no representation hint error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:172:30 + --> $DIR/lint-ctypes-enum.rs:171:30 | LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -238,7 +238,7 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:174:27 + --> $DIR/lint-ctypes-enum.rs:173:27 | LL | fn result_unit_t_e(x: Result<(), ()>); | ^^^^^^^^^^^^^^ not FFI-safe diff --git a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs index d2d72a68f13..187209d4e20 100644 --- a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs +++ b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.rs @@ -1,4 +1,4 @@ -#![feature(strict_provenance)] +#![feature(strict_provenance_lints)] #![deny(fuzzy_provenance_casts)] fn main() { diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.rs b/tests/ui/lint/lint-strict-provenance-lossy-casts.rs index 9799a053756..395dc75f825 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.rs +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.rs @@ -1,4 +1,4 @@ -#![feature(strict_provenance)] +#![feature(strict_provenance_lints)] #![deny(lossy_provenance_casts)] fn main() { diff --git a/tests/ui/lint/unit_bindings.deny_level.stderr b/tests/ui/lint/unit_bindings.deny_level.stderr new file mode 100644 index 00000000000..9062f2e5c1f --- /dev/null +++ b/tests/ui/lint/unit_bindings.deny_level.stderr @@ -0,0 +1,40 @@ +error: binding has unit type `()` + --> $DIR/unit_bindings.rs:50:5 + | +LL | let _ = expr; + | ^^^^-^^^^^^^^ + | | + | this pattern is inferred to be the unit type `()` + | +note: the lint level is defined here + --> $DIR/unit_bindings.rs:22:30 + | +LL | #![cfg_attr(deny_level, deny(unit_bindings))] + | ^^^^^^^^^^^^^ + +error: binding has unit type `()` + --> $DIR/unit_bindings.rs:51:5 + | +LL | let pat = expr; + | ^^^^---^^^^^^^^ + | | + | this pattern is inferred to be the unit type `()` + +error: binding has unit type `()` + --> $DIR/unit_bindings.rs:52:5 + | +LL | let _pat = expr; + | ^^^^----^^^^^^^^ + | | + | this pattern is inferred to be the unit type `()` + +error: binding has unit type `()` + --> $DIR/unit_bindings.rs:55:5 + | +LL | let list = v.sort(); + | ^^^^----^^^^^^^^^^^^ + | | + | this pattern is inferred to be the unit type `()` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/lint/unit_bindings.rs b/tests/ui/lint/unit_bindings.rs new file mode 100644 index 00000000000..9a682a2244c --- /dev/null +++ b/tests/ui/lint/unit_bindings.rs @@ -0,0 +1,60 @@ +//! Basic checks for `unit_bindings` lint. +//! +//! The `unit_bindings` lint tries to detect cases like `let list = list.sort()`. The lint will +//! trigger on bindings that have the unit `()` type **except** if: +//! +//! - The user wrote `()` on either side, i.e. +//! - `let () = <expr>;` or `let <expr> = ();` +//! - `let _ = ();` +//! - The binding occurs within macro expansions, e.g. `foo!();`. +//! - The user explicitly provided type annotations, e.g. `let x: () = <expr>`. +//! +//! Examples where the lint *should* fire on include: +//! +//! - `let _ = <expr>;` +//! - `let pat = <expr>;` +//! - `let _pat = <expr>;` + +//@ revisions: default_level deny_level +//@[default_level] check-pass (`unit_bindings` is currently allow-by-default) + +#![allow(unused)] +#![cfg_attr(deny_level, deny(unit_bindings))] + +// The `list` binding below should trigger the lint if it's not contained in a macro expansion. +macro_rules! expands_to_sus { + () => { + let mut v = [1, 2, 3]; + let list = v.sort(); + } +} + +// No warning for `y` and `z` because it is provided as type parameter. +fn ty_param_check<T: Copy>(x: T) { + let y = x; + let z: T = x; +} + +fn main() { + // No warning if user explicitly wrote `()` on either side. + let expr = (); + let () = expr; + let _ = (); + // No warning if user explicitly annotates the unit type on the binding. + let pat: () = expr; + // No warning for let bindings with unit type in macro expansions. + expands_to_sus!(); + // No warning for unit bindings in generic fns. + ty_param_check(()); + + let _ = expr; //[deny_level]~ ERROR binding has unit type + let pat = expr; //[deny_level]~ ERROR binding has unit type + let _pat = expr; //[deny_level]~ ERROR binding has unit type + + let mut v = [1, 2, 3]; + let list = v.sort(); //[deny_level]~ ERROR binding has unit type + + // Limitation: the lint currently does not fire on nested unit LHS bindings, i.e. + // this will not currently trigger the lint. + let (nested, _) = (expr, 0i32); +} diff --git a/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr b/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr index 936428f6a1c..d91af762e68 100644 --- a/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr +++ b/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr @@ -10,17 +10,17 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #3 of macro `num2` is never used - --> $DIR/unused-macro-rules-compile-error.rs:22:5 - | -LL | (two_) => { compile_error! }; - | ^^^^^^ - error: rule #2 of macro `num2` is never used --> $DIR/unused-macro-rules-compile-error.rs:20:5 | LL | (two) => { fn compile_error() {} }; | ^^^^^ +error: rule #3 of macro `num2` is never used + --> $DIR/unused-macro-rules-compile-error.rs:22:5 + | +LL | (two_) => { compile_error! }; + | ^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/lint/unused/unused-macro-rules-decl.stderr b/tests/ui/lint/unused/unused-macro-rules-decl.stderr index 10ceb3921f3..98f146c5b5b 100644 --- a/tests/ui/lint/unused/unused-macro-rules-decl.stderr +++ b/tests/ui/lint/unused/unused-macro-rules-decl.stderr @@ -1,8 +1,8 @@ -error: rule #4 of macro `num` is never used - --> $DIR/unused-macro-rules-decl.rs:11:5 +error: rule #2 of macro `num` is never used + --> $DIR/unused-macro-rules-decl.rs:9:5 | -LL | (four) => { 4 }, - | ^^^^^^ +LL | (two) => { 2 }, + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-macro-rules-decl.rs:2:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #2 of macro `num` is never used - --> $DIR/unused-macro-rules-decl.rs:9:5 +error: rule #4 of macro `num` is never used + --> $DIR/unused-macro-rules-decl.rs:11:5 | -LL | (two) => { 2 }, - | ^^^^^ +LL | (four) => { 4 }, + | ^^^^^^ error: rule #3 of macro `num_rec` is never used --> $DIR/unused-macro-rules-decl.rs:31:5 diff --git a/tests/ui/lint/unused/unused-macro-rules.stderr b/tests/ui/lint/unused/unused-macro-rules.stderr index b9258e77805..e50a8a63cea 100644 --- a/tests/ui/lint/unused/unused-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-macro-rules.stderr @@ -1,8 +1,8 @@ -error: rule #4 of macro `num` is never used - --> $DIR/unused-macro-rules.rs:10:5 +error: rule #2 of macro `num` is never used + --> $DIR/unused-macro-rules.rs:8:5 | -LL | (four) => { 4 }; - | ^^^^^^ +LL | (two) => { 2 }; + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-macro-rules.rs:1:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #2 of macro `num` is never used - --> $DIR/unused-macro-rules.rs:8:5 +error: rule #4 of macro `num` is never used + --> $DIR/unused-macro-rules.rs:10:5 | -LL | (two) => { 2 }; - | ^^^^^ +LL | (four) => { 4 }; + | ^^^^^^ error: rule #3 of macro `num_rec` is never used --> $DIR/unused-macro-rules.rs:30:5 diff --git a/tests/ui/mir/alignment/i686-pc-windows-msvc.rs b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs index 379f61ae818..c6b47a6d679 100644 --- a/tests/ui/mir/alignment/i686-pc-windows-msvc.rs +++ b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs @@ -7,8 +7,6 @@ // that will fail on dereferencing of a pointer to u64 which is not 8-byte-aligned but is // 4-byte-aligned. -#![feature(strict_provenance)] - fn main() { let mut x = [0u64; 2]; let ptr = x.as_mut_ptr(); diff --git a/tests/ui/mir/alignment/packed.rs b/tests/ui/mir/alignment/packed.rs index 1a12425f11a..cf908365e1a 100644 --- a/tests/ui/mir/alignment/packed.rs +++ b/tests/ui/mir/alignment/packed.rs @@ -1,8 +1,6 @@ //@ run-pass //@ compile-flags: -C debug-assertions -#![feature(strict_provenance)] - #[repr(packed)] struct Misaligner { _head: u8, diff --git a/tests/ui/rfcs/rfc-3391-result-ffi-guarantees.rs b/tests/ui/rfcs/rfc-3391-result-ffi-guarantees.rs new file mode 100644 index 00000000000..9b8092526b9 --- /dev/null +++ b/tests/ui/rfcs/rfc-3391-result-ffi-guarantees.rs @@ -0,0 +1,133 @@ +//@ build-pass +/*! + +The guarantees in RFC 3391 were strengthened as a result of the 2024 Oct 09 T-lang meeting[^1] +following the precedent of T-lang's guaranteeing[^2] ABI compatibility for "Option-like" enums[^2]. +We now guarantee ABI compatibility for enums that conform to these rules described by scottmcm: + +* The enum `E` has exactly two variants. +* One variant has exactly one field, of type `T`. +* `T` is a `rustc_nonnull_optimization_guaranteed` type. +* All fields of the other variant are 1-ZSTs. + +Where "all" fields includes "there aren't any fields, so they're vacuously all 1-ZSTs". + +Note: "1-ZST" means a type of size 0 and alignment 1. + +The reason alignment of the zero-sized type matters is it can affect the alignment of the enum, +which also will affect its size if the enum has a non-zero size. + +[^1]: <https://github.com/rust-lang/rust/pull/130628#issuecomment-2402761599> +[^2]: <https://github.com/rust-lang/rust/pull/60300#issuecomment-487000474> + +*/ + +#![allow(dead_code)] +#![deny(improper_ctypes)] +#![feature(ptr_internals)] + +use std::num; + +enum Z {} + +#[repr(transparent)] +struct TransparentStruct<T>(T, std::marker::PhantomData<Z>); + +#[repr(transparent)] +enum TransparentEnum<T> { + Variant(T, std::marker::PhantomData<Z>), +} + +struct NoField; + +extern "C" { + fn result_ref_t(x: Result<&'static u8, ()>); + fn result_fn_t(x: Result<extern "C" fn(), ()>); + fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>); + fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>); + fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>); + fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>); + fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); + fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); + fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); + fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); + fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); + fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); + fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); + fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); + fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); + fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); + fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>); + fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>); + + fn result_ref_e(x: Result<(), &'static u8>); + fn result_fn_e(x: Result<(), extern "C" fn()>); + fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>); + fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>); + fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>); + fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>); + fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); + fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); + fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); + fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); + fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); + fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); + fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); + fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); + fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); + fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); + fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>); + fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>); +} + +// Custom "Result-like" enum for testing custom "Option-like" types are also accepted +enum Either<L, R> { + Left(L), + Right(R), +} + +extern "C" { + fn either_ref_t(x: Either<&'static u8, ()>); + fn either_fn_t(x: Either<extern "C" fn(), ()>); + fn either_nonnull_t(x: Either<std::ptr::NonNull<u8>, ()>); + fn either_unique_t(x: Either<std::ptr::Unique<u8>, ()>); + fn either_nonzero_u8_t(x: Either<num::NonZero<u8>, ()>); + fn either_nonzero_u16_t(x: Either<num::NonZero<u16>, ()>); + fn either_nonzero_u32_t(x: Either<num::NonZero<u32>, ()>); + fn either_nonzero_u64_t(x: Either<num::NonZero<u64>, ()>); + fn either_nonzero_usize_t(x: Either<num::NonZero<usize>, ()>); + fn either_nonzero_i8_t(x: Either<num::NonZero<i8>, ()>); + fn either_nonzero_i16_t(x: Either<num::NonZero<i16>, ()>); + fn either_nonzero_i32_t(x: Either<num::NonZero<i32>, ()>); + fn either_nonzero_i64_t(x: Either<num::NonZero<i64>, ()>); + fn either_nonzero_isize_t(x: Either<num::NonZero<isize>, ()>); + fn either_transparent_struct_t(x: Either<TransparentStruct<num::NonZero<u8>>, ()>); + fn either_transparent_enum_t(x: Either<TransparentEnum<num::NonZero<u8>>, ()>); + fn either_phantom_t(x: Either<num::NonZero<u8>, std::marker::PhantomData<()>>); + fn either_1zst_exhaustive_no_variant_t(x: Either<num::NonZero<u8>, Z>); + fn either_1zst_exhaustive_no_field_t(x: Either<num::NonZero<u8>, NoField>); + + fn either_ref_e(x: Either<(), &'static u8>); + fn either_fn_e(x: Either<(), extern "C" fn()>); + fn either_nonnull_e(x: Either<(), std::ptr::NonNull<u8>>); + fn either_unique_e(x: Either<(), std::ptr::Unique<u8>>); + fn either_nonzero_u8_e(x: Either<(), num::NonZero<u8>>); + fn either_nonzero_u16_e(x: Either<(), num::NonZero<u16>>); + fn either_nonzero_u32_e(x: Either<(), num::NonZero<u32>>); + fn either_nonzero_u64_e(x: Either<(), num::NonZero<u64>>); + fn either_nonzero_usize_e(x: Either<(), num::NonZero<usize>>); + fn either_nonzero_i8_e(x: Either<(), num::NonZero<i8>>); + fn either_nonzero_i16_e(x: Either<(), num::NonZero<i16>>); + fn either_nonzero_i32_e(x: Either<(), num::NonZero<i32>>); + fn either_nonzero_i64_e(x: Either<(), num::NonZero<i64>>); + fn either_nonzero_isize_e(x: Either<(), num::NonZero<isize>>); + fn either_transparent_struct_e(x: Either<(), TransparentStruct<num::NonZero<u8>>>); + fn either_transparent_enum_e(x: Either<(), TransparentEnum<num::NonZero<u8>>>); + fn either_phantom_e(x: Either<num::NonZero<u8>, std::marker::PhantomData<()>>); + fn either_1zst_exhaustive_no_variant_e(x: Either<Z, num::NonZero<u8>>); + fn either_1zst_exhaustive_no_field_e(x: Either<NoField, num::NonZero<u8>>); +} + +pub fn main() {} diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr index b27f769ba34..3a2d4df3bee 100644 --- a/tests/ui/stats/hir-stats.stderr +++ b/tests/ui/stats/hir-stats.stderr @@ -1,33 +1,33 @@ ast-stats-1 PRE EXPANSION AST STATS ast-stats-1 Name Accumulated Size Count Item Size ast-stats-1 ---------------------------------------------------------------- +ast-stats-1 Crate 40 ( 0.6%) 1 40 ast-stats-1 GenericArgs 40 ( 0.6%) 1 40 ast-stats-1 - AngleBracketed 40 ( 0.6%) 1 -ast-stats-1 Crate 40 ( 0.6%) 1 40 ast-stats-1 ExprField 48 ( 0.7%) 1 48 ast-stats-1 WherePredicate 56 ( 0.8%) 1 56 ast-stats-1 - BoundPredicate 56 ( 0.8%) 1 ast-stats-1 Attribute 64 ( 1.0%) 2 32 -ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 - DocComment 32 ( 0.5%) 1 +ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 Local 80 ( 1.2%) 1 80 ast-stats-1 ForeignItem 88 ( 1.3%) 1 88 ast-stats-1 - Fn 88 ( 1.3%) 1 ast-stats-1 Arm 96 ( 1.4%) 2 48 ast-stats-1 FnDecl 120 ( 1.8%) 5 24 ast-stats-1 FieldDef 160 ( 2.4%) 2 80 +ast-stats-1 Param 160 ( 2.4%) 4 40 ast-stats-1 Stmt 160 ( 2.4%) 5 32 ast-stats-1 - Let 32 ( 0.5%) 1 ast-stats-1 - MacCall 32 ( 0.5%) 1 ast-stats-1 - Expr 96 ( 1.4%) 3 -ast-stats-1 Param 160 ( 2.4%) 4 40 ast-stats-1 Block 192 ( 2.9%) 6 32 ast-stats-1 Variant 208 ( 3.1%) 2 104 -ast-stats-1 GenericBound 352 ( 5.3%) 4 88 -ast-stats-1 - Trait 352 ( 5.3%) 4 ast-stats-1 AssocItem 352 ( 5.3%) 4 88 ast-stats-1 - Type 176 ( 2.7%) 2 ast-stats-1 - Fn 176 ( 2.7%) 2 +ast-stats-1 GenericBound 352 ( 5.3%) 4 88 +ast-stats-1 - Trait 352 ( 5.3%) 4 ast-stats-1 GenericParam 480 ( 7.2%) 5 96 ast-stats-1 Pat 504 ( 7.6%) 7 72 ast-stats-1 - Struct 72 ( 1.1%) 1 @@ -41,15 +41,15 @@ ast-stats-1 - Lit 144 ( 2.2%) 2 ast-stats-1 - Block 216 ( 3.3%) 3 ast-stats-1 PathSegment 744 (11.2%) 31 24 ast-stats-1 Ty 896 (13.5%) 14 64 -ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - Ref 64 ( 1.0%) 1 +ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 ast-stats-1 - Path 640 ( 9.6%) 10 ast-stats-1 Item 1_224 (18.4%) 9 136 -ast-stats-1 - Trait 136 ( 2.0%) 1 -ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - ForeignMod 136 ( 2.0%) 1 +ast-stats-1 - Trait 136 ( 2.0%) 1 ast-stats-1 - Impl 136 ( 2.0%) 1 +ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - Fn 272 ( 4.1%) 2 ast-stats-1 - Use 408 ( 6.1%) 3 ast-stats-1 ---------------------------------------------------------------- @@ -58,9 +58,9 @@ ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size ast-stats-2 ---------------------------------------------------------------- +ast-stats-2 Crate 40 ( 0.5%) 1 40 ast-stats-2 GenericArgs 40 ( 0.5%) 1 40 ast-stats-2 - AngleBracketed 40 ( 0.5%) 1 -ast-stats-2 Crate 40 ( 0.5%) 1 40 ast-stats-2 ExprField 48 ( 0.7%) 1 48 ast-stats-2 WherePredicate 56 ( 0.8%) 1 56 ast-stats-2 - BoundPredicate 56 ( 0.8%) 1 @@ -68,24 +68,24 @@ ast-stats-2 Local 80 ( 1.1%) 1 80 ast-stats-2 ForeignItem 88 ( 1.2%) 1 88 ast-stats-2 - Fn 88 ( 1.2%) 1 ast-stats-2 Arm 96 ( 1.3%) 2 48 -ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 ast-stats-2 FnDecl 120 ( 1.6%) 5 24 +ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 ast-stats-2 Attribute 128 ( 1.8%) 4 32 ast-stats-2 - DocComment 32 ( 0.4%) 1 ast-stats-2 - Normal 96 ( 1.3%) 3 ast-stats-2 FieldDef 160 ( 2.2%) 2 80 +ast-stats-2 Param 160 ( 2.2%) 4 40 ast-stats-2 Stmt 160 ( 2.2%) 5 32 ast-stats-2 - Let 32 ( 0.4%) 1 ast-stats-2 - Semi 32 ( 0.4%) 1 ast-stats-2 - Expr 96 ( 1.3%) 3 -ast-stats-2 Param 160 ( 2.2%) 4 40 ast-stats-2 Block 192 ( 2.6%) 6 32 ast-stats-2 Variant 208 ( 2.9%) 2 104 -ast-stats-2 GenericBound 352 ( 4.8%) 4 88 -ast-stats-2 - Trait 352 ( 4.8%) 4 ast-stats-2 AssocItem 352 ( 4.8%) 4 88 ast-stats-2 - Type 176 ( 2.4%) 2 ast-stats-2 - Fn 176 ( 2.4%) 2 +ast-stats-2 GenericBound 352 ( 4.8%) 4 88 +ast-stats-2 - Trait 352 ( 4.8%) 4 ast-stats-2 GenericParam 480 ( 6.6%) 5 96 ast-stats-2 Pat 504 ( 6.9%) 7 72 ast-stats-2 - Struct 72 ( 1.0%) 1 @@ -100,16 +100,16 @@ ast-stats-2 - Lit 144 ( 2.0%) 2 ast-stats-2 - Block 216 ( 3.0%) 3 ast-stats-2 PathSegment 864 (11.9%) 36 24 ast-stats-2 Ty 896 (12.3%) 14 64 -ast-stats-2 - Ptr 64 ( 0.9%) 1 ast-stats-2 - Ref 64 ( 0.9%) 1 +ast-stats-2 - Ptr 64 ( 0.9%) 1 ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 ast-stats-2 - Path 640 ( 8.8%) 10 ast-stats-2 Item 1_496 (20.5%) 11 136 -ast-stats-2 - Trait 136 ( 1.9%) 1 ast-stats-2 - Enum 136 ( 1.9%) 1 +ast-stats-2 - Trait 136 ( 1.9%) 1 +ast-stats-2 - Impl 136 ( 1.9%) 1 ast-stats-2 - ExternCrate 136 ( 1.9%) 1 ast-stats-2 - ForeignMod 136 ( 1.9%) 1 -ast-stats-2 - Impl 136 ( 1.9%) 1 ast-stats-2 - Fn 272 ( 3.7%) 2 ast-stats-2 - Use 544 ( 7.5%) 4 ast-stats-2 ---------------------------------------------------------------- @@ -129,8 +129,8 @@ hir-stats - Lifetime 48 ( 0.5%) 3 hir-stats Local 64 ( 0.7%) 1 64 hir-stats Param 64 ( 0.7%) 2 32 hir-stats Body 72 ( 0.8%) 3 24 -hir-stats InlineAsm 72 ( 0.8%) 1 72 hir-stats ImplItemRef 72 ( 0.8%) 2 36 +hir-stats InlineAsm 72 ( 0.8%) 1 72 hir-stats Arm 80 ( 0.9%) 2 40 hir-stats FieldDef 96 ( 1.1%) 2 48 hir-stats Stmt 96 ( 1.1%) 3 32 @@ -139,8 +139,8 @@ hir-stats - Semi 32 ( 0.4%) 1 hir-stats - Expr 32 ( 0.4%) 1 hir-stats FnDecl 120 ( 1.3%) 3 40 hir-stats Attribute 128 ( 1.4%) 4 32 -hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericArgs 144 ( 1.6%) 3 48 +hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericBound 192 ( 2.1%) 4 48 hir-stats - Trait 192 ( 2.1%) 4 hir-stats WherePredicate 192 ( 2.1%) 3 64 @@ -148,27 +148,27 @@ hir-stats - BoundPredicate 192 ( 2.1%) 3 hir-stats Block 288 ( 3.2%) 6 48 hir-stats GenericParam 360 ( 4.0%) 5 72 hir-stats Pat 360 ( 4.0%) 5 72 -hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Struct 72 ( 0.8%) 1 +hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Binding 216 ( 2.4%) 3 hir-stats Generics 560 ( 6.2%) 10 56 hir-stats Ty 720 ( 8.0%) 15 48 -hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Ref 48 ( 0.5%) 1 +hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Path 624 ( 7.0%) 13 hir-stats Expr 768 ( 8.6%) 12 64 hir-stats - Path 64 ( 0.7%) 1 -hir-stats - Struct 64 ( 0.7%) 1 hir-stats - Match 64 ( 0.7%) 1 +hir-stats - Struct 64 ( 0.7%) 1 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Lit 128 ( 1.4%) 2 hir-stats - Block 384 ( 4.3%) 6 hir-stats Item 968 (10.8%) 11 88 -hir-stats - Trait 88 ( 1.0%) 1 hir-stats - Enum 88 ( 1.0%) 1 +hir-stats - Trait 88 ( 1.0%) 1 +hir-stats - Impl 88 ( 1.0%) 1 hir-stats - ExternCrate 88 ( 1.0%) 1 hir-stats - ForeignMod 88 ( 1.0%) 1 -hir-stats - Impl 88 ( 1.0%) 1 hir-stats - Fn 176 ( 2.0%) 2 hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.8%) 31 40 diff --git a/tests/ui/structs-enums/type-sizes.rs b/tests/ui/structs-enums/type-sizes.rs index f49ce33841a..1961f10bd0a 100644 --- a/tests/ui/structs-enums/type-sizes.rs +++ b/tests/ui/structs-enums/type-sizes.rs @@ -5,7 +5,6 @@ #![allow(dead_code)] #![feature(never_type)] #![feature(pointer_is_aligned_to)] -#![feature(strict_provenance)] use std::mem::size_of; use std::num::NonZero; diff --git a/tests/ui/traits/next-solver/canonical/do-not-bail-due-to-placeholders.rs b/tests/ui/traits/next-solver/canonical/do-not-bail-due-to-placeholders.rs new file mode 100644 index 00000000000..3fc11f27d1f --- /dev/null +++ b/tests/ui/traits/next-solver/canonical/do-not-bail-due-to-placeholders.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// When canonicalizing responses, we bail if there are too many inference variables. +// We previously also counted placeholders, which is incorrect. +#![recursion_limit = "8"] + +fn foo<T>() {} + +fn bar<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>() { + // The query response will contain 10 placeholders, which previously + // caused us to bail here. + foo::<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)>(); +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/normalize/normalize-allow-too-many-vars.rs b/tests/ui/traits/next-solver/normalize/normalize-allow-too-many-vars.rs new file mode 100644 index 00000000000..5284220ac38 --- /dev/null +++ b/tests/ui/traits/next-solver/normalize/normalize-allow-too-many-vars.rs @@ -0,0 +1,52 @@ +//@ check-pass + +// When canonicalizing a response in the trait solver, we bail with overflow +// if there are too many non-region inference variables. Doing so in normalizes-to +// goals ends up hiding inference constraints in cases which we want to support, +// see #131969. To prevent this issue we do not check for too many inference +// variables in normalizes-to goals. +#![recursion_limit = "8"] + +trait Bound {} +trait Trait { + type Assoc; +} + + +impl<T0, T1, T2, T3, T4, T5, T6, T7> Trait for (T0, T1, T2, T3, T4, T5, T6, T7) +where + T0: Trait, + T1: Trait, + T2: Trait, + T3: Trait, + T4: Trait, + T5: Trait, + T6: Trait, + T7: Trait, + ( + T0::Assoc, + T1::Assoc, + T2::Assoc, + T3::Assoc, + T4::Assoc, + T5::Assoc, + T6::Assoc, + T7::Assoc, + ): Clone, +{ + type Assoc = ( + T0::Assoc, + T1::Assoc, + T2::Assoc, + T3::Assoc, + T4::Assoc, + T5::Assoc, + T6::Assoc, + T7::Assoc, + ); +} + +trait Overlap {} +impl<T: Trait<Assoc = ()>> Overlap for T {} +impl<T0, T1, T2, T3, T4, T5, T6, T7> Overlap for (T0, T1, T2, T3, T4, T5, T6, T7) {} +fn main() {} diff --git a/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs b/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs index 0d5f42231e4..f88f74680b9 100644 --- a/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs +++ b/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs @@ -1,8 +1,5 @@ //@ check-pass -//@ revisions: ai_current ai_next ia_current ia_next ii_current ii_next -//@[ai_next] compile-flags: -Znext-solver -//@[ia_next] compile-flags: -Znext-solver -//@[ii_next] compile-flags: -Znext-solver +//@ revisions: ai ia ii // Regression test for nalgebra hang <https://github.com/rust-lang/rust/issues/130056>. @@ -17,11 +14,11 @@ trait Trait { type Assoc: ?Sized; } impl<T: ?Sized + Trait> Trait for W<T, T> { - #[cfg(any(ai_current, ai_next))] + #[cfg(ai)] type Assoc = W<T::Assoc, Id<T::Assoc>>; - #[cfg(any(ia_current, ia_next))] + #[cfg(ia)] type Assoc = W<Id<T::Assoc>, T::Assoc>; - #[cfg(any(ii_current, ii_next))] + #[cfg(ii)] type Assoc = W<Id<T::Assoc>, Id<T::Assoc>>; } diff --git a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs index 86d428cc0f0..dd8ad3c2dfe 100644 --- a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs +++ b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs @@ -1,8 +1,8 @@ -//~ ERROR overflow evaluating the requirement `Self: Trait` -//~^ ERROR overflow evaluating the requirement `Self well-formed` -// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE. +//@ check-pass //@ compile-flags: -Znext-solver --crate-type=lib +// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE. + #![recursion_limit = "0"] trait Trait {} impl Trait for u32 {} diff --git a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr deleted file mode 100644 index 2eed7e8f723..00000000000 --- a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0275]: overflow evaluating the requirement `Self: Trait` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) - -error[E0275]: overflow evaluating the requirement `Self well-formed` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.rs b/tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.rs new file mode 100644 index 00000000000..eeb0777c856 --- /dev/null +++ b/tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.rs @@ -0,0 +1,19 @@ +#![feature(transmutability)] +#![feature(generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete + +use std::mem::{Assume, TransmuteFrom}; + +pub fn is_transmutable<const ASSUME_ALIGNMENT: bool>() +where + (): TransmuteFrom<(), { Assume::SAFETY }>, +{ +} + +fn foo<const N: usize>() { + is_transmutable::<{}>(); + //~^ ERROR the trait bound `(): TransmuteFrom<(), { Assume::SAFETY }>` is not satisfied + //~| ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.stderr b/tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.stderr new file mode 100644 index 00000000000..6cb6a85c78a --- /dev/null +++ b/tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.stderr @@ -0,0 +1,34 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/dont-assume-err-is-yes-issue-126377.rs:2:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/dont-assume-err-is-yes-issue-126377.rs:14:23 + | +LL | is_transmutable::<{}>(); + | ^^ expected `bool`, found `()` + +error[E0277]: the trait bound `(): TransmuteFrom<(), { Assume::SAFETY }>` is not satisfied + --> $DIR/dont-assume-err-is-yes-issue-126377.rs:14:23 + | +LL | is_transmutable::<{}>(); + | ^^ the trait `TransmuteFrom<(), { Assume::SAFETY }>` is not implemented for `()` + | +note: required by a bound in `is_transmutable` + --> $DIR/dont-assume-err-is-yes-issue-126377.rs:9:9 + | +LL | pub fn is_transmutable<const ASSUME_ALIGNMENT: bool>() + | --------------- required by a bound in this function +LL | where +LL | (): TransmuteFrom<(), { Assume::SAFETY }>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 2 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. |
