Skip to content

Commit 29aa46f

Browse files
committed
---
yaml --- r: 46408 b: refs/heads/auto c: b90ccc9 h: refs/heads/master v: v3
1 parent 14c18e7 commit 29aa46f

File tree

5 files changed

+54
-46
lines changed

5 files changed

+54
-46
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: ae86c03af261fd116d53f98766fb3700435b0bc1
17+
refs/heads/auto: b90ccc9a387bb568f92803a5f071e374c4663e80

branches/auto/src/librustc/middle/check_match.rs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -134,39 +134,47 @@ pub fn raw_pat(p: @pat) -> @pat {
134134
pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) {
135135
assert(!pats.is_empty());
136136
let ext = match is_useful(cx, vec::map(pats, |p| ~[*p]), ~[wild()]) {
137-
not_useful => return, // This is good, wildcard pattern isn't reachable
138-
useful_ => None,
139-
useful(ty, ref ctor) => {
140-
match ty::get(ty).sty {
141-
ty::ty_bool => {
142-
match (*ctor) {
143-
val(const_bool(true)) => Some(~"true"),
144-
val(const_bool(false)) => Some(~"false"),
145-
_ => None
146-
}
147-
}
148-
ty::ty_enum(id, _) => {
149-
let vid = match (*ctor) { variant(id) => id,
150-
_ => fail!(~"check_exhaustive: non-variant ctor") };
151-
match vec::find(*ty::enum_variants(cx.tcx, id),
152-
|v| v.id == vid) {
153-
Some(v) => Some(cx.tcx.sess.str_of(v.name)),
154-
None => fail!(~"check_exhaustive: bad variant in ctor")
155-
}
156-
}
157-
ty::ty_unboxed_vec(*) | ty::ty_evec(*) => {
158-
match (*ctor) {
159-
vec(n) => Some(fmt!("vectors of length %u", n)),
160-
_ => None
137+
not_useful => {
138+
// This is good, wildcard pattern isn't reachable
139+
return;
140+
}
141+
useful_ => None,
142+
useful(ty, ref ctor) => {
143+
match ty::get(ty).sty {
144+
ty::ty_bool => {
145+
match (*ctor) {
146+
val(const_bool(true)) => Some(~"true"),
147+
val(const_bool(false)) => Some(~"false"),
148+
_ => None
149+
}
150+
}
151+
ty::ty_enum(id, _) => {
152+
let vid = match (*ctor) {
153+
variant(id) => id,
154+
_ => fail!(~"check_exhaustive: non-variant ctor"),
155+
};
156+
let variants = ty::enum_variants(cx.tcx, id);
157+
158+
match variants.find(|v| v.id == vid) {
159+
Some(v) => Some(cx.tcx.sess.str_of(v.name)),
160+
None => {
161+
fail!(~"check_exhaustive: bad variant in ctor")
162+
}
163+
}
164+
}
165+
ty::ty_unboxed_vec(*) | ty::ty_evec(*) => {
166+
match (*ctor) {
167+
vec(n) => Some(fmt!("vectors of length %u", n)),
168+
_ => None
169+
}
170+
}
171+
_ => None
161172
}
162-
}
163-
_ => None
164173
}
165-
}
166174
};
167175
let msg = ~"non-exhaustive patterns" + match ext {
168-
Some(ref s) => ~": " + (*s) + ~" not covered",
169-
None => ~""
176+
Some(ref s) => ~": " + (*s) + ~" not covered",
177+
None => ~""
170178
};
171179
cx.tcx.sess.span_err(sp, msg);
172180
}

branches/auto/src/librustc/middle/lint.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -866,18 +866,18 @@ fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
866866
}
867867

868868
match it.node {
869-
ast::item_ty(*) | ast::item_struct(*) |
870-
ast::item_trait(*) => {
871-
check_case(cx, it.ident, it.id, it.id, it.span)
872-
}
873-
ast::item_enum(ref enum_definition, _) => {
874-
check_case(cx, it.ident, it.id, it.id, it.span);
875-
for enum_definition.variants.each |variant| {
876-
check_case(cx, variant.node.name,
877-
variant.node.id, it.id, variant.span);
869+
ast::item_ty(*) | ast::item_struct(*) |
870+
ast::item_trait(*) => {
871+
check_case(cx, it.ident, it.id, it.id, it.span)
878872
}
879-
}
880-
_ => ()
873+
ast::item_enum(ref enum_definition, _) => {
874+
check_case(cx, it.ident, it.id, it.id, it.span);
875+
for enum_definition.variants.each |variant| {
876+
check_case(cx, variant.node.name,
877+
variant.node.id, it.id, variant.span);
878+
}
879+
}
880+
_ => ()
881881
}
882882
}
883883

branches/auto/src/librustc/middle/trans/common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,15 +1141,15 @@ pub fn C_u8(i: uint) -> ValueRef {
11411141

11421142
// This is a 'c-like' raw string, which differs from
11431143
// our boxed-and-length-annotated strings.
1144-
pub fn C_cstr(cx: @crate_ctxt, +s: ~str) -> ValueRef {
1144+
pub fn C_cstr(cx: @crate_ctxt, s: ~str) -> ValueRef {
11451145
unsafe {
11461146
match cx.const_cstr_cache.find(&s) {
1147-
Some(llval) => return llval,
1148-
None => ()
1147+
Some(llval) => return llval,
1148+
None => ()
11491149
}
11501150

11511151
let sc = do str::as_c_str(s) |buf| {
1152-
llvm::LLVMConstString(buf, str::len(s) as c_uint, False)
1152+
llvm::LLVMConstString(buf, s.len() as c_uint, False)
11531153
};
11541154
let g =
11551155
str::as_c_str(fmt!("str%u", (cx.names)(~"str").repr),

branches/auto/src/librustc/middle/trans/reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub impl Reflector {
4545
C_int(self.bcx.ccx(), i)
4646
}
4747

48-
fn c_slice(&mut self, +s: ~str) -> ValueRef {
48+
fn c_slice(&mut self, s: &str) -> ValueRef {
4949
// We're careful to not use first class aggregates here because that
5050
// will kick us off fast isel. (Issue #4352.)
5151
let bcx = self.bcx;

0 commit comments

Comments
 (0)