Skip to content

Commit

Permalink
rustc: Remove special treatment for Freeze and NoFreeze
Browse files Browse the repository at this point in the history
Fixes #12577
  • Loading branch information
flaper87 committed Mar 22, 2014
1 parent 30165e0 commit aa75194
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 31 deletions.
3 changes: 0 additions & 3 deletions src/librustc/metadata/tydecode.rs
Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc/metadata/tyencode.rs
Expand Up @@ -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"),
Expand Down
8 changes: 2 additions & 6 deletions src/librustc/middle/lang_items.rs
Expand Up @@ -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".
//
Expand Down Expand Up @@ -82,9 +82,7 @@ impl LanguageItems {
}

pub fn to_builtin_kind(&self, id: ast::DefId) -> Option<ty::BuiltinBound> {
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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
21 changes: 2 additions & 19 deletions src/librustc/middle/ty.rs
Expand Up @@ -838,7 +838,6 @@ pub type BuiltinBounds = EnumSet<BuiltinBound>;
pub enum BuiltinBound {
BoundStatic,
BoundSend,
BoundFreeze,
BoundSized,
BoundPod,
BoundShare,
Expand All @@ -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
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/util/ppaux.rs
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit aa75194

Please sign in to comment.