Skip to content

Commit aa75194

Browse files
committed
rustc: Remove special treatment for Freeze and NoFreeze
Fixes #12577
1 parent 30165e0 commit aa75194

File tree

5 files changed

+4
-31
lines changed

5 files changed

+4
-31
lines changed

src/librustc/metadata/tydecode.rs

-3
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,6 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
590590
'S' => {
591591
param_bounds.builtin_bounds.add(ty::BoundSend);
592592
}
593-
'K' => {
594-
param_bounds.builtin_bounds.add(ty::BoundFreeze);
595-
}
596593
'O' => {
597594
param_bounds.builtin_bounds.add(ty::BoundStatic);
598595
}

src/librustc/metadata/tyencode.rs

-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
405405
for bound in bs.builtin_bounds.iter() {
406406
match bound {
407407
ty::BoundSend => mywrite!(w, "S"),
408-
ty::BoundFreeze => mywrite!(w, "K"),
409408
ty::BoundStatic => mywrite!(w, "O"),
410409
ty::BoundSized => mywrite!(w, "Z"),
411410
ty::BoundPod => mywrite!(w, "P"),

src/librustc/middle/lang_items.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Language items are items that represent concepts intrinsic to the language
1414
// itself. Examples are:
1515
//
16-
// * Traits that specify "kinds"; e.g. "Freeze", "Send".
16+
// * Traits that specify "kinds"; e.g. "Share", "Send".
1717
//
1818
// * Traits that represent operators; e.g. "Add", "Sub", "Index".
1919
//
@@ -82,9 +82,7 @@ impl LanguageItems {
8282
}
8383

8484
pub fn to_builtin_kind(&self, id: ast::DefId) -> Option<ty::BuiltinBound> {
85-
if Some(id) == self.freeze_trait() {
86-
Some(ty::BoundFreeze)
87-
} else if Some(id) == self.send_trait() {
85+
if Some(id) == self.send_trait() {
8886
Some(ty::BoundSend)
8987
} else if Some(id) == self.sized_trait() {
9088
Some(ty::BoundSized)
@@ -210,7 +208,6 @@ pub fn collect_language_items(krate: &ast::Crate,
210208

211209
lets_do_this! {
212210
// Variant name, Name, Method name;
213-
FreezeTraitLangItem, "freeze", freeze_trait;
214211
SendTraitLangItem, "send", send_trait;
215212
SizedTraitLangItem, "sized", sized_trait;
216213
PodTraitLangItem, "pod", pod_trait;
@@ -275,7 +272,6 @@ lets_do_this! {
275272
ContravariantLifetimeItem, "contravariant_lifetime", contravariant_lifetime;
276273
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;
277274

278-
NoFreezeItem, "no_freeze_bound", no_freeze_bound;
279275
NoSendItem, "no_send_bound", no_send_bound;
280276
NoPodItem, "no_pod_bound", no_pod_bound;
281277
NoShareItem, "no_share_bound", no_share_bound;

src/librustc/middle/ty.rs

+2-19
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,6 @@ pub type BuiltinBounds = EnumSet<BuiltinBound>;
838838
pub enum BuiltinBound {
839839
BoundStatic,
840840
BoundSend,
841-
BoundFreeze,
842841
BoundSized,
843842
BoundPod,
844843
BoundShare,
@@ -852,7 +851,6 @@ pub fn AllBuiltinBounds() -> BuiltinBounds {
852851
let mut set = EnumSet::empty();
853852
set.add(BoundStatic);
854853
set.add(BoundSend);
855-
set.add(BoundFreeze);
856854
set.add(BoundSized);
857855
set.add(BoundShare);
858856
set
@@ -1902,9 +1900,6 @@ def_type_content_sets!(
19021900
// that it neither reaches nor owns a managed pointer.
19031901
Nonsendable = 0b0000_0111__0000_0100__0000,
19041902

1905-
// Things that prevent values from being considered freezable
1906-
Nonfreezable = 0b0000_1000__0000_0000__0000,
1907-
19081903
// Things that prevent values from being considered 'static
19091904
Nonstatic = 0b0000_0010__0000_0000__0000,
19101905

@@ -1939,7 +1934,6 @@ impl TypeContents {
19391934
pub fn meets_bound(&self, cx: &ctxt, bb: BuiltinBound) -> bool {
19401935
match bb {
19411936
BoundStatic => self.is_static(cx),
1942-
BoundFreeze => self.is_freezable(cx),
19431937
BoundSend => self.is_sendable(cx),
19441938
BoundSized => self.is_sized(cx),
19451939
BoundPod => self.is_pod(cx),
@@ -1975,10 +1969,6 @@ impl TypeContents {
19751969
self.intersects(TC::OwnsOwned)
19761970
}
19771971

1978-
pub fn is_freezable(&self, _: &ctxt) -> bool {
1979-
!self.intersects(TC::Nonfreezable)
1980-
}
1981-
19821972
pub fn is_sized(&self, _: &ctxt) -> bool {
19831973
!self.intersects(TC::Nonsized)
19841974
}
@@ -2083,10 +2073,6 @@ pub fn type_is_sendable(cx: &ctxt, t: ty::t) -> bool {
20832073
type_contents(cx, t).is_sendable(cx)
20842074
}
20852075

2086-
pub fn type_is_freezable(cx: &ctxt, t: ty::t) -> bool {
2087-
type_contents(cx, t).is_freezable(cx)
2088-
}
2089-
20902076
pub fn type_interior_is_unsafe(cx: &ctxt, t: ty::t) -> bool {
20912077
type_contents(cx, t).interior_unsafe()
20922078
}
@@ -2149,7 +2135,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
21492135
cache.insert(ty_id, TC::None);
21502136

21512137
let result = match get(ty).sty {
2152-
// Scalar and unique types are sendable, freezable, and durable
2138+
// Scalar and unique types are sendable, and durable
21532139
ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
21542140
ty_bare_fn(_) | ty::ty_char => {
21552141
TC::None
@@ -2287,9 +2273,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
22872273
did: ast::DefId,
22882274
tc: TypeContents)
22892275
-> TypeContents {
2290-
if Some(did) == cx.lang_items.no_freeze_bound() {
2291-
tc | TC::ReachesMutable
2292-
} else if Some(did) == cx.lang_items.no_send_bound() {
2276+
if Some(did) == cx.lang_items.no_send_bound() {
22932277
tc | TC::ReachesNonsendAnnot
22942278
} else if Some(did) == cx.lang_items.managed_bound() {
22952279
tc | TC::Managed
@@ -2374,7 +2358,6 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
23742358
tc = tc - match bound {
23752359
BoundStatic => TC::Nonstatic,
23762360
BoundSend => TC::Nonsendable,
2377-
BoundFreeze => TC::Nonfreezable,
23782361
BoundSized => TC::Nonsized,
23792362
BoundPod => TC::Nonpod,
23802363
BoundShare => TC::Nonsharable,

src/librustc/util/ppaux.rs

-2
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ impl Repr for ty::ParamBounds {
666666
res.push(match b {
667667
ty::BoundStatic => ~"'static",
668668
ty::BoundSend => ~"Send",
669-
ty::BoundFreeze => ~"Freeze",
670669
ty::BoundSized => ~"Sized",
671670
ty::BoundPod => ~"Pod",
672671
ty::BoundShare => ~"Share",
@@ -954,7 +953,6 @@ impl UserString for ty::BuiltinBound {
954953
match *self {
955954
ty::BoundStatic => ~"'static",
956955
ty::BoundSend => ~"Send",
957-
ty::BoundFreeze => ~"Freeze",
958956
ty::BoundSized => ~"Sized",
959957
ty::BoundPod => ~"Pod",
960958
ty::BoundShare => ~"Share",

0 commit comments

Comments
 (0)