diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-02-03 17:10:29 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-02-05 10:06:27 -0800 |
| commit | 966504c828ded5b6a0a9d4ff5264fb778570005e (patch) | |
| tree | 515a32c06638b0555a040482fb4b413a677f9b31 | |
| parent | daf0d63a59e5abfb32477748e8df4bffe1fbe2e1 (diff) | |
| download | rust-966504c828ded5b6a0a9d4ff5264fb778570005e.tar.gz rust-966504c828ded5b6a0a9d4ff5264fb778570005e.zip | |
don't fail if inference is not complete
| -rw-r--r-- | src/comp/middle/ty.rs | 1 | ||||
| -rw-r--r-- | src/comp/util/ppaux.rs | 17 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 02f687cb615..0826eda4cf3 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -167,6 +167,7 @@ export type_structurally_contains; export type_structurally_contains_uniques; export type_autoderef; export type_param; +export canon_mode; export resolved_mode; export arg_mode; export unify_mode; diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index 512b02ca734..969195a40ac 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -12,12 +12,19 @@ import middle::ast_map; 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, |
