Skip to content

Commit 365bd9a

Browse files
committed
Round 1 fixes and rebase conflicts
1 parent b64dfff commit 365bd9a

File tree

17 files changed

+44
-44
lines changed

17 files changed

+44
-44
lines changed

src/libcollections/bit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ impl Default for BitVec {
925925
#[stable(feature = "rust1", since = "1.0.0")]
926926
impl FromIterator<bool> for BitVec {
927927
fn from_iter<I: IntoIterator<Item=bool>>(iter: I) -> BitVec {
928-
let mut ret = Bitv::new();
928+
let mut ret = BitVec::new();
929929
ret.extend(iter);
930930
ret
931931
}
@@ -1146,7 +1146,7 @@ impl Default for BitSet {
11461146
#[stable(feature = "rust1", since = "1.0.0")]
11471147
impl FromIterator<usize> for BitSet {
11481148
fn from_iter<I: IntoIterator<Item=usize>>(iter: I) -> BitSet {
1149-
let mut ret = BitvSet::new();
1149+
let mut ret = BitSet::new();
11501150
ret.extend(iter);
11511151
ret
11521152
}

src/libcore/iter.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,11 @@ pub trait IteratorExt: Iterator + Sized {
522522
///
523523
/// let a = [1, 4, 2, 3, 8, 9, 6];
524524
/// let sum = a.iter()
525-
/// .cloned()
526-
/// .inspect(|&x| println!("filtering {}", x))
527-
/// .filter(|&x| x % 2 == 0)
528-
/// .inspect(|&x| println!("{} made it through", x))
529-
/// .sum();
525+
/// .map(|x| *x)
526+
/// .inspect(|&x| println!("filtering {}", x))
527+
/// .filter(|&x| x % 2 == 0)
528+
/// .inspect(|&x| println!("{} made it through", x))
529+
/// .sum();
530530
/// println!("{}", sum);
531531
/// ```
532532
#[inline]

src/libcoretest/hash/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ impl Default for MyHasher {
2323
}
2424

2525
impl Hasher for MyHasher {
26-
type Output = u64;
2726
fn write(&mut self, buf: &[u8]) {
2827
for byte in buf {
2928
self.hash += *byte as u64;
@@ -85,7 +84,6 @@ struct Custom { hash: u64 }
8584
struct CustomHasher { output: u64 }
8685

8786
impl Hasher for CustomHasher {
88-
type Output = u64;
8987
fn finish(&self) -> u64 { self.output }
9088
fn write(&mut self, data: &[u8]) { panic!() }
9189
fn write_u64(&mut self, data: u64) { self.output = data; }

src/librustc_trans/trans/tvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
426426
Br(bcx, loop_bcx.llbb, DebugLoc::None);
427427

428428
let loop_counter = Phi(loop_bcx, bcx.ccx().int_type(),
429-
&[C_uint(bcx.ccx(), 0)], &[bcx.llbb]);
429+
&[C_uint(bcx.ccx(), 0 as usize)], &[bcx.llbb]);
430430

431431
let bcx = loop_bcx;
432432

src/librustdoc/flock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ mod imp {
112112

113113
impl Lock {
114114
pub fn new(p: &Path) -> Lock {
115-
let buf = CString::from_slice(p.as_vec()).unwrap();
115+
let buf = CString::new(p.as_vec()).unwrap();
116116
let fd = unsafe {
117117
libc::open(buf.as_ptr(), libc::O_RDWR | libc::O_CREAT,
118118
libc::S_IRWXU)

src/librustdoc/html/markdown.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
236236
s.push_str(&highlight::highlight(&text,
237237
None,
238238
Some("rust-example-rendered")));
239-
let output = CString::from_vec(s.into_bytes()).unwrap();
239+
let output = CString::new(s).unwrap();
240240
hoedown_buffer_puts(ob, output.as_ptr());
241241
})
242242
}
@@ -293,7 +293,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
293293
format!("{} ", sec)
294294
});
295295

296-
let text = CString::from_vec(text.into_bytes()).unwrap();
296+
let text = CString::new(text).unwrap();
297297
unsafe { hoedown_buffer_puts(ob, text.as_ptr()) }
298298
}
299299

src/libstd/collections/hash/map_stage0.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,8 @@ impl<K, V, S, H> FromIterator<(K, V)> for HashMap<K, V, S>
15521552
S: HashState<Hasher=H> + Default,
15531553
H: hash::Hasher<Output=u64>
15541554
{
1555-
fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> HashMap<K, V, S> {
1555+
fn from_iter<T: IntoIterator<Item=(K, V)>>(iter: T) -> HashMap<K, V, S> {
1556+
let iter = iter.into_iter();
15561557
let lower = iter.size_hint().0;
15571558
let mut map = HashMap::with_capacity_and_hash_state(lower,
15581559
Default::default());
@@ -1567,7 +1568,7 @@ impl<K, V, S, H> Extend<(K, V)> for HashMap<K, V, S>
15671568
S: HashState<Hasher=H>,
15681569
H: hash::Hasher<Output=u64>
15691570
{
1570-
fn extend<T: Iterator<Item=(K, V)>>(&mut self, iter: T) {
1571+
fn extend<T: IntoIterator<Item=(K, V)>>(&mut self, iter: T) {
15711572
for (k, v) in iter {
15721573
self.insert(k, v);
15731574
}

src/libstd/collections/hash/set_stage0.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@ impl<T, S, H> FromIterator<T> for HashSet<T, S>
622622
S: HashState<Hasher=H> + Default,
623623
H: hash::Hasher<Output=u64>
624624
{
625-
fn from_iter<I: Iterator<Item=T>>(iter: I) -> HashSet<T, S> {
625+
fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> HashSet<T, S> {
626+
let iter = iter.into_iter();
626627
let lower = iter.size_hint().0;
627628
let mut set = HashSet::with_capacity_and_hash_state(lower, Default::default());
628629
set.extend(iter);
@@ -636,7 +637,7 @@ impl<T, S, H> Extend<T> for HashSet<T, S>
636637
S: HashState<Hasher=H>,
637638
H: hash::Hasher<Output=u64>
638639
{
639-
fn extend<I: Iterator<Item=T>>(&mut self, iter: I) {
640+
fn extend<I: IntoIterator<Item=T>>(&mut self, iter: I) {
640641
for k in iter {
641642
self.insert(k);
642643
}

src/libstd/ffi/c_str.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub struct CString {
105105
/// }
106106
///
107107
/// fn main() {
108-
/// let s = CString::from_slice(b"data data data data").unwrap();
108+
/// let s = CString::new("data data data data").unwrap();
109109
/// work(&s);
110110
/// }
111111
/// ```
@@ -141,7 +141,7 @@ impl CString {
141141
/// extern { fn puts(s: *const libc::c_char); }
142142
///
143143
/// fn main() {
144-
/// let to_print = CString::from_slice(b"Hello!").unwrap();
144+
/// let to_print = CString::new("Hello!").unwrap();
145145
/// unsafe {
146146
/// puts(to_print.as_ptr());
147147
/// }
@@ -175,7 +175,7 @@ impl CString {
175175
/// extern { fn puts(s: *const libc::c_char); }
176176
///
177177
/// fn main() {
178-
/// let to_print = CString::from_slice(b"Hello!").unwrap();
178+
/// let to_print = CString::new("Hello!").unwrap();
179179
/// unsafe {
180180
/// puts(to_print.as_ptr());
181181
/// }
@@ -436,18 +436,18 @@ mod tests {
436436

437437
#[test]
438438
fn simple() {
439-
let s = CString::from_slice(b"1234").unwrap();
439+
let s = CString::new(b"1234").unwrap();
440440
assert_eq!(s.as_bytes(), b"1234");
441441
assert_eq!(s.as_bytes_with_nul(), b"1234\0");
442442
}
443443

444444
#[test]
445445
fn build_with_zero1() {
446-
assert!(CString::from_slice(b"\0").is_err());
446+
assert!(CString::new(b"\0").is_err());
447447
}
448448
#[test]
449449
fn build_with_zero2() {
450-
assert!(CString::from_vec(vec![0]).is_err());
450+
assert!(CString::new(vec![0]).is_err());
451451
}
452452

453453
#[test]
@@ -460,7 +460,7 @@ mod tests {
460460

461461
#[test]
462462
fn formatted() {
463-
let s = CString::from_slice(b"12").unwrap();
463+
let s = CString::new(b"12").unwrap();
464464
assert_eq!(format!("{:?}", s), "\"12\"");
465465
}
466466

src/test/run-pass/bitv-perf-test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#![feature(box_syntax)]
1414

1515
extern crate collections;
16-
use std::collections::Bitv;
16+
use std::collections::BitVec;
1717

1818
fn bitv_test() {
19-
let mut v1 = box Bitv::from_elem(31, false);
20-
let v2 = box Bitv::from_elem(31, true);
19+
let mut v1 = box BitVec::from_elem(31, false);
20+
let v2 = box BitVec::from_elem(31, true);
2121
v1.union(&*v2);
2222
}
2323

0 commit comments

Comments
 (0)