Skip to content

Commit dc3e91c

Browse files
committed
#[lang_item] for core::ptr::Unique
1 parent 4996b56 commit dc3e91c

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

compiler/rustc_hir/src/lang_items.rs

+2
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ language_item_table! {
260260
EhCatchTypeinfo, sym::eh_catch_typeinfo, eh_catch_typeinfo, Target::Static, GenericRequirement::None;
261261

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

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

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ symbols! {
11561156
ptr_null_mut,
11571157
ptr_offset_from,
11581158
ptr_offset_from_unsigned,
1159+
ptr_unique,
11591160
pub_macro_rules,
11601161
pub_restricted,
11611162
public,

library/core/src/ptr/unique.rs

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ use crate::ptr::NonNull;
3232
)]
3333
#[doc(hidden)]
3434
#[repr(transparent)]
35+
// Lang item used experimentally by Miri to define the semantics of `Unique`.
36+
#[cfg_attr(not(bootstrap), lang = "ptr_unique")]
3537
pub struct Unique<T: ?Sized> {
3638
pointer: NonNull<T>,
3739
// NOTE: this marker has no consequences for variance, but is necessary

0 commit comments

Comments
 (0)