Skip to content

Commit 67bac63

Browse files
committed
rustc: Correctly report mutability when stringifying types
1 parent 2ca6671 commit 67bac63

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/comp/middle/ty.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -147,35 +147,35 @@ fn ty_to_str(&@t typ) -> str {
147147
}
148148

149149
alt (typ.struct) {
150-
case (ty_native) { s = "native"; }
151-
case (ty_nil) { s = "()"; }
152-
case (ty_bool) { s = "bool"; }
153-
case (ty_int) { s = "int"; }
154-
case (ty_uint) { s = "uint"; }
155-
case (ty_machine(?tm)) { s = common.ty_mach_to_str(tm); }
156-
case (ty_char) { s = "char"; }
157-
case (ty_str) { s = "str"; }
158-
case (ty_box(?t)) { s = "@" + ty_to_str(t); }
159-
case (ty_vec(?t)) { s = "vec[" + ty_to_str(t) + "]"; }
160-
case (ty_port(?t)) { s = "port[" + ty_to_str(t) + "]"; }
161-
case (ty_chan(?t)) { s = "chan[" + ty_to_str(t) + "]"; }
162-
case (ty_type) { s = "type"; }
150+
case (ty_native) { s += "native"; }
151+
case (ty_nil) { s += "()"; }
152+
case (ty_bool) { s += "bool"; }
153+
case (ty_int) { s += "int"; }
154+
case (ty_uint) { s += "uint"; }
155+
case (ty_machine(?tm)) { s += common.ty_mach_to_str(tm); }
156+
case (ty_char) { s += "char"; }
157+
case (ty_str) { s += "str"; }
158+
case (ty_box(?t)) { s += "@" + ty_to_str(t); }
159+
case (ty_vec(?t)) { s += "vec[" + ty_to_str(t) + "]"; }
160+
case (ty_port(?t)) { s += "port[" + ty_to_str(t) + "]"; }
161+
case (ty_chan(?t)) { s += "chan[" + ty_to_str(t) + "]"; }
162+
case (ty_type) { s += "type"; }
163163

164164
case (ty_tup(?elems)) {
165165
auto f = ty_to_str;
166166
auto strs = _vec.map[@t,str](f, elems);
167-
s = "tup(" + _str.connect(strs, ",") + ")";
167+
s += "tup(" + _str.connect(strs, ",") + ")";
168168
}
169169

170170
case (ty_rec(?elems)) {
171171
auto f = field_to_str;
172172
auto strs = _vec.map[field,str](f, elems);
173-
s = "rec(" + _str.connect(strs, ",") + ")";
173+
s += "rec(" + _str.connect(strs, ",") + ")";
174174
}
175175

176176
case (ty_tag(?id, ?tps)) {
177177
// The user should never see this if the cname is set properly!
178-
s = "<tag#" + util.common.istr(id._0) + ":" +
178+
s += "<tag#" + util.common.istr(id._0) + ":" +
179179
util.common.istr(id._1) + ">";
180180
if (_vec.len[@t](tps) > 0u) {
181181
auto f = ty_to_str;
@@ -185,31 +185,31 @@ fn ty_to_str(&@t typ) -> str {
185185
}
186186

187187
case (ty_fn(?proto, ?inputs, ?output)) {
188-
s = fn_to_str(proto, none[ast.ident], inputs, output);
188+
s += fn_to_str(proto, none[ast.ident], inputs, output);
189189
}
190190

191191
case (ty_native_fn(_, ?inputs, ?output)) {
192-
s = fn_to_str(ast.proto_fn, none[ast.ident], inputs, output);
192+
s += fn_to_str(ast.proto_fn, none[ast.ident], inputs, output);
193193
}
194194

195195
case (ty_obj(?meths)) {
196196
auto f = method_to_str;
197197
auto m = _vec.map[method,str](f, meths);
198-
s = "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
198+
s += "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
199199
}
200200

201201
case (ty_var(?v)) {
202-
s = "<T" + util.common.istr(v) + ">";
202+
s += "<T" + util.common.istr(v) + ">";
203203
}
204204

205205
case (ty_local(?id)) {
206-
s = "<L" + util.common.istr(id._0) + ":" + util.common.istr(id._1)
207-
+ ">";
206+
s += "<L" + util.common.istr(id._0) + ":" +
207+
util.common.istr(id._1) + ">";
208208
}
209209

210210
case (ty_param(?id)) {
211-
s = "<P" + util.common.istr(id._0) + ":" + util.common.istr(id._1)
212-
+ ">";
211+
s += "<P" + util.common.istr(id._0) + ":" +
212+
util.common.istr(id._1) + ">";
213213
}
214214
}
215215

0 commit comments

Comments
 (0)