diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-16 11:32:38 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-16 12:08:00 +0100 |
| commit | c2fe7b63985ce8ec0a85adfa47e3c2d8f5b6dc3b (patch) | |
| tree | 2b0961905ff53913e8933a658a4dc376508a5bbb /src/comp | |
| parent | e1c50c4410804dfce9fbe040f341f6104cc9ba7e (diff) | |
| download | rust-c2fe7b63985ce8ec0a85adfa47e3c2d8f5b6dc3b.tar.gz rust-c2fe7b63985ce8ec0a85adfa47e3c2d8f5b6dc3b.zip | |
When pretty-printing fn types, leave off arg modes when they are the default
This reduces ++/&& spam in the output to a bare minimum. Issue #1507
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/util/ppaux.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index fe6dfc4fd8a..ddab92ed861 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -22,8 +22,16 @@ fn mode_str(m: ty::mode) -> str { fn ty_to_str(cx: ctxt, typ: t) -> str { fn fn_input_to_str(cx: ctxt, input: {mode: middle::ty::mode, ty: t}) -> str { - let s = mode_str(input.mode); - ret s + ty_to_str(cx, input.ty); + let modestr = alt input.mode { + ast::by_ref. { + ty::type_is_immediate(cx, input.ty) ? "&&" : "" + } + ast::by_val. { + ty::type_is_immediate(cx, input.ty) ? "" : "++" + } + _ { mode_str(input.mode) } + }; + modestr + ty_to_str(cx, input.ty) } fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option::t<ast::ident>, inputs: [arg], output: t, cf: ast::ret_style, |
