-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/test/compile-fail/functional-struct-update-noncopyable.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2012 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. | ||
|
||
// issue 7327 | ||
|
||
// xfail-fast #7103 | ||
extern mod extra; | ||
use extra::arc::*; | ||
|
||
struct A { y: Arc<int>, x: Arc<int> } | ||
|
||
impl Drop for A { | ||
fn drop(&self) { println(fmt!("x=%?", self.x.get())); } | ||
} | ||
fn main() { | ||
let a = A { y: Arc::new(1), x: Arc::new(2) }; | ||
let _b = A { y: Arc::new(3), ..a }; | ||
let _c = a; //~ ERROR use of moved value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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. | ||
|
||
/* | ||
# if b { x } else { y } requires identical types for x and y | ||
*/ | ||
|
||
fn print1(b: bool, s1: &str, s2: &str) { | ||
println(if b { s1 } else { s2 }); | ||
} | ||
fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { | ||
println(if b { s1 } else { s2 }); | ||
} | ||
fn print3(b: bool, s1: &str, s2: &str) { | ||
let mut s: &str; | ||
if b { s = s1; } else { s = s2; } | ||
println(s); | ||
} | ||
fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { | ||
let mut s: &str; | ||
if b { s = s1; } else { s = s2; } | ||
println(s); | ||
} | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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. | ||
|
||
/* | ||
# Corrupted initialization in the static struct | ||
...should print &[1, 2, 3] but instead prints something like | ||
&[4492532864, 24]. It is pretty evident that the compiler messed up | ||
with the representation of [int, ..n] and [int] somehow, or at least | ||
failed to typecheck correctly. | ||
*/ | ||
|
||
struct X { vec: &'static [int] } | ||
static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; | ||
fn main() { | ||
for &v in V.iter() { | ||
println(fmt!("%?", v.vec)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// 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. | ||
|
||
/* | ||
# ICE when returning struct with borrowed pointer to trait | ||
A function which takes a borrowed pointer to a trait and returns a | ||
struct with that borrowed pointer results in an ICE. | ||
This does not occur with concrete types, only with borrowed pointers | ||
to traits. | ||
*/ | ||
|
||
// original | ||
trait Inner { | ||
fn print(&self); | ||
} | ||
|
||
impl Inner for int { | ||
fn print(&self) { print(fmt!("Inner: %d\n", *self)); } | ||
} | ||
|
||
struct Outer<'self> { | ||
inner: &'self Inner | ||
} | ||
|
||
impl<'self> Outer<'self> { | ||
fn new<'r>(inner: &'r Inner) -> Outer<'r> { | ||
Outer { | ||
inner: inner | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
let inner = 5; | ||
let outer = Outer::new(&inner as &Inner); | ||
outer.inner.print(); | ||
} | ||
|
||
|
||
// minimal | ||
trait MyTrait<T> { } | ||
|
||
pub struct MyContainer<'self, T> { | ||
foos: ~[&'self MyTrait<T>], | ||
} | ||
|
||
impl<'self, T> MyContainer<'self, T> { | ||
pub fn add (&mut self, foo: &'self MyTrait<T>) { | ||
self.foos.push(foo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 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. | ||
|
||
/* | ||
# Comparison of static arrays | ||
The expected behaviour would be that test==test1, therefore 'true' | ||
would be printed, however the below prints false. | ||
*/ | ||
|
||
struct signature<'self> { pattern : &'self [u32] } | ||
|
||
static test1: signature<'static> = signature { | ||
pattern: &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32] | ||
}; | ||
|
||
fn main() { | ||
let test = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32]; | ||
println(fmt!("%b",test==test1.pattern)); | ||
} |
12099ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from thestinger
at huonw@12099ce
12099ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging huonw/rust/closed-issues = 12099ce into auto
12099ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huonw/rust/closed-issues = 12099ce merged ok, testing candidate = b0d069bb
12099ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/354
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1244
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1247
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/353
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/353
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1263
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/354
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1263
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/354
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/354
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1247
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/353
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/353
exception: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/1032