Skip to content

Commit fceb731

Browse files
committed
---
yaml --- r: 172782 b: refs/heads/try c: b4fae2f h: refs/heads/master v: v3
1 parent ca48796 commit fceb731

File tree

15 files changed

+79
-109
lines changed

15 files changed

+79
-109
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 170c4399e614fe599c3d41306b3429ca8b3b68c6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: 2127e0d56d85ff48aafce90ab762650e46370b63
5+
refs/heads/try: b4fae2fba99e713a6d6a8a59caaf1cfba847b50e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libcollections/string.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ impl String {
302302
/// assert_eq!(String::from_utf16_lossy(v),
303303
/// "𝄞mus\u{FFFD}ic\u{FFFD}".to_string());
304304
/// ```
305-
#[inline]
306305
#[stable]
307306
pub fn from_utf16_lossy(v: &[u16]) -> String {
308307
unicode_str::utf16_items(v).map(|c| c.to_char_lossy()).collect()
@@ -557,7 +556,6 @@ impl String {
557556
/// assert_eq!(s.remove(1), 'o');
558557
/// assert_eq!(s.remove(0), 'o');
559558
/// ```
560-
#[inline]
561559
#[stable]
562560
pub fn remove(&mut self, idx: uint) -> char {
563561
let len = self.len();
@@ -584,7 +582,6 @@ impl String {
584582
///
585583
/// If `idx` does not lie on a character boundary or is out of bounds, then
586584
/// this function will panic.
587-
#[inline]
588585
#[stable]
589586
pub fn insert(&mut self, idx: uint, ch: char) {
590587
let len = self.len();
@@ -621,7 +618,6 @@ impl String {
621618
/// }
622619
/// assert_eq!(s.as_slice(), "olleh");
623620
/// ```
624-
#[inline]
625621
#[stable]
626622
pub unsafe fn as_mut_vec<'a>(&'a mut self) -> &'a mut Vec<u8> {
627623
&mut self.vec
@@ -649,7 +645,6 @@ impl String {
649645
/// v.push('a');
650646
/// assert!(!v.is_empty());
651647
/// ```
652-
#[inline]
653648
#[stable]
654649
pub fn is_empty(&self) -> bool { self.len() == 0 }
655650

@@ -806,7 +801,6 @@ impl Str for String {
806801

807802
#[stable]
808803
impl Default for String {
809-
#[inline]
810804
#[stable]
811805
fn default() -> String {
812806
String::new()
@@ -815,15 +809,13 @@ impl Default for String {
815809

816810
#[stable]
817811
impl fmt::String for String {
818-
#[inline]
819812
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
820813
fmt::String::fmt(&**self, f)
821814
}
822815
}
823816

824817
#[unstable = "waiting on fmt stabilization"]
825818
impl fmt::Show for String {
826-
#[inline]
827819
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
828820
fmt::Show::fmt(&**self, f)
829821
}
@@ -850,7 +842,6 @@ impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for String {
850842
impl<'a> Add<&'a str> for String {
851843
type Output = String;
852844

853-
#[inline]
854845
fn add(mut self, other: &str) -> String {
855846
self.push_str(other);
856847
self
@@ -890,7 +881,6 @@ impl ops::Index<ops::FullRange> for String {
890881
impl ops::Deref for String {
891882
type Target = str;
892883

893-
#[inline]
894884
fn deref<'a>(&'a self) -> &'a str {
895885
unsafe { mem::transmute(&self.vec[]) }
896886
}
@@ -905,7 +895,6 @@ pub struct DerefString<'a> {
905895
impl<'a> Deref for DerefString<'a> {
906896
type Target = String;
907897

908-
#[inline]
909898
fn deref<'b>(&'b self) -> &'b String {
910899
unsafe { mem::transmute(&*self.x) }
911900
}
@@ -944,7 +933,6 @@ pub trait ToString {
944933
}
945934

946935
impl<T: fmt::String + ?Sized> ToString for T {
947-
#[inline]
948936
fn to_string(&self) -> String {
949937
use core::fmt::Writer;
950938
let mut buf = String::new();
@@ -955,14 +943,12 @@ impl<T: fmt::String + ?Sized> ToString for T {
955943
}
956944

957945
impl IntoCow<'static, String, str> for String {
958-
#[inline]
959946
fn into_cow(self) -> CowString<'static> {
960947
Cow::Owned(self)
961948
}
962949
}
963950

964951
impl<'a> IntoCow<'a, String, str> for &'a str {
965-
#[inline]
966952
fn into_cow(self) -> CowString<'a> {
967953
Cow::Borrowed(self)
968954
}
@@ -980,7 +966,6 @@ impl<'a> Str for CowString<'a> {
980966
}
981967

982968
impl fmt::Writer for String {
983-
#[inline]
984969
fn write_str(&mut self, s: &str) -> fmt::Result {
985970
self.push_str(s);
986971
Ok(())

branches/try/src/librustc_trans/trans/base.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,11 +1054,6 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
10541054
C_undef(type_of::type_of(cx.ccx(), t))
10551055
} else if ty::type_is_bool(t) {
10561056
Trunc(cx, LoadRangeAssert(cx, ptr, 0, 2, llvm::False), Type::i1(cx.ccx()))
1057-
} else if type_is_immediate(cx.ccx(), t) && type_of::type_of(cx.ccx(), t).is_aggregate() {
1058-
// We want to pass small aggregates as immediate values, but using an aggregate LLVM type
1059-
// for this leads to bad optimizations, so its arg type is an appropriately sized integer
1060-
// and we have to convert it
1061-
Load(cx, BitCast(cx, ptr, type_of::arg_type_of(cx.ccx(), t).ptr_to()))
10621057
} else if ty::type_is_char(t) {
10631058
// a char is a Unicode codepoint, and so takes values from 0
10641059
// to 0x10FFFF inclusive only.
@@ -1070,14 +1065,9 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
10701065

10711066
/// Helper for storing values in memory. Does the necessary conversion if the in-memory type
10721067
/// differs from the type used for SSA values.
1073-
pub fn store_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef, dst: ValueRef, t: Ty<'tcx>) {
1068+
pub fn store_ty(cx: Block, v: ValueRef, dst: ValueRef, t: Ty) {
10741069
if ty::type_is_bool(t) {
10751070
Store(cx, ZExt(cx, v, Type::i8(cx.ccx())), dst);
1076-
} else if type_is_immediate(cx.ccx(), t) && type_of::type_of(cx.ccx(), t).is_aggregate() {
1077-
// We want to pass small aggregates as immediate values, but using an aggregate LLVM type
1078-
// for this leads to bad optimizations, so its arg type is an appropriately sized integer
1079-
// and we have to convert it
1080-
Store(cx, v, BitCast(cx, dst, type_of::arg_type_of(cx.ccx(), t).ptr_to()));
10811071
} else {
10821072
Store(cx, v, dst);
10831073
};

branches/try/src/librustc_trans/trans/common.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ fn type_is_newtype_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
222222
match ty.sty {
223223
ty::ty_struct(def_id, substs) => {
224224
let fields = ty::struct_fields(ccx.tcx(), def_id, substs);
225-
fields.len() == 1 && type_is_immediate(ccx, fields[0].mt.ty)
225+
fields.len() == 1 &&
226+
fields[0].name ==
227+
token::special_idents::unnamed_field.name &&
228+
type_is_immediate(ccx, fields[0].mt.ty)
226229
}
227230
_ => false
228231
}
@@ -244,7 +247,7 @@ pub fn type_is_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -
244247
return false;
245248
}
246249
match ty.sty {
247-
ty::ty_struct(..) | ty::ty_enum(..) | ty::ty_tup(..) | ty::ty_vec(_, Some(_)) |
250+
ty::ty_struct(..) | ty::ty_enum(..) | ty::ty_tup(..) |
248251
ty::ty_unboxed_closure(..) => {
249252
let llty = sizing_type_of(ccx, ty);
250253
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type())

branches/try/src/librustc_trans/trans/foreign.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -736,13 +736,6 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
736736
if ty::type_is_bool(rust_ty) {
737737
let tmp = builder.load_range_assert(llforeign_arg, 0, 2, llvm::False);
738738
builder.trunc(tmp, Type::i1(ccx))
739-
} else if type_of::type_of(ccx, rust_ty).is_aggregate() {
740-
// We want to pass small aggregates as immediate values, but using an aggregate
741-
// LLVM type for this leads to bad optimizations, so its arg type is an
742-
// appropriately sized integer and we have to convert it
743-
let tmp = builder.bitcast(llforeign_arg,
744-
type_of::arg_type_of(ccx, rust_ty).ptr_to());
745-
builder.load(tmp)
746739
} else {
747740
builder.load(llforeign_arg)
748741
}
@@ -841,10 +834,10 @@ fn foreign_signature<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
841834
fn_sig: &ty::FnSig<'tcx>,
842835
arg_tys: &[Ty<'tcx>])
843836
-> LlvmSignature {
844-
let llarg_tys = arg_tys.iter().map(|&arg| foreign_arg_type_of(ccx, arg)).collect();
837+
let llarg_tys = arg_tys.iter().map(|&arg| arg_type_of(ccx, arg)).collect();
845838
let (llret_ty, ret_def) = match fn_sig.output {
846839
ty::FnConverging(ret_ty) =>
847-
(type_of::foreign_arg_type_of(ccx, ret_ty), !return_type_is_void(ccx, ret_ty)),
840+
(type_of::arg_type_of(ccx, ret_ty), !return_type_is_void(ccx, ret_ty)),
848841
ty::FnDiverging =>
849842
(Type::nil(ccx), false)
850843
};

branches/try/src/librustc_trans/trans/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub fn drop_ty_immediate<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
138138
-> Block<'blk, 'tcx> {
139139
let _icx = push_ctxt("drop_ty_immediate");
140140
let vp = alloca(bcx, type_of(bcx.ccx(), t), "");
141-
store_ty(bcx, v, vp, t);
141+
Store(bcx, v, vp);
142142
drop_ty(bcx, vp, t, source_location)
143143
}
144144

branches/try/src/librustc_trans/trans/intrinsic.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
357357
&ccx.link_meta().crate_hash);
358358
// NB: This needs to be kept in lockstep with the TypeId struct in
359359
// the intrinsic module
360-
C_u64(ccx, hash)
360+
C_named_struct(llret_ty, &[C_u64(ccx, hash)])
361361
}
362362
(_, "init") => {
363363
let tp_ty = *substs.types.get(FnSpace, 0);
364-
let lltp_ty = type_of::arg_type_of(ccx, tp_ty);
364+
let lltp_ty = type_of::type_of(ccx, tp_ty);
365365
if return_type_is_void(ccx, tp_ty) {
366366
C_nil(ccx)
367367
} else {
@@ -686,11 +686,6 @@ fn with_overflow_intrinsic<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, name: &'static st
686686
let ret = C_undef(type_of::type_of(bcx.ccx(), t));
687687
let ret = InsertValue(bcx, ret, result, 0);
688688
let ret = InsertValue(bcx, ret, overflow, 1);
689-
if type_is_immediate(bcx.ccx(), t) {
690-
let tmp = alloc_ty(bcx, t, "tmp");
691-
Store(bcx, ret, tmp);
692-
load_ty(bcx, tmp, t)
693-
} else {
694-
ret
695-
}
689+
690+
ret
696691
}

branches/try/src/librustc_trans/trans/type_.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ impl Type {
8282
ty!(llvm::LLVMInt64TypeInContext(ccx.llcx()))
8383
}
8484

85-
// Creates an integer type with the given number of bits, e.g. i24
86-
pub fn ix(ccx: &CrateContext, num_bits: u64) -> Type {
87-
ty!(llvm::LLVMIntTypeInContext(ccx.llcx(), num_bits as c_uint))
88-
}
89-
9085
pub fn f32(ccx: &CrateContext) -> Type {
9186
ty!(llvm::LLVMFloatTypeInContext(ccx.llcx()))
9287
}
@@ -265,13 +260,6 @@ impl Type {
265260
ty!(llvm::LLVMPointerType(self.to_ref(), 0))
266261
}
267262

268-
pub fn is_aggregate(&self) -> bool {
269-
match self.kind() {
270-
TypeKind::Struct | TypeKind::Array => true,
271-
_ => false
272-
}
273-
}
274-
275263
pub fn is_packed(&self) -> bool {
276264
unsafe {
277265
llvm::LLVMIsPackedStruct(self.to_ref()) == True

branches/try/src/librustc_trans/trans/type_of.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,24 +243,9 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
243243
llsizingty
244244
}
245245

246-
pub fn foreign_arg_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type {
247-
if ty::type_is_bool(t) {
248-
Type::i1(cx)
249-
} else {
250-
type_of(cx, t)
251-
}
252-
}
253-
254246
pub fn arg_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type {
255247
if ty::type_is_bool(t) {
256248
Type::i1(cx)
257-
} else if type_is_immediate(cx, t) && type_of(cx, t).is_aggregate() {
258-
// We want to pass small aggregates as immediate values, but using an aggregate LLVM type
259-
// for this leads to bad optimizations, so its arg type is an appropriately sized integer
260-
match machine::llsize_of_alloc(cx, sizing_type_of(cx, t)) {
261-
0 => type_of(cx, t),
262-
n => Type::ix(cx, n * 8),
263-
}
264249
} else {
265250
type_of(cx, t)
266251
}

branches/try/src/librustdoc/html/static/playpen.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
(function() {
1515
if (window.playgroundUrl) {
1616
$('pre.rust').hover(function() {
17-
if (!$(this).attr('id')) { return; }
1817
var id = '#' + $(this).attr('id').replace('rendered', 'raw');
1918
var a = $('<a>').text('⇱').attr('class', 'test-arrow');
2019
var code = $(id).text();

branches/try/src/libstd/io/buffered.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//! Buffering wrappers for I/O traits
1414
1515
use cmp;
16+
use fmt;
1617
use io::{Reader, Writer, Stream, Buffer, DEFAULT_BUF_SIZE, IoResult};
1718
use iter::{IteratorExt, ExactSizeIterator};
1819
use ops::Drop;
@@ -51,6 +52,13 @@ pub struct BufferedReader<R> {
5152
cap: uint,
5253
}
5354

55+
impl<R> fmt::Show for BufferedReader<R> where R: fmt::Show {
56+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
57+
write!(fmt, "BufferedReader {{ reader: {:?}, buffer: {}/{} }}",
58+
self.inner, self.cap - self.pos, self.buf.len())
59+
}
60+
}
61+
5462
impl<R: Reader> BufferedReader<R> {
5563
/// Creates a new `BufferedReader` with the specified buffer capacity
5664
pub fn with_capacity(cap: uint, inner: R) -> BufferedReader<R> {
@@ -148,6 +156,13 @@ pub struct BufferedWriter<W> {
148156
pos: uint
149157
}
150158

159+
impl<W> fmt::Show for BufferedWriter<W> where W: fmt::Show {
160+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
161+
write!(fmt, "BufferedWriter {{ writer: {:?}, buffer: {}/{} }}",
162+
self.inner.as_ref().unwrap(), self.pos, self.buf.len())
163+
}
164+
}
165+
151166
impl<W: Writer> BufferedWriter<W> {
152167
/// Creates a new `BufferedWriter` with the specified buffer capacity
153168
pub fn with_capacity(cap: uint, inner: W) -> BufferedWriter<W> {
@@ -235,6 +250,13 @@ pub struct LineBufferedWriter<W> {
235250
inner: BufferedWriter<W>,
236251
}
237252

253+
impl<W> fmt::Show for LineBufferedWriter<W> where W: fmt::Show {
254+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
255+
write!(fmt, "LineBufferedWriter {{ writer: {:?}, buffer: {}/{} }}",
256+
self.inner.inner, self.inner.pos, self.inner.buf.len())
257+
}
258+
}
259+
238260
impl<W: Writer> LineBufferedWriter<W> {
239261
/// Creates a new `LineBufferedWriter`
240262
pub fn new(inner: W) -> LineBufferedWriter<W> {
@@ -318,6 +340,17 @@ pub struct BufferedStream<S> {
318340
inner: BufferedReader<InternalBufferedWriter<S>>
319341
}
320342

343+
impl<S> fmt::Show for BufferedStream<S> where S: fmt::Show {
344+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
345+
let reader = &self.inner;
346+
let writer = &self.inner.inner.0;
347+
write!(fmt, "BufferedStream {{ stream: {:?}, write_buffer: {}/{}, read_buffer: {}/{} }}",
348+
writer.inner,
349+
writer.pos, writer.buf.len(),
350+
reader.cap - reader.pos, reader.buf.len())
351+
}
352+
}
353+
321354
impl<S: Stream> BufferedStream<S> {
322355
/// Creates a new buffered stream with explicitly listed capacities for the
323356
/// reader/writer buffer.

0 commit comments

Comments
 (0)