Skip to content

Commit b4a2861

Browse files
committed
Rename the "unsafe" lang item to "unsafe_cell"
1 parent ba2efe9 commit b4a2861

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

src/libcore/cell.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,8 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
649649
///
650650
/// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not
651651
/// recommended to access its fields directly, `get` should be used instead.
652-
#[lang="unsafe"]
652+
#[cfg_attr(stage0, lang="unsafe")] // NOTE: remove after next snapshot
653+
#[cfg_attr(not(stage0), lang="unsafe_cell")]
653654
#[stable(feature = "rust1", since = "1.0.0")]
654655
pub struct UnsafeCell<T> {
655656
/// Wrapped value

src/librustc/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ lets_do_this! {
271271
RangeToStructLangItem, "range_to", range_to_struct;
272272
RangeFullStructLangItem, "range_full", range_full_struct;
273273

274-
UnsafeTypeLangItem, "unsafe", unsafe_type;
274+
UnsafeCellTypeLangItem, "unsafe_cell", unsafe_cell_type;
275275

276276
DerefTraitLangItem, "deref", deref_trait;
277277
DerefMutTraitLangItem, "deref_mut", deref_mut_trait;

src/librustc/middle/traits/select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16541654
ty::BoundSync => {
16551655
if
16561656
Some(def_id) == tcx.lang_items.managed_bound() ||
1657-
Some(def_id) == tcx.lang_items.unsafe_type()
1657+
Some(def_id) == tcx.lang_items.unsafe_cell_type()
16581658
{
16591659
return Err(Unimplemented)
16601660
}

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3577,7 +3577,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
35773577
-> TypeContents {
35783578
if Some(did) == cx.lang_items.managed_bound() {
35793579
tc | TC::Managed
3580-
} else if Some(did) == cx.lang_items.unsafe_type() {
3580+
} else if Some(did) == cx.lang_items.unsafe_cell_type() {
35813581
tc | TC::InteriorUnsafe
35823582
} else {
35833583
tc

src/librustc_typeck/variance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
453453
invariant_lang_items[RegionParam as uint] =
454454
terms_cx.tcx.lang_items.invariant_lifetime();
455455

456-
let unsafe_lang_item = terms_cx.tcx.lang_items.unsafe_type();
456+
let unsafe_lang_item = terms_cx.tcx.lang_items.unsafe_cell_type();
457457

458458
let covariant = terms_cx.arena.alloc(ConstantTerm(ty::Covariant));
459459
let contravariant = terms_cx.arena.alloc(ConstantTerm(ty::Contravariant));

0 commit comments

Comments
 (0)