-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce core::marker::Tuple
to properly type-check extern "rust-call"
calls
#537
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. cc @rust-lang/compiler @rust-lang/compiler-contributors |
Also not sure if this is better as a t-lang proposal. On one hand, the |
@rustbot second (I've been wanting to do some things in this area, and was expecting to remain WF-unsound for a while w/o a |
cc @rust-lang/types |
@rustbot label -final-comment-period +major-change-accepted |
…kh726 Implement `std::marker::Tuple` Split out from rust-lang#99943 (rust-lang#99943 (review)). Implements part of rust-lang/compiler-team#537 r? `@jackh726`
Implement `std::marker::Tuple` Split out from #99943 (rust-lang/rust#99943 (review)). Implements part of rust-lang/compiler-team#537 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 rust-lang#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 rust-lang#99820
Implement support for the `Tuple` trait Necessary to due to new trait bounds required by rust-lang/compiler-team#537 / rust-lang/rust#99943. 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
Implement `std::marker::Tuple` Split out from #99943 (rust-lang/rust#99943 (review)). Implements part of rust-lang/compiler-team#537 r? `@jackh726`
Implement `std::marker::Tuple` Split out from #99943 (rust-lang/rust#99943 (review)). Implements part of rust-lang/compiler-team#537 r? `@jackh726`
Proposal
Introduce
core::marker::Tuple
as a (for now, perma-unstable) builtin marker trait that is auto-implemented for all tuples, and require that calls to (and probably other related operations, like ptr coercion to) theextern "rust-call"
ABI enforces that the tupled argument type implementscore::marker::Tuple
. Generic"rust-call"
APIs will need to constrain their arguments, such as:This really should be reflected in the type system, since we can't fully enforce that nested calls involving type parameters are actually tuples until monomorphization, but span information is lacking during monomorphization (and so is bubbling up errors at that point) and properly denying bad
"rust-call"
usages has to be threaded through each codegen crate.For now, the scope of this marker trait is limited just to properly type check this quirk of the
"rust-call"
ABI. Further proposals will be needed if interest exists to flesh out this marker trait into something that can be used to introspect more tuple info (e.g. arity).See: rust-lang/rust#99820, bjorn3/rustc_codegen_cranelift#1236, rust-lang/rust#66696. More probably exist.
Mentors or Reviewers
Anyone on
t-compiler{,-contributors}
who's familiar withrustc_typeck
andrustc_trait_selection
should be able to review. Changes should be pretty trivial, and I've got a working branch already incompiler-errors/rust@tuple-marker
. it needs some diagnostic cleanup, but that's basically it...Process
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: