Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/test/compile-fail/issue-5543.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
use core::io::ReaderUtil;
use core::io::Reader;

fn bar(r:@ReaderUtil) -> ~str { r.read_line() }

fn main() {
let r : @Reader = io::stdin();
let _m = bar(r as @ReaderUtil);
}
30 changes: 30 additions & 0 deletions src/test/run-pass/issue-4735.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.


use std::cast::transmute;
use std::libc::c_void;

struct NonCopyable(*c_void);

impl Drop for NonCopyable {
fn finalize(&self) {
let p = **self;
let v = unsafe { transmute::<*c_void, ~int>(p) };
}
}

fn main() {
let t = ~0;
let p = unsafe { transmute::<~int, *c_void>(t) };
let z = NonCopyable(p);
}


15 changes: 15 additions & 0 deletions src/test/run-pass/issue-5550.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
let s: ~str = ~"foobar";
let mut t: &str = s;
t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe
}
37 changes: 37 additions & 0 deletions src/test/run-pass/issue-5554.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::num::Zero;

pub struct X<T> {
a: T
}

// reordering these bounds stops the ICE
impl<T: Zero + Eq + Zero>
Zero for X<T> {
fn zero() -> X<T> {
X { a: Zero::zero() }
}
fn is_zero(&self) -> bool {
self.a.is_zero()
}
}

macro_rules! constants {
() => {
let _0 : X<int> = Zero::zero();
}
}


pub fn main() {
constants!();
}