rustc: Remove special treatment for Freeze and NoFreeze

Fixes #12577
This commit is contained in:
Flavio Percoco 2014-03-22 00:16:56 +01:00
parent 30165e059c
commit aa7519400e
5 changed files with 4 additions and 31 deletions

View File

@ -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);
}

View File

@ -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"),

View File

@ -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<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)
@ -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;

View File

@ -838,7 +838,6 @@ pub type BuiltinBounds = EnumSet<BuiltinBound>;
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,

View File

@ -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",