Skip to content

Commit bb923a7

Browse files
committed
---
yaml --- r: 15594 b: refs/heads/try c: 734166f h: refs/heads/master v: v3
1 parent d3c6f2f commit bb923a7

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 43061f3969d1d961bd4e4d57c06452ca80c1adb6
5+
refs/heads/try: 734166f41c3c5ba48498df0133383a451e7fdb3e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/tstate/ck.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import middle::ty;
77
import tstate::ann::{precond, prestate,
88
implies, ann_precond, ann_prestate};
99
import aux::*;
10-
import syntax::print::pprust::ty_to_str;
10+
11+
import util::ppaux::ty_to_str;
1112
import bitvectors::*;
1213
import annotate::annotate_crate;
1314
import collect_locals::mk_f_to_fn_info;
@@ -116,13 +117,14 @@ fn check_states_against_conditions(fcx: fn_ctxt,
116117
!ty::type_is_nil(ty::ty_fn_ret(ty::node_id_to_type(
117118
fcx.ccx.tcx, id))) &&
118119
f_decl.cf == return_val {
120+
let fn_ty = ty::node_id_to_type(fcx.ccx.tcx, id);
119121
fcx.ccx.tcx.sess.span_err(f_body.span,
120-
"in function " + fcx.name +
121-
", not all control paths \
122-
return a value");
122+
#fmt("in function `%s`, not all control paths \
123+
return a value", fcx.name));
123124
fcx.ccx.tcx.sess.span_fatal(f_decl.output.span,
124-
"see declared return type of '" +
125-
ty_to_str(f_decl.output) + "'");
125+
#fmt("see function return type of `%s`",
126+
ty_to_str(fcx.ccx.tcx,
127+
ty::ty_fn_ret(fn_ty))));
126128
} else if f_decl.cf == noreturn {
127129

128130
// check that this really always fails
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main(s: [str]) {
2+
let a = [];
3+
vec::each(a) { |x| //! ERROR in function `anon`, not all control paths
4+
} //! ERROR see function return type of `bool`
5+
}

0 commit comments

Comments
 (0)