Auto merge of #99943 - compiler-errors:tuple-trait, r=jackh726
Implement `std::marker::Tuple`, use it in `extern "rust-call"` and `Fn`-family traits Implements rust-lang/compiler-team#537 I made a few opinionated decisions in this implementation, specifically: 1. Enforcing `extern "rust-call"` on fn items during wfcheck, 2. Enforcing this for all functions (not just ones that have bodies), 3. Gating this `Tuple` marker trait behind its own feature, instead of grouping it into (e.g.) `unboxed_closures`. Still needing to be done: 1. Enforce that `extern "rust-call"` `fn`-ptrs are well-formed only if they have 1/2 args and the second one implements `Tuple`. (Doing this would fix ICE in #66696.) 2. Deny all explicit/user `impl`s of the `Tuple` trait, kinda like `Sized`. 3. Fixing `Tuple` trait built-in impl for chalk, so that chalkification tests are un-broken. Open questions: 1. Does this need t-lang or t-libs signoff? Fixes #99820
This commit is contained in:
commit
7eef946fc0
53 changed files with 843 additions and 244 deletions
|
|
@ -94,8 +94,8 @@ LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
|
|||
|
|
||||
::: $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
|
||||
LL | pub trait Fn<Args>: FnMut<Args> {
|
||||
| ------------------------------- similarly named trait `Fn` defined here
|
||||
LL | pub trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
| -------------------------------------- similarly named trait `Fn` defined here
|
||||
|
||||
error[E0405]: cannot find trait `r#fn` in this scope
|
||||
--> $DIR/kw-in-trait-bounds.rs:17:4
|
||||
|
|
@ -105,8 +105,8 @@ LL | G: fn(),
|
|||
|
|
||||
::: $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
|
||||
LL | pub trait Fn<Args>: FnMut<Args> {
|
||||
| ------------------------------- similarly named trait `Fn` defined here
|
||||
LL | pub trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
| -------------------------------------- similarly named trait `Fn` defined here
|
||||
|
||||
error[E0405]: cannot find trait `r#fn` in this scope
|
||||
--> $DIR/kw-in-trait-bounds.rs:3:27
|
||||
|
|
@ -116,8 +116,8 @@ LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
|
|||
|
|
||||
::: $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
|
||||
LL | pub trait Fn<Args>: FnMut<Args> {
|
||||
| ------------------------------- similarly named trait `Fn` defined here
|
||||
LL | pub trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
| -------------------------------------- similarly named trait `Fn` defined here
|
||||
|
||||
error[E0405]: cannot find trait `r#fn` in this scope
|
||||
--> $DIR/kw-in-trait-bounds.rs:3:41
|
||||
|
|
@ -127,8 +127,8 @@ LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn())
|
|||
|
|
||||
::: $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
|
||||
LL | pub trait Fn<Args>: FnMut<Args> {
|
||||
| ------------------------------- similarly named trait `Fn` defined here
|
||||
LL | pub trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
| -------------------------------------- similarly named trait `Fn` defined here
|
||||
|
||||
error[E0405]: cannot find trait `r#struct` in this scope
|
||||
--> $DIR/kw-in-trait-bounds.rs:24:10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue