提交 966504c8 编写于 作者: N Niko Matsakis

don't fail if inference is not complete

上级 daf0d63a
......@@ -167,6 +167,7 @@
export type_structurally_contains_uniques;
export type_autoderef;
export type_param;
export canon_mode;
export resolved_mode;
export arg_mode;
export unify_mode;
......
......@@ -12,12 +12,19 @@
fn ty_to_str(cx: ctxt, typ: t) -> str {
fn fn_input_to_str(cx: ctxt, input: {mode: ast::mode, ty: t}) ->
str {
let arg_mode = ty::arg_mode(cx, input);
let modestr = {
if arg_mode == ty::default_arg_mode_for_ty(cx, input.ty) { "" }
else { mode_to_str(input.mode) }
let {mode, ty} = input;
let modestr = alt canon_mode(cx, mode) {
ast::infer(_) { "" }
ast::expl(m) {
if !ty::type_contains_vars(cx, ty) &&
m == ty::default_arg_mode_for_ty(cx, ty) {
""
} else {
mode_to_str(ast::expl(m))
}
}
};
modestr + ty_to_str(cx, input.ty)
modestr + ty_to_str(cx, ty)
}
fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option<ast::ident>,
inputs: [arg], output: t, cf: ast::ret_style,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册