Add Tuple marker trait

This commit is contained in:
Michael Goulet 2022-07-30 01:53:29 +00:00
parent d394408fb3
commit 6b2eab2310
3 changed files with 12 additions and 0 deletions

View file

@ -290,6 +290,8 @@ language_item_table! {
Try, sym::Try, try_trait, Target::Trait, GenericRequirement::None;
Tuple, sym::tuple_trait, tuple_trait, Target::Trait, GenericRequirement::Exact(0);
SliceLen, sym::slice_len_fn, slice_len_fn, Target::Method(MethodKind::Inherent), GenericRequirement::None;
// Language items from AST lowering

View file

@ -1481,6 +1481,7 @@ symbols! {
tuple,
tuple_from_req,
tuple_indexing,
tuple_trait,
two_phase,
ty,
type_alias_enum_variants,

View file

@ -800,6 +800,15 @@ impl<T: ?Sized> Unpin for *mut T {}
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
pub trait Destruct {}
/// A marker for tuple types.
///
/// The implementation of this trait is built-in and cannot be implemented
/// for any user type.
#[unstable(feature = "tuple_trait", issue = "none")]
#[cfg_attr(not(bootstrap), lang = "tuple_trait")]
#[rustc_on_unimplemented(message = "`{Self}` is not a tuple")]
pub trait Tuple {}
/// Implementations of `Copy` for primitive types.
///
/// Implementations that cannot be described in Rust