Skip to content

Commit 5801182

Browse files
committed
---
yaml --- r: 151179 b: refs/heads/try2 c: 3a0d8fd h: refs/heads/master i: 151177: 78ae7f1 151175: 97bbb9d v: v3
1 parent 4a3dfa0 commit 5801182

File tree

29 files changed

+136
-85
lines changed

29 files changed

+136
-85
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cbe6bd0a9d8228a8a857223b9b9d69f75242f58f
8+
refs/heads/try2: 3a0d8fd980325162caeed6b4c81fa2cd1a5b990b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/back/link.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,18 +1150,6 @@ fn link_args(sess: &Session,
11501150
sess.opts.optimize == session::Aggressive {
11511151
args.push("-Wl,-O1".to_owned());
11521152
}
1153-
} else if sess.targ_cfg.os == abi::OsMacos {
1154-
// The dead_strip option to the linker specifies that functions and data
1155-
// unreachable by the entry point will be removed. This is quite useful
1156-
// with Rust's compilation model of compiling libraries at a time into
1157-
// one object file. For example, this brings hello world from 1.7MB to
1158-
// 458K.
1159-
//
1160-
// Note that this is done for both executables and dynamic libraries. We
1161-
// won't get much benefit from dylibs because LLVM will have already
1162-
// stripped away as much as it could. This has not been seen to impact
1163-
// link times negatively.
1164-
args.push("-Wl,-dead_strip".to_owned());
11651153
}
11661154

11671155
if sess.targ_cfg.os == abi::OsWin32 {

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
344344
return ty::mk_vec(st.tcx, mt, sz);
345345
}
346346
'v' => {
347-
return ty::mk_str(st.tcx);
347+
let sz = parse_size(st);
348+
return ty::mk_str(st.tcx, sz);
348349
}
349350
'T' => {
350351
assert_eq!(next(st), '[');

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,13 @@ fn enc_sty(w: &mut MemWriter, cx: &ctxt, st: &ty::sty) {
260260
None => mywrite!(w, "|"),
261261
}
262262
}
263-
ty::ty_str => {
263+
ty::ty_str(sz) => {
264264
mywrite!(w, "v");
265+
mywrite!(w, "/");
266+
match sz {
267+
Some(n) => mywrite!(w, "{}|", n),
268+
None => mywrite!(w, "|"),
269+
}
265270
}
266271
ty::ty_closure(ref f) => {
267272
mywrite!(w, "f");

branches/try2/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
405405
ty::ty_struct(..) => check_matrix_for_wild(cx, m),
406406
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty: ty, ..}) => match ty::get(ty).sty {
407407
ty::ty_vec(_, None) => ctor_for_slice(m),
408-
ty::ty_str => Some(single),
408+
ty::ty_str(None) => Some(single),
409409
_ => check_matrix_for_wild(cx, m),
410410
},
411411
ty::ty_enum(eid, _) => {

branches/try2/src/librustc/middle/effect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ impl<'a> EffectCheckVisitor<'a> {
6969
ppaux::ty_to_str(self.tcx, base_type));
7070
match ty::get(base_type).sty {
7171
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
72-
ty::ty_str => {
72+
ty::ty_str(None) => {
7373
self.tcx.sess.span_err(e.span,
7474
"modification of string types is not allowed");
7575
}
7676
_ => {}
7777
},
78-
ty::ty_str => {
78+
ty::ty_str(..) => {
7979
self.tcx.sess.span_err(e.span,
8080
"modification of string types is not allowed");
8181
}

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
204204
Some(deref_interior(InteriorField(PositionalField(0))))
205205
}
206206

207-
ty::ty_vec(_, Some(_)) => {
207+
ty::ty_vec(_, Some(_)) |
208+
ty::ty_str(Some(_)) => {
208209
Some(deref_interior(InteriorElement(element_kind(t))))
209210
}
210211

@@ -1303,10 +1304,11 @@ fn element_kind(t: ty::t) -> ElementKind {
13031304
ty::ty_rptr(_, ty::mt{ty:ty, ..}) |
13041305
ty::ty_uniq(ty) => match ty::get(ty).sty {
13051306
ty::ty_vec(_, None) => VecElement,
1306-
ty::ty_str => StrElement,
1307+
ty::ty_str(None) => StrElement,
13071308
_ => OtherElement
13081309
},
13091310
ty::ty_vec(..) => VecElement,
1311+
ty::ty_str(..) => StrElement,
13101312
_ => OtherElement
13111313
}
13121314
}

branches/try2/src/librustc/middle/trans/_match.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ fn compare_values<'a>(
13161316

13171317
match ty::get(rhs_t).sty {
13181318
ty::ty_uniq(t) => match ty::get(t).sty {
1319-
ty::ty_str => {
1319+
ty::ty_str(None) => {
13201320
let scratch_lhs = alloca(cx, val_ty(lhs), "__lhs");
13211321
Store(cx, lhs, scratch_lhs);
13221322
let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs");
@@ -1333,9 +1333,10 @@ fn compare_values<'a>(
13331333
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
13341334
},
13351335
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
1336-
ty::ty_str => compare_str(cx, lhs, rhs, rhs_t),
1336+
ty::ty_str(None) => compare_str(cx, lhs, rhs, rhs_t),
13371337
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
13381338
},
1339+
ty::ty_str(Some(_)) => compare_str(cx, lhs, rhs, rhs_t),
13391340
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
13401341
}
13411342
}

branches/try2/src/librustc/middle/trans/adt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl Case {
270270
self.tys.iter().position(|&ty| {
271271
match ty::get(ty).sty {
272272
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
273-
ty::ty_vec(_, None) | ty::ty_str => false,
273+
ty::ty_vec(_, None) | ty::ty_str(None)=> false,
274274
_ => true,
275275
},
276276
ty::ty_uniq(..) | ty::ty_box(..) |

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,11 @@ pub fn iter_structural_ty<'r,
664664
}
665665
})
666666
}
667+
ty::ty_str(Some(n)) => {
668+
let unit_ty = ty::sequence_element_type(cx.tcx(), t);
669+
let (base, len) = tvec::get_fixed_base_and_byte_len(cx, av, unit_ty, n);
670+
cx = tvec::iter_vec_raw(cx, base, unit_ty, len, f);
671+
}
667672
ty::ty_vec(_, Some(n)) => {
668673
let unit_ty = ty::sequence_element_type(cx.tcx(), t);
669674
let (base, len) = tvec::get_fixed_base_and_byte_len(cx, av, unit_ty, n);

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ pub fn trans_call_inner<'a>(
660660
// `~` pointer return values never alias because ownership
661661
// is transferred
662662
ty::ty_uniq(ty) => match ty::get(ty).sty {
663-
ty::ty_str => {}
663+
ty::ty_str(None) => {}
664664
_ => attrs.push((0, NoAliasAttribute)),
665665
},
666666
_ => {}

branches/try2/src/librustc/middle/trans/consts.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool)
141141
let dv = match ty::get(t).sty {
142142
ty::ty_ptr(mt) | ty::ty_rptr(_, mt) => {
143143
match ty::get(mt.ty).sty {
144-
ty::ty_vec(_, None) | ty::ty_str => cx.sess().bug("unexpected slice"),
144+
ty::ty_vec(_, None) | ty::ty_str(None) => cx.sess().bug("unexpected slice"),
145145
_ => const_deref_ptr(cx, v),
146146
}
147147
}
@@ -434,7 +434,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
434434
let (arr, len) = match ty::get(bt).sty {
435435
ty::ty_vec(_, Some(u)) => (bv, C_uint(cx, u)),
436436
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
437-
ty::ty_vec(_, None) | ty::ty_str => {
437+
ty::ty_vec(_, None) | ty::ty_str(None) => {
438438
let e1 = const_get_elt(cx, bv, [0]);
439439
(const_deref_ptr(cx, e1), const_get_elt(cx, bv, [1]))
440440
},
@@ -448,12 +448,16 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
448448
let len = llvm::LLVMConstIntGetZExtValue(len) as u64;
449449
let len = match ty::get(bt).sty {
450450
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
451-
ty::ty_str => {
451+
ty::ty_str(None) => {
452452
assert!(len > 0);
453453
len - 1
454454
}
455455
_ => len
456456
},
457+
ty::ty_str(Some(_)) => {
458+
assert!(len > 0);
459+
len - 1
460+
},
457461
_ => len
458462
};
459463
if iv >= len {

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,10 @@ fn type_metadata(cx: &CrateContext,
21832183
ty::ty_float(_) => {
21842184
basic_type_metadata(cx, t)
21852185
}
2186+
ty::ty_str(Some(len)) => {
2187+
let i8_t = ty::mk_i8();
2188+
fixed_vec_metadata(cx, i8_t, len, usage_site_span)
2189+
}
21862190
ty::ty_enum(def_id, _) => {
21872191
prepare_enum_metadata(cx, t, def_id, usage_site_span).finalize(cx)
21882192
}
@@ -2196,7 +2200,7 @@ fn type_metadata(cx: &CrateContext,
21962200
let vec_metadata = vec_metadata(cx, mt.ty, usage_site_span);
21972201
pointer_type_metadata(cx, t, vec_metadata)
21982202
}
2199-
ty::ty_str => {
2203+
ty::ty_str(None) => {
22002204
let i8_t = ty::mk_i8();
22012205
let vec_metadata = vec_metadata(cx, i8_t, usage_site_span);
22022206
pointer_type_metadata(cx, t, vec_metadata)
@@ -2210,7 +2214,7 @@ fn type_metadata(cx: &CrateContext,
22102214
ty::ty_ptr(ref mt) | ty::ty_rptr(_, ref mt) => {
22112215
match ty::get(mt.ty).sty {
22122216
ty::ty_vec(ref mt, None) => vec_slice_metadata(cx, t, mt.ty, usage_site_span),
2213-
ty::ty_str => {
2217+
ty::ty_str(None) => {
22142218
let i8_t = ty::mk_i8();
22152219
vec_slice_metadata(cx, t, i8_t, usage_site_span)
22162220
}

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind {
15071507
ty::ty_float(..) => cast_float,
15081508
ty::ty_ptr(..) => cast_pointer,
15091509
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty{
1510-
ty::ty_vec(_, None) | ty::ty_str => cast_other,
1510+
ty::ty_vec(_, None) | ty::ty_str(None) => cast_other,
15111511
_ => cast_pointer,
15121512
},
15131513
ty::ty_bare_fn(..) => cast_pointer,
@@ -1717,7 +1717,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
17171717
let r = match ty::get(datum.ty).sty {
17181718
ty::ty_uniq(content_ty) => {
17191719
match ty::get(content_ty).sty {
1720-
ty::ty_vec(_, None) | ty::ty_str
1720+
ty::ty_vec(_, None) | ty::ty_str(None)
17211721
=> bcx.tcx().sess.span_bug(expr.span, "unexpected ~[T]"),
17221722
_ => deref_owned_pointer(bcx, expr, datum, content_ty),
17231723
}
@@ -1735,7 +1735,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
17351735
ty::ty_ptr(ty::mt { ty: content_ty, .. }) |
17361736
ty::ty_rptr(_, ty::mt { ty: content_ty, .. }) => {
17371737
match ty::get(content_ty).sty {
1738-
ty::ty_vec(_, None) | ty::ty_str
1738+
ty::ty_vec(_, None) | ty::ty_str(None)
17391739
=> bcx.tcx().sess.span_bug(expr.span, "unexpected &[T]"),
17401740
_ => {
17411741
assert!(!ty::type_needs_drop(bcx.tcx(), datum.ty));

branches/try2/src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn get_drop_glue_type(ccx: &CrateContext, t: ty::t) -> ty::t {
8484

8585
ty::ty_uniq(typ) if !ty::type_needs_drop(tcx, typ) => {
8686
match ty::get(typ).sty {
87-
ty::ty_vec(_, None) | ty::ty_str => t,
87+
ty::ty_vec(_, None) | ty::ty_str(None) => t,
8888
_ => {
8989
let llty = sizing_type_of(ccx, typ);
9090
// Unique boxes do not allocate for zero-size types. The standard
@@ -288,7 +288,7 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<'
288288
trans_exchange_free(bcx, llbox)
289289
})
290290
}
291-
ty::ty_str => {
291+
ty::ty_str(None) => {
292292
with_cond(bcx, not_null, |bcx| {
293293
let unit_ty = ty::sequence_element_type(bcx.tcx(), t);
294294
let bcx = tvec::make_drop_glue_unboxed(bcx, llbox, unit_ty);

branches/try2/src/librustc/middle/trans/reflect.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,17 @@ impl<'a, 'b> Reflector<'a, 'b> {
150150
ty::ty_float(ast::TyF64) => self.leaf("f64"),
151151
ty::ty_float(ast::TyF128) => self.leaf("f128"),
152152

153-
// Should rename to vec_*.
153+
// Should rename to str_*/vec_*.
154+
ty::ty_str(Some(n)) => {
155+
let extra = (vec!(self.c_uint(n))).append(self.c_size_and_align(t).as_slice());
156+
self.visit("estr_fixed".to_owned(), extra.as_slice())
157+
}
154158
ty::ty_vec(ref mt, Some(sz)) => {
155159
let extra = (vec!(self.c_uint(sz))).append(self.c_size_and_align(t).as_slice());
156160
let extra = extra.append(self.c_mt(mt).as_slice());
157161
self.visit("evec_fixed".to_owned(), extra.as_slice())
158162
}
159-
ty::ty_vec(..) | ty::ty_str => fail!("unexpected unsized type"),
163+
ty::ty_vec(..) | ty::ty_str(..) => fail!("unexpected unsized type"),
160164
// Should remove mt from box and uniq.
161165
ty::ty_box(typ) => {
162166
let extra = self.c_mt(&ty::mt {
@@ -172,7 +176,7 @@ impl<'a, 'b> Reflector<'a, 'b> {
172176
let extra = extra.append(self.c_mt(mt).as_slice());
173177
self.visit("evec_uniq".to_owned(), extra.as_slice())
174178
}
175-
ty::ty_str => self.visit("estr_uniq".to_owned(), &[]),
179+
ty::ty_str(None) => self.visit("estr_uniq".to_owned(), &[]),
176180
_ => {
177181
let extra = self.c_mt(&ty::mt {
178182
ty: typ,
@@ -193,7 +197,7 @@ impl<'a, 'b> Reflector<'a, 'b> {
193197
let extra = extra.append(self.c_mt(mt).as_slice());
194198
self.visit(~"evec_" + name, extra.as_slice())
195199
}
196-
ty::ty_str => self.visit("estr_slice".to_owned(), &[]),
200+
ty::ty_str(None) => self.visit("estr_slice".to_owned(), &[]),
197201
_ => {
198202
let extra = self.c_mt(mt);
199203
self.visit("rptr", extra.as_slice())

branches/try2/src/librustc/middle/trans/tvec.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>,
244244
let llptrval = C_cstr(ccx, (*s).clone(), false);
245245
let llptrval = PointerCast(bcx, llptrval, Type::i8p(ccx));
246246
let llsizeval = C_uint(ccx, s.get().len());
247-
let typ = ty::mk_uniq(bcx.tcx(), ty::mk_str(bcx.tcx()));
247+
let typ = ty::mk_uniq(bcx.tcx(), ty::mk_str(bcx.tcx(), None));
248248
let lldestval = rvalue_scratch_datum(bcx,
249249
typ,
250250
"");
@@ -478,12 +478,13 @@ pub fn get_base_and_len(bcx: &Block,
478478
let ccx = bcx.ccx();
479479

480480
match ty::get(vec_ty).sty {
481+
ty::ty_str(Some(n)) |
481482
ty::ty_vec(_, Some(n)) => {
482483
let base = GEPi(bcx, llval, [0u, 0u]);
483484
(base, C_uint(ccx, n))
484485
}
485486
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
486-
ty::ty_vec(_, None) | ty::ty_str => {
487+
ty::ty_vec(_, None) | ty::ty_str(None) => {
487488
assert!(!type_is_immediate(bcx.ccx(), vec_ty));
488489
let base = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_base]));
489490
let count = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_len]));
@@ -492,7 +493,7 @@ pub fn get_base_and_len(bcx: &Block,
492493
_ => ccx.sess().bug("unexpected type (ty_rptr) in get_base_and_len"),
493494
},
494495
ty::ty_uniq(t) => match ty::get(t).sty {
495-
ty::ty_vec(_, None) | ty::ty_str => {
496+
ty::ty_vec(_, None) | ty::ty_str(None) => {
496497
assert!(type_is_immediate(bcx.ccx(), vec_ty));
497498
let vt = vec_types(bcx, ty::sequence_element_type(bcx.tcx(), vec_ty));
498499
let body = Load(bcx, llval);

branches/try2/src/librustc/middle/trans/type_of.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
121121
ty::ty_ptr(..) => Type::i8p(cx),
122122
ty::ty_rptr(_, mt) => {
123123
match ty::get(mt.ty).sty {
124-
ty::ty_vec(_, None) | ty::ty_str => {
124+
ty::ty_vec(_, None) | ty::ty_str(None) => {
125125
Type::struct_(cx, [Type::i8p(cx), Type::i8p(cx)], false)
126126
}
127127
_ => Type::i8p(cx),
@@ -132,6 +132,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
132132
ty::ty_closure(..) => Type::struct_(cx, [Type::i8p(cx), Type::i8p(cx)], false),
133133
ty::ty_trait(..) => Type::opaque_trait(cx),
134134

135+
ty::ty_str(Some(size)) => Type::array(&Type::i8(cx), size as u64),
135136
ty::ty_vec(mt, Some(size)) => {
136137
Type::array(&sizing_type_of(cx, mt.ty), size as u64)
137138
}
@@ -153,7 +154,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
153154
}
154155

155156
ty::ty_self(_) | ty::ty_infer(..) | ty::ty_param(..) |
156-
ty::ty_err(..) | ty::ty_vec(_, None) | ty::ty_str => {
157+
ty::ty_err(..) | ty::ty_vec(_, None) | ty::ty_str(None) => {
157158
cx.sess().bug(format!("fictitious type {:?} in sizing_type_of()",
158159
ty::get(t).sty))
159160
}
@@ -214,7 +215,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
214215
ty::ty_uniq(typ) => {
215216
match ty::get(typ).sty {
216217
ty::ty_vec(mt, None) => Type::vec(cx, &type_of(cx, mt.ty)).ptr_to(),
217-
ty::ty_str => Type::vec(cx, &Type::i8(cx)).ptr_to(),
218+
ty::ty_str(None) => Type::vec(cx, &Type::i8(cx)).ptr_to(),
218219
_ => type_of(cx, typ).ptr_to(),
219220
}
220221
}
@@ -226,14 +227,18 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
226227
let u_ty = Type::uint_from_ty(cx, ast::TyU);
227228
Type::struct_(cx, [p_ty, u_ty], false)
228229
}
229-
ty::ty_str => {
230+
ty::ty_str(None) => {
230231
// This means we get a nicer name in the output
231232
cx.tn.find_type("str_slice").unwrap()
232233
}
233234
_ => type_of(cx, mt.ty).ptr_to(),
234235
}
235236
}
236237

238+
ty::ty_str(Some(n)) => {
239+
Type::array(&Type::i8(cx), (n + 1u) as u64)
240+
}
241+
237242
ty::ty_vec(ref mt, Some(n)) => {
238243
Type::array(&type_of(cx, mt.ty), n as u64)
239244
}
@@ -269,7 +274,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
269274
}
270275

271276
ty::ty_vec(_, None) => cx.sess().bug("type_of with unsized ty_vec"),
272-
ty::ty_str => cx.sess().bug("type_of with unsized (bare) ty_str"),
277+
ty::ty_str(None) => cx.sess().bug("type_of with unsized ty_str"),
273278
ty::ty_self(..) => cx.sess().unimpl("type_of with ty_self"),
274279
ty::ty_infer(..) => cx.sess().bug("type_of with ty_infer"),
275280
ty::ty_param(..) => cx.sess().bug("type_of with ty_param"),

0 commit comments

Comments
 (0)