auto merge of #6707 : catamorphism/rust/issue-5543, r=catamorphism
This commit is contained in:
commit
9a06ff0590
4 changed files with 102 additions and 0 deletions
20
src/test/compile-fail/issue-5543.rs
Normal file
20
src/test/compile-fail/issue-5543.rs
Normal file
|
|
@ -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
src/test/run-pass/issue-4735.rs
Normal file
30
src/test/run-pass/issue-4735.rs
Normal file
|
|
@ -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
src/test/run-pass/issue-5550.rs
Normal file
15
src/test/run-pass/issue-5550.rs
Normal file
|
|
@ -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
src/test/run-pass/issue-5554.rs
Normal file
37
src/test/run-pass/issue-5554.rs
Normal file
|
|
@ -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!();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue