Skip to content

Commit 966504c

Browse files
committed
don't fail if inference is not complete
1 parent daf0d63 commit 966504c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/comp/middle/ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export type_structurally_contains;
167167
export type_structurally_contains_uniques;
168168
export type_autoderef;
169169
export type_param;
170+
export canon_mode;
170171
export resolved_mode;
171172
export arg_mode;
172173
export unify_mode;

src/comp/util/ppaux.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,19 @@ import middle::ast_map;
1212
fn ty_to_str(cx: ctxt, typ: t) -> str {
1313
fn fn_input_to_str(cx: ctxt, input: {mode: ast::mode, ty: t}) ->
1414
str {
15-
let arg_mode = ty::arg_mode(cx, input);
16-
let modestr = {
17-
if arg_mode == ty::default_arg_mode_for_ty(cx, input.ty) { "" }
18-
else { mode_to_str(input.mode) }
15+
let {mode, ty} = input;
16+
let modestr = alt canon_mode(cx, mode) {
17+
ast::infer(_) { "" }
18+
ast::expl(m) {
19+
if !ty::type_contains_vars(cx, ty) &&
20+
m == ty::default_arg_mode_for_ty(cx, ty) {
21+
""
22+
} else {
23+
mode_to_str(ast::expl(m))
24+
}
25+
}
1926
};
20-
modestr + ty_to_str(cx, input.ty)
27+
modestr + ty_to_str(cx, ty)
2128
}
2229
fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option<ast::ident>,
2330
inputs: [arg], output: t, cf: ast::ret_style,

0 commit comments

Comments
 (0)