Skip to content

Commit

Permalink
#[lang_item] for core::ptr::Unique
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanille-N committed Jun 16, 2023
1 parent 4996b56 commit dc3e91c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ language_item_table! {
EhCatchTypeinfo, sym::eh_catch_typeinfo, eh_catch_typeinfo, Target::Static, GenericRequirement::None;

OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1);
// Experimental language item for Miri
PtrUnique, sym::ptr_unique, ptr_unique, Target::Struct, GenericRequirement::Exact(1);

PhantomData, sym::phantom_data, phantom_data, Target::Struct, GenericRequirement::Exact(1);

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ symbols! {
ptr_null_mut,
ptr_offset_from,
ptr_offset_from_unsigned,
ptr_unique,
pub_macro_rules,
pub_restricted,
public,
Expand Down
2 changes: 2 additions & 0 deletions library/core/src/ptr/unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use crate::ptr::NonNull;
)]
#[doc(hidden)]
#[repr(transparent)]
// Lang item used experimentally by Miri to define the semantics of `Unique`.
#[cfg_attr(not(bootstrap), lang = "ptr_unique")]
pub struct Unique<T: ?Sized> {
pointer: NonNull<T>,
// NOTE: this marker has no consequences for variance, but is necessary
Expand Down

0 comments on commit dc3e91c

Please sign in to comment.