Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/ui/splat/splat-rust-call-fn-trait-issue-158800.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Regression test for `#[splat] ()` in a rust-call Fn* trait method not ICEing in WF
//! checking.

#![feature(splat)]
#![feature(unboxed_closures)]
#![expect(incomplete_features)]

impl<T> dyn FnOnce(T) -> () {
//~^ ERROR cannot define inherent `impl` for a type outside of the crate
extern "rust-call" fn call_once(#[splat] _: ()) {}
//~^ ERROR `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
}

fn main() {}
20 changes: 20 additions & 0 deletions tests/ui/splat/splat-rust-call-fn-trait-issue-158800.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-rust-call-fn-trait-issue-158800.rs:10:5
|
LL | extern "rust-call" fn call_once(#[splat] _: ()) {}
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
--> $DIR/splat-rust-call-fn-trait-issue-158800.rs:8:1
|
LL | impl<T> dyn FnOnce(T) -> () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
|
= help: consider defining a trait and implementing it for the type or using a newtype wrapper like `struct MyType(ExternalType);` and implement it
= note: for more details about the orphan rules, see <https://doc.rust-lang.org/reference/items/implementations.html?highlight=orphan#orphan-rules>

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0116`.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Regression test for `#[splat] self` in a rust-call method not ICEing in WF
//! Regression test for `#[splat] self` in a rust-call Fn* trait method not ICEing in WF
//! checking.

#![feature(splat)]
#![feature(unboxed_closures)]
#![allow(incomplete_features)]
#![expect(incomplete_features)]

impl<T> dyn FnOnce(T) -> () {
//~^ ERROR cannot define inherent `impl` for a type outside of the crate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-self-rust-call-issue-158800.rs:10:5
--> $DIR/splat-rust-call-fn-trait-self-issue-158800.rs:10:5
|
LL | extern "rust-call" fn call_once(#[splat] self) {}
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error: functions with the "rust-call" ABI must take a single non-self tuple argument
--> $DIR/splat-self-rust-call-issue-158800.rs:10:46
--> $DIR/splat-rust-call-fn-trait-self-issue-158800.rs:10:46
|
LL | extern "rust-call" fn call_once(#[splat] self) {}
| ^^^^

error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
--> $DIR/splat-self-rust-call-issue-158800.rs:8:1
--> $DIR/splat-rust-call-fn-trait-self-issue-158800.rs:8:1
|
LL | impl<T> dyn FnOnce(T) -> () {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate
Expand All @@ -22,7 +22,7 @@ LL | impl<T> dyn FnOnce(T) -> () {
= note: for more details about the orphan rules, see <https://doc.rust-lang.org/reference/items/implementations.html?highlight=orphan#orphan-rules>

error[E0277]: the size for values of type `(dyn FnOnce(T) + 'static)` cannot be known at compilation time
--> $DIR/splat-self-rust-call-issue-158800.rs:10:46
--> $DIR/splat-rust-call-fn-trait-self-issue-158800.rs:10:46
|
LL | extern "rust-call" fn call_once(#[splat] self) {}
| ^^^^ doesn't have a size known at compile-time
Expand Down
19 changes: 19 additions & 0 deletions tests/ui/splat/splat-rust-call-trait-issue-158800.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! Regression test for `#[splat] ()` in a rust-call trait method not ICEing in WF
//! checking.

#![feature(splat)]
#![feature(unboxed_closures)]
#![expect(incomplete_features)]

trait Trait {
extern "rust-call" fn f(#[splat] _: ()) where Self: Sized;
//~^ ERROR `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
}

impl dyn Trait {
extern "rust-call" fn f(#[splat] _: ()) where Self: Sized {}
//~^ ERROR `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
//~| ERROR the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
}

fn main() {}
31 changes: 31 additions & 0 deletions tests/ui/splat/splat-rust-call-trait-issue-158800.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-rust-call-trait-issue-158800.rs:9:5
|
LL | extern "rust-call" fn f(#[splat] _: ()) where Self: Sized;
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-rust-call-trait-issue-158800.rs:14:5
|
LL | extern "rust-call" fn f(#[splat] _: ()) where Self: Sized {}
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
--> $DIR/splat-rust-call-trait-issue-158800.rs:14:51
|
LL | extern "rust-call" fn f(#[splat] _: ()) where Self: Sized {}
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Trait + 'static)`
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
LL + #![feature(trivial_bounds)]
|

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.
25 changes: 25 additions & 0 deletions tests/ui/splat/splat-rust-call-type-issue-158800.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! Regression test for `#[splat] ())` in a rust-call type method not ICEing in WF
//! checking.

#![feature(splat)]
#![feature(unboxed_closures)]
#![expect(incomplete_features)]

struct Type;

trait Trait {
extern "rust-call" fn f(#[splat] _: ());
//~^ ERROR `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
}

impl Type {
extern "rust-call" fn f2(#[splat] _: ()) {}
//~^ ERROR `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
}

impl Trait for Type {
extern "rust-call" fn f(#[splat] _: ()) {}
//~^ ERROR `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
}

fn main() {}
26 changes: 26 additions & 0 deletions tests/ui/splat/splat-rust-call-type-issue-158800.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-rust-call-type-issue-158800.rs:11:5
|
LL | extern "rust-call" fn f(#[splat] _: ());
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-rust-call-type-issue-158800.rs:16:5
|
LL | extern "rust-call" fn f2(#[splat] _: ()) {}
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error: `#[splat]` is not allowed in the arguments of functions with the `rust-call` ABI
--> $DIR/splat-rust-call-type-issue-158800.rs:21:5
|
LL | extern "rust-call" fn f(#[splat] _: ()) {}
| ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
|
= help: remove `#[splat]` or change the ABI

error: aborting due to 3 previous errors

Loading