From aa7519400e15ae92687cea17b8264ad32f5f5faf Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Sat, 22 Mar 2014 00:16:56 +0100 Subject: [PATCH] rustc: Remove special treatment for Freeze and NoFreeze Fixes #12577 --- src/librustc/metadata/tydecode.rs | 3 --- src/librustc/metadata/tyencode.rs | 1 - src/librustc/middle/lang_items.rs | 8 ++------ src/librustc/middle/ty.rs | 21 ++------------------- src/librustc/util/ppaux.rs | 2 -- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index c8ab6818697..8c8bcd312de 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -590,9 +590,6 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds { 'S' => { param_bounds.builtin_bounds.add(ty::BoundSend); } - 'K' => { - param_bounds.builtin_bounds.add(ty::BoundFreeze); - } 'O' => { param_bounds.builtin_bounds.add(ty::BoundStatic); } diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 35014d4085a..812c14e9062 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -405,7 +405,6 @@ fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) { for bound in bs.builtin_bounds.iter() { match bound { ty::BoundSend => mywrite!(w, "S"), - ty::BoundFreeze => mywrite!(w, "K"), ty::BoundStatic => mywrite!(w, "O"), ty::BoundSized => mywrite!(w, "Z"), ty::BoundPod => mywrite!(w, "P"), diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 2a1cb6f5a8f..67c597f927a 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -13,7 +13,7 @@ // Language items are items that represent concepts intrinsic to the language // itself. Examples are: // -// * Traits that specify "kinds"; e.g. "Freeze", "Send". +// * Traits that specify "kinds"; e.g. "Share", "Send". // // * Traits that represent operators; e.g. "Add", "Sub", "Index". // @@ -82,9 +82,7 @@ impl LanguageItems { } pub fn to_builtin_kind(&self, id: ast::DefId) -> Option { - if Some(id) == self.freeze_trait() { - Some(ty::BoundFreeze) - } else if Some(id) == self.send_trait() { + if Some(id) == self.send_trait() { Some(ty::BoundSend) } else if Some(id) == self.sized_trait() { Some(ty::BoundSized) @@ -210,7 +208,6 @@ pub fn collect_language_items(krate: &ast::Crate, lets_do_this! { // Variant name, Name, Method name; - FreezeTraitLangItem, "freeze", freeze_trait; SendTraitLangItem, "send", send_trait; SizedTraitLangItem, "sized", sized_trait; PodTraitLangItem, "pod", pod_trait; @@ -275,7 +272,6 @@ lets_do_this! { ContravariantLifetimeItem, "contravariant_lifetime", contravariant_lifetime; InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime; - NoFreezeItem, "no_freeze_bound", no_freeze_bound; NoSendItem, "no_send_bound", no_send_bound; NoPodItem, "no_pod_bound", no_pod_bound; NoShareItem, "no_share_bound", no_share_bound; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 61cadfea253..51d7045cba6 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -838,7 +838,6 @@ pub type BuiltinBounds = EnumSet; pub enum BuiltinBound { BoundStatic, BoundSend, - BoundFreeze, BoundSized, BoundPod, BoundShare, @@ -852,7 +851,6 @@ pub fn AllBuiltinBounds() -> BuiltinBounds { let mut set = EnumSet::empty(); set.add(BoundStatic); set.add(BoundSend); - set.add(BoundFreeze); set.add(BoundSized); set.add(BoundShare); set @@ -1902,9 +1900,6 @@ def_type_content_sets!( // that it neither reaches nor owns a managed pointer. Nonsendable = 0b0000_0111__0000_0100__0000, - // Things that prevent values from being considered freezable - Nonfreezable = 0b0000_1000__0000_0000__0000, - // Things that prevent values from being considered 'static Nonstatic = 0b0000_0010__0000_0000__0000, @@ -1939,7 +1934,6 @@ impl TypeContents { pub fn meets_bound(&self, cx: &ctxt, bb: BuiltinBound) -> bool { match bb { BoundStatic => self.is_static(cx), - BoundFreeze => self.is_freezable(cx), BoundSend => self.is_sendable(cx), BoundSized => self.is_sized(cx), BoundPod => self.is_pod(cx), @@ -1975,10 +1969,6 @@ impl TypeContents { self.intersects(TC::OwnsOwned) } - pub fn is_freezable(&self, _: &ctxt) -> bool { - !self.intersects(TC::Nonfreezable) - } - pub fn is_sized(&self, _: &ctxt) -> bool { !self.intersects(TC::Nonsized) } @@ -2083,10 +2073,6 @@ pub fn type_is_sendable(cx: &ctxt, t: ty::t) -> bool { type_contents(cx, t).is_sendable(cx) } -pub fn type_is_freezable(cx: &ctxt, t: ty::t) -> bool { - type_contents(cx, t).is_freezable(cx) -} - pub fn type_interior_is_unsafe(cx: &ctxt, t: ty::t) -> bool { type_contents(cx, t).interior_unsafe() } @@ -2149,7 +2135,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { cache.insert(ty_id, TC::None); let result = match get(ty).sty { - // Scalar and unique types are sendable, freezable, and durable + // Scalar and unique types are sendable, and durable ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_bare_fn(_) | ty::ty_char => { TC::None @@ -2287,9 +2273,7 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { did: ast::DefId, tc: TypeContents) -> TypeContents { - if Some(did) == cx.lang_items.no_freeze_bound() { - tc | TC::ReachesMutable - } else if Some(did) == cx.lang_items.no_send_bound() { + if Some(did) == cx.lang_items.no_send_bound() { tc | TC::ReachesNonsendAnnot } else if Some(did) == cx.lang_items.managed_bound() { tc | TC::Managed @@ -2374,7 +2358,6 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents { tc = tc - match bound { BoundStatic => TC::Nonstatic, BoundSend => TC::Nonsendable, - BoundFreeze => TC::Nonfreezable, BoundSized => TC::Nonsized, BoundPod => TC::Nonpod, BoundShare => TC::Nonsharable, diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index b2568c60dc0..16b2ebe2247 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -666,7 +666,6 @@ impl Repr for ty::ParamBounds { res.push(match b { ty::BoundStatic => ~"'static", ty::BoundSend => ~"Send", - ty::BoundFreeze => ~"Freeze", ty::BoundSized => ~"Sized", ty::BoundPod => ~"Pod", ty::BoundShare => ~"Share", @@ -954,7 +953,6 @@ impl UserString for ty::BuiltinBound { match *self { ty::BoundStatic => ~"'static", ty::BoundSend => ~"Send", - ty::BoundFreeze => ~"Freeze", ty::BoundSized => ~"Sized", ty::BoundPod => ~"Pod", ty::BoundShare => ~"Share",