Skip to content

Commit 6b23175

Browse files
committed
---
yaml --- r: 58849 b: refs/heads/incoming c: bc52224 h: refs/heads/master i: 58847: 72a1889 v: v3
1 parent 92ca7bf commit 6b23175

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 66842c857635f7f35523bea87fc04700d68dfad7
9+
refs/heads/incoming: bc52224d479c0af1e36d2b12e5cf00c0c0fb3810
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/middle/ty.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,13 +2022,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20222022
if ty::has_dtor(cx, did) {
20232023
res += TC_DTOR;
20242024
}
2025-
if has_attr(cx, did, "mutable") {
2026-
res += TC_MUTABLE;
2027-
}
2028-
if has_attr(cx, did, "non_owned") {
2029-
res += TC_NON_OWNED;
2030-
}
2031-
res
2025+
apply_tc_attr(cx, did, res)
20322026
}
20332027
20342028
ty_tup(ref tys) => {
@@ -2037,7 +2031,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20372031
20382032
ty_enum(did, ref substs) => {
20392033
let variants = substd_enum_variants(cx, did, substs);
2040-
let mut res = if variants.is_empty() {
2034+
let res = if variants.is_empty() {
20412035
// we somewhat arbitrary declare that empty enums
20422036
// are non-copyable
20432037
TC_EMPTY_ENUM
@@ -2048,13 +2042,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20482042
|tc, arg_ty| *tc + tc_ty(cx, *arg_ty, cache))
20492043
})
20502044
};
2051-
if has_attr(cx, did, "mutable") {
2052-
res += TC_MUTABLE;
2053-
}
2054-
if has_attr(cx, did, "non_owned") {
2055-
res += TC_NON_OWNED;
2056-
}
2057-
res
2045+
apply_tc_attr(cx, did, res)
20582046
}
20592047
20602048
ty_param(p) => {
@@ -2114,6 +2102,16 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
21142102
mc + tc_ty(cx, mt.ty, cache)
21152103
}
21162104
2105+
fn apply_tc_attr(cx: ctxt, did: def_id, mut tc: TypeContents) -> TypeContents {
2106+
if has_attr(cx, did, "mutable") {
2107+
tc += TC_MUTABLE;
2108+
}
2109+
if has_attr(cx, did, "non_owned") {
2110+
tc += TC_NON_OWNED;
2111+
}
2112+
tc
2113+
}
2114+
21172115
fn borrowed_contents(region: ty::Region,
21182116
mutbl: ast::mutability) -> TypeContents
21192117
{

0 commit comments

Comments
 (0)