Introduce CoerceShared lang item and trait
This commit is contained in:
@@ -441,6 +441,7 @@ language_item_table! {
|
|||||||
|
|
||||||
// Reborrowing related lang-items
|
// Reborrowing related lang-items
|
||||||
Reborrow, sym::reborrow, reborrow, Target::Trait, GenericRequirement::Exact(0);
|
Reborrow, sym::reborrow, reborrow, Target::Trait, GenericRequirement::Exact(0);
|
||||||
|
CoerceShared, sym::coerce_shared, coerce_shared, Target::Trait, GenericRequirement::Exact(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The requirement imposed on the generics of a lang item
|
/// The requirement imposed on the generics of a lang item
|
||||||
|
|||||||
@@ -679,6 +679,7 @@ symbols! {
|
|||||||
cmpxchg16b_target_feature,
|
cmpxchg16b_target_feature,
|
||||||
cmse_nonsecure_entry,
|
cmse_nonsecure_entry,
|
||||||
coerce_pointee_validated,
|
coerce_pointee_validated,
|
||||||
|
coerce_shared,
|
||||||
coerce_unsized,
|
coerce_unsized,
|
||||||
cold,
|
cold,
|
||||||
cold_path,
|
cold_path,
|
||||||
|
|||||||
@@ -1372,3 +1372,12 @@ pub trait CoercePointeeValidated {
|
|||||||
pub trait Reborrow {
|
pub trait Reborrow {
|
||||||
// Empty.
|
// Empty.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allows reborrowable value to be reborrowed as shared, creating a copy of
|
||||||
|
/// that disables the source for writes for the lifetime of the copy.
|
||||||
|
#[lang = "coerce_shared"]
|
||||||
|
#[unstable(feature = "reborrow", issue = "145612")]
|
||||||
|
pub trait CoerceShared: Reborrow {
|
||||||
|
/// The type of this value when reborrowed as shared.
|
||||||
|
type Target: Copy;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user