generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Labels
Z-ContractsIssue related to code contractsIssue related to code contracts[C] Feature / EnhancementA new feature request or enhancement to an existing feature.A new feature request or enhancement to an existing feature.[E] User ExperienceAn UX enhancement for an existing feature. Including deprecation of an existing one.An UX enhancement for an existing feature. Including deprecation of an existing one.
Milestone
Description
Requested feature: Allow users to annotate external "C" functions and intrinsics with contracts.
Use case: Adding safety contracts to std intrinsics and extern "C" functions.
Link to relevant documentation (Rust reference, Nomicon, RFC):
Test case:
/// The size of the referenced value in bytes.
///
/// The stabilized version of this intrinsic is [`crate::mem::size_of_val`].
#[rustc_const_unstable(feature = "const_size_of_val", issue = "46571")]
#[rustc_nounwind]
#[requires(matches!(
<T as Pointee>::Metadata::map_dyn(crate::ptr::metadata(_val)::metadata(), |dyn_meta| {
ub_checks::can_dereference(dyn_meta)}), None | Some(true)))]
pub fn size_of_val<T: ?Sized>(_val: *const T) -> usize;Fails with the following compilation error:
error: expected curly braces
--> /verify-std/library/core/src/intrinsics.rs:1070:59
|
1070 | pub fn size_of_val<T: ?Sized>(_val: *const T) -> usize;
Metadata
Metadata
Assignees
Labels
Z-ContractsIssue related to code contractsIssue related to code contracts[C] Feature / EnhancementA new feature request or enhancement to an existing feature.A new feature request or enhancement to an existing feature.[E] User ExperienceAn UX enhancement for an existing feature. Including deprecation of an existing one.An UX enhancement for an existing feature. Including deprecation of an existing one.