From 063f0112704ec3a32fc58634f38d93343cac4a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 17:49:04 +0100 Subject: [PATCH 1/9] add test for #52334 Fixes #52334 --- .../extern-C-non-FFI-safe-arg-ice-52334.rs | 13 +++++++++++ ...extern-C-non-FFI-safe-arg-ice-52334.stderr | 22 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs create mode 100644 tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr diff --git a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs new file mode 100644 index 0000000000000..3f515ea890935 --- /dev/null +++ b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs @@ -0,0 +1,13 @@ +// test for #52334 ICE when casting extern "C" fn when it has a non-FFI-safe argument +//@ check-pass + +type Foo = extern "C" fn(::std::ffi::CStr); +//~^ WARN `extern` fn uses type `[i8]`, which is not FFI-safe +extern "C" { + fn meh(blah: Foo); + //~^ WARN `extern` block uses type `[i8]`, which is not FFI-safe +} + +fn main() { + meh as usize; +} diff --git a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr new file mode 100644 index 0000000000000..97c632740e884 --- /dev/null +++ b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr @@ -0,0 +1,22 @@ +warning: `extern` fn uses type `[i8]`, which is not FFI-safe + --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:4:12 + | +LL | type Foo = extern "C" fn(::std::ffi::CStr); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + = note: `#[warn(improper_ctypes_definitions)]` on by default + +warning: `extern` block uses type `[i8]`, which is not FFI-safe + --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:18 + | +LL | fn meh(blah: Foo); + | ^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + = note: `#[warn(improper_ctypes)]` on by default + +warning: 2 warnings emitted + From c3bde2477445b469bd8be74424d780a523389cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:00:38 +0100 Subject: [PATCH 2/9] add test for #64784 Declarative macros can create infinite glob import cycles Fixes #64784 --- ...acro-infinite-global-import-cycle-ice-64784.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs diff --git a/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs b/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs new file mode 100644 index 0000000000000..da7c5442d36da --- /dev/null +++ b/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs @@ -0,0 +1,15 @@ +// ICE #64784 already borrowed: BorrowMutError +//@ check-pass +#![feature(decl_macro)] + +pub macro m($i:ident, $j:ident) { + mod $i { + pub use crate::$j::*; + pub struct A; + } +} + +m!(x, y); +m!(y, x); + +fn main() {} From 72d2b5958230519d8fe522f7e5f147e4ac2eee51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:12:49 +0100 Subject: [PATCH 3/9] add test for str as extern "C" arg causes compiler panic #80125 Fixes #80125 --- tests/ui/extern/extern-C-str-arg-ice-80125.rs | 15 ++++++++ .../extern/extern-C-str-arg-ice-80125.stderr | 35 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 tests/ui/extern/extern-C-str-arg-ice-80125.rs create mode 100644 tests/ui/extern/extern-C-str-arg-ice-80125.stderr diff --git a/tests/ui/extern/extern-C-str-arg-ice-80125.rs b/tests/ui/extern/extern-C-str-arg-ice-80125.rs new file mode 100644 index 0000000000000..71098fed2efad --- /dev/null +++ b/tests/ui/extern/extern-C-str-arg-ice-80125.rs @@ -0,0 +1,15 @@ +// test for #80125 +//@ check-pass +type ExternCallback = extern "C" fn(*const u8, u32, str); +//~^ WARN `extern` fn uses type `str`, which is not FFI-safe + +pub struct Struct(ExternCallback); + +#[no_mangle] +pub extern "C" fn register_something(bind: ExternCallback) -> Struct { +//~^ WARN `extern` fn uses type `str`, which is not FFI-safe +//~^^ WARN `extern` fn uses type `Struct`, which is not FFI-safe + Struct(bind) +} + +fn main() {} diff --git a/tests/ui/extern/extern-C-str-arg-ice-80125.stderr b/tests/ui/extern/extern-C-str-arg-ice-80125.stderr new file mode 100644 index 0000000000000..ebd6cec6ecd3f --- /dev/null +++ b/tests/ui/extern/extern-C-str-arg-ice-80125.stderr @@ -0,0 +1,35 @@ +warning: `extern` fn uses type `str`, which is not FFI-safe + --> $DIR/extern-C-str-arg-ice-80125.rs:3:23 + | +LL | type ExternCallback = extern "C" fn(*const u8, u32, str); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using `*const u8` and a length instead + = note: string slices have no C equivalent + = note: `#[warn(improper_ctypes_definitions)]` on by default + +warning: `extern` fn uses type `str`, which is not FFI-safe + --> $DIR/extern-C-str-arg-ice-80125.rs:9:44 + | +LL | pub extern "C" fn register_something(bind: ExternCallback) -> Struct { + | ^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using `*const u8` and a length instead + = note: string slices have no C equivalent + +warning: `extern` fn uses type `Struct`, which is not FFI-safe + --> $DIR/extern-C-str-arg-ice-80125.rs:9:63 + | +LL | pub extern "C" fn register_something(bind: ExternCallback) -> Struct { + | ^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout +note: the type is defined here + --> $DIR/extern-C-str-arg-ice-80125.rs:6:1 + | +LL | pub struct Struct(ExternCallback); + | ^^^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + From 6b0dfc5b9a95ad06df5399e8a8d9027e03dd9adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:18:56 +0100 Subject: [PATCH 4/9] add test for ice 83056 "bad input type for cast" Fixes #83056 --- .../ice-bad-input-type-for-cast-83056.rs | 6 ++++++ .../ice-bad-input-type-for-cast-83056.stderr | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/ui/consts/ice-bad-input-type-for-cast-83056.rs create mode 100644 tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr diff --git a/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs b/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs new file mode 100644 index 0000000000000..ea0aba2c91160 --- /dev/null +++ b/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs @@ -0,0 +1,6 @@ +// #83056 ICE "bad input type for cast" + +struct S([bool; f as usize]); +fn f() -> T {} +//~^ ERROR cannot find type `T` in this scope +pub fn main() {} diff --git a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr new file mode 100644 index 0000000000000..4764f49cf464a --- /dev/null +++ b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr @@ -0,0 +1,20 @@ +error[E0412]: cannot find type `T` in this scope + --> $DIR/ice-bad-input-type-for-cast-83056.rs:4:11 + | +LL | struct S([bool; f as usize]); + | ----------------------------- similarly named struct `S` defined here +LL | fn f() -> T {} + | ^ + | +help: a struct with a similar name exists + | +LL | fn f() -> S {} + | ~ +help: you might be missing a type parameter + | +LL | fn f() -> T {} + | +++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. From c7ef3cd65d1cfb1a4ca6a50ab7d93e0c2b7bdb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:23:19 +0100 Subject: [PATCH 5/9] add test for #88212 ICE when lambda captures unsized local Fixes #88212 --- ...nd_align_of-closure-not-supported-88212.rs | 21 +++++++++++++++++ ...lign_of-closure-not-supported-88212.stderr | 23 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs create mode 100644 tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.stderr diff --git a/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs b/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs new file mode 100644 index 0000000000000..1c43e3a448976 --- /dev/null +++ b/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs @@ -0,0 +1,21 @@ +// ICE size_and_align_of::<[closure@test.rs:15:5: 17:7]> not supported #88212 + +#![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + +trait Example {} +struct Foo(); + +impl Example for Foo {} + +fn example() -> Box { + Box::new(Foo()) +} + +fn main() { + let x: dyn Example = *example(); + (move || { + let _y = x; + //~^ ERROR the size for values of type `dyn Example` cannot be known at compilation time + })(); +} diff --git a/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.stderr b/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.stderr new file mode 100644 index 0000000000000..a0253ac1f35aa --- /dev/null +++ b/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.stderr @@ -0,0 +1,23 @@ +warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/ice-size_and_align_of-closure-not-supported-88212.rs:3:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #48055 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the size for values of type `dyn Example` cannot be known at compilation time + --> $DIR/ice-size_and_align_of-closure-not-supported-88212.rs:18:18 + | +LL | (move || { + | -- this closure captures all values by move +LL | let _y = x; + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `dyn Example` + = note: all values captured by value by a closure must have a statically known size + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. From 3c1db068d3e972511e6149caf094c278a68294a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:29:41 +0100 Subject: [PATCH 6/9] add test for 88421 ICE: could not fully normalize `&>::Output Fixes #88421 --- .../failed-to-normalize-ice-issue-88421.rs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs diff --git a/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs b/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs new file mode 100644 index 0000000000000..2ea7394fb72a5 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs @@ -0,0 +1,36 @@ +//@ check-pass + +#![feature(adt_const_params)] +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +use std::ops::Index; + +pub struct CellPossibilities; + +pub enum CellState { + Empty(Option), +} + +pub struct Sudoku; + +impl Sudokuwhere + [CellState; SQUARE_SIZE * SQUARE_SIZE]: Sized, +{ + pub fn random() { + let CellState::Empty(_) = Self[()]; + } +} + +impl Index<()> for Sudoku +where + [CellState; SQUARE_SIZE * SQUARE_SIZE]: Sized, +{ + type Output = CellState; + + fn index(&self, _: ()) -> &Self::Output { + todo!() + } +} + +pub fn main() {} From efc57fbdb42411b5a6253588de05f42b62376f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 18:36:16 +0100 Subject: [PATCH 7/9] add test for ice #90691 ICE: resolution failed during building vtable representation Fixes #90691 --- ...uilding-vtable-representation-ice-90691.rs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs diff --git a/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs b/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs new file mode 100644 index 0000000000000..33776809a7912 --- /dev/null +++ b/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs @@ -0,0 +1,41 @@ +// ICE #90691 Encountered error `Unimplemented` selecting ... +//@ build-pass + +trait TError: std::fmt::Debug {} +impl TError for () {} + +trait SuperTrait { + type Error; +} + +trait Trait: SuperTrait {} + +impl Trait for T +where + T: SuperTrait, + ::Error: TError, +{ +} + +struct SomeTrait(S); +struct BoxedTrait(Box>); + +impl From> for BoxedTrait { + fn from(other: SomeTrait) -> Self { + Self(Box::new(other)) + } +} + +impl SuperTrait for SomeTrait { + type Error = (); +} + +impl From<()> for BoxedTrait { + fn from(c: ()) -> Self { + Self::from(SomeTrait(c)) + } +} + +fn main() { + let _: BoxedTrait = ().into(); +} From 15ef7a0ee1b13b4485e8dad2590a99e7fcc5eb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 19:06:46 +0100 Subject: [PATCH 8/9] add test for stack overflow with recursive type #98842 Fixes #98842 --- .../sized/stack-overflow-trait-infer-98842.rs | 15 +++++++++++ .../stack-overflow-trait-infer-98842.stderr | 25 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/ui/sized/stack-overflow-trait-infer-98842.rs create mode 100644 tests/ui/sized/stack-overflow-trait-infer-98842.stderr diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.rs b/tests/ui/sized/stack-overflow-trait-infer-98842.rs new file mode 100644 index 0000000000000..2bba0777be49f --- /dev/null +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.rs @@ -0,0 +1,15 @@ +// #98842 stack overflow in trait inference +//@ check-fail +//@ edition:2021 +//~^^^ ERROR cycle detected when computing layout of `Foo` + +// If the inner `Foo` is named through an associated type, +// the "infinite size" error does not occur. +struct Foo(<&'static Foo as ::core::ops::Deref>::Target); +// But Rust will be unable to know whether `Foo` is sized or not, +// 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 + +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 new file mode 100644 index 0000000000000..42b2718e33246 --- /dev/null +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.stderr @@ -0,0 +1,25 @@ +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:12: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:12: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`. From 1480b144d2fcd605cf9f18e581f0490f317514cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 19:21:50 +0100 Subject: [PATCH 9/9] add issue numbers via // issue: rust-lang/rust#ISSUE_NUM directive --- ...uilding-vtable-representation-ice-90691.rs | 1 + .../failed-to-normalize-ice-issue-88421.rs | 2 +- .../ice-bad-input-type-for-cast-83056.rs | 1 + .../ice-bad-input-type-for-cast-83056.stderr | 2 +- .../extern-C-non-FFI-safe-arg-ice-52334.rs | 5 +++- ...extern-C-non-FFI-safe-arg-ice-52334.stderr | 8 +++--- tests/ui/extern/extern-C-str-arg-ice-80125.rs | 2 +- ...-infinite-global-import-cycle-ice-64784.rs | 1 + ...ck-overflow-trait-infer-98842.32bit.stderr | 25 +++++++++++++++++++ ...ck-overflow-trait-infer-98842.64bit.stderr | 25 +++++++++++++++++++ .../sized/stack-overflow-trait-infer-98842.rs | 5 +++- .../stack-overflow-trait-infer-98842.stderr | 4 +-- ...nd_align_of-closure-not-supported-88212.rs | 2 +- 13 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr create mode 100644 tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr diff --git a/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs b/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs index 33776809a7912..d3c13974127cb 100644 --- a/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs +++ b/tests/ui/associated-type-bounds/resolution-failure-building-vtable-representation-ice-90691.rs @@ -1,5 +1,6 @@ // ICE #90691 Encountered error `Unimplemented` selecting ... //@ build-pass +// issue: rust-lang/rust#90691 trait TError: std::fmt::Debug {} impl TError for () {} diff --git a/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs b/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs index 2ea7394fb72a5..3d41eeeff45cd 100644 --- a/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs +++ b/tests/ui/const-generics/generic_const_exprs/failed-to-normalize-ice-issue-88421.rs @@ -1,5 +1,5 @@ //@ check-pass - +// issue: rust-lang/rust#88421 #![feature(adt_const_params)] #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs b/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs index ea0aba2c91160..1a22dc2b5495a 100644 --- a/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs +++ b/tests/ui/consts/ice-bad-input-type-for-cast-83056.rs @@ -1,4 +1,5 @@ // #83056 ICE "bad input type for cast" +// issue: rust-lang/rust#83056 struct S([bool; f as usize]); fn f() -> T {} diff --git a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr index 4764f49cf464a..115f168852058 100644 --- a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr +++ b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `T` in this scope - --> $DIR/ice-bad-input-type-for-cast-83056.rs:4:11 + --> $DIR/ice-bad-input-type-for-cast-83056.rs:5:11 | LL | struct S([bool; f as usize]); | ----------------------------- similarly named struct `S` defined here diff --git a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs index 3f515ea890935..fbe47492b3892 100644 --- a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs +++ b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs @@ -1,5 +1,8 @@ -// test for #52334 ICE when casting extern "C" fn when it has a non-FFI-safe argument +// test for ICE when casting extern "C" fn when it has a non-FFI-safe argument +// issue: rust-lang/rust#52334 //@ check-pass +//@ normalize-stderr-test "\[i8\]" -> "[i8 or u8 (arch dependant)]" +//@ normalize-stderr-test "\[u8\]" -> "[i8 or u8 (arch dependant)]" type Foo = extern "C" fn(::std::ffi::CStr); //~^ WARN `extern` fn uses type `[i8]`, which is not FFI-safe diff --git a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr index 97c632740e884..8349298847918 100644 --- a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr +++ b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr @@ -1,5 +1,5 @@ -warning: `extern` fn uses type `[i8]`, which is not FFI-safe - --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:4:12 +warning: `extern` fn uses type `[i8 or u8 (arch dependant)]`, which is not FFI-safe + --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:12 | LL | type Foo = extern "C" fn(::std::ffi::CStr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -8,8 +8,8 @@ LL | type Foo = extern "C" fn(::std::ffi::CStr); = note: slices have no C equivalent = note: `#[warn(improper_ctypes_definitions)]` on by default -warning: `extern` block uses type `[i8]`, which is not FFI-safe - --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:18 +warning: `extern` block uses type `[i8 or u8 (arch dependant)]`, which is not FFI-safe + --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:10:18 | LL | fn meh(blah: Foo); | ^^^ not FFI-safe diff --git a/tests/ui/extern/extern-C-str-arg-ice-80125.rs b/tests/ui/extern/extern-C-str-arg-ice-80125.rs index 71098fed2efad..0908d6199efb8 100644 --- a/tests/ui/extern/extern-C-str-arg-ice-80125.rs +++ b/tests/ui/extern/extern-C-str-arg-ice-80125.rs @@ -1,4 +1,4 @@ -// test for #80125 +// issue: rust-lang/rust#80125 //@ check-pass type ExternCallback = extern "C" fn(*const u8, u32, str); //~^ WARN `extern` fn uses type `str`, which is not FFI-safe diff --git a/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs b/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs index da7c5442d36da..72b1ea7ccc8ba 100644 --- a/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs +++ b/tests/ui/privacy/decl-macro-infinite-global-import-cycle-ice-64784.rs @@ -1,5 +1,6 @@ // ICE #64784 already borrowed: BorrowMutError //@ check-pass +// issue: rust-lang/rust#64784 #![feature(decl_macro)] pub macro m($i:ident, $j:ident) { diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr new file mode 100644 index 0000000000000..3f8011d961ae7 --- /dev/null +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.32bit.stderr @@ -0,0 +1,25 @@ +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:15: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: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 + +Some errors have detailed explanations: E0080, E0391. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr new file mode 100644 index 0000000000000..04e2c4483bf64 --- /dev/null +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.64bit.stderr @@ -0,0 +1,25 @@ +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:15: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: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 + +Some errors have detailed explanations: E0080, E0391. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.rs b/tests/ui/sized/stack-overflow-trait-infer-98842.rs index 2bba0777be49f..54d50346cc831 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.rs +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.rs @@ -1,7 +1,10 @@ // #98842 stack overflow in trait inference +// issue: rust-lang/rust#98842 //@ check-fail //@ edition:2021 -//~^^^ ERROR cycle detected when computing layout of `Foo` +//@ stderr-per-bitwidth +//@ ignore-endian-big +//~^^^^^^ ERROR cycle detected when computing layout of `Foo` // If the inner `Foo` is named through an associated type, // the "infinite size" error does not occur. diff --git a/tests/ui/sized/stack-overflow-trait-infer-98842.stderr b/tests/ui/sized/stack-overflow-trait-infer-98842.stderr index 42b2718e33246..8ddddeb5bf2d1 100644 --- a/tests/ui/sized/stack-overflow-trait-infer-98842.stderr +++ b/tests/ui/sized/stack-overflow-trait-infer-98842.stderr @@ -3,14 +3,14 @@ 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:12:1 + --> $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:12:1 + --> $DIR/stack-overflow-trait-infer-98842.rs:13:1 | LL | const _: *const Foo = 0 as _; | ^^^^^^^^^^^^^^^^^^^ a cycle occurred during layout computation diff --git a/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs b/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs index 1c43e3a448976..ec475673d0d84 100644 --- a/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs +++ b/tests/ui/unsized-locals/ice-size_and_align_of-closure-not-supported-88212.rs @@ -1,5 +1,5 @@ // ICE size_and_align_of::<[closure@test.rs:15:5: 17:7]> not supported #88212 - +// issue: rust-lang/rust#88212 #![feature(unsized_locals)] //~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes