diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-10 11:16:54 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-10 11:16:54 -0800 |
| commit | 2a1b6c4de993c8db1bda35d58426d873e9e514c2 (patch) | |
| tree | a348bb8b51487c1504a9c923c2bf489e58047348 /src/test | |
| parent | 982830c836b8c2c9cb3fd311c826bf5775ad1232 (diff) | |
| download | rust-2a1b6c4de993c8db1bda35d58426d873e9e514c2.tar.gz rust-2a1b6c4de993c8db1bda35d58426d873e9e514c2.zip | |
librustc: Implement `&static` as the replacement for `Durable`. r=nmatsakis
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/kindck-owned-trait-scoped.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/kindck-owned-trait.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/kindck-owned.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/static-region-bound.rs | 9 | ||||
| -rw-r--r-- | src/test/run-pass/alignment-gep-tup-like-1.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/close-over-big-then-small-data.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/fixed-point-bind-unique.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2734.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2735.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2904.rs | 2 |
10 files changed, 19 insertions, 10 deletions
diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index d1eae60ac9d..b160ffe2ecd 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -35,7 +35,7 @@ fn to_foo_2<T:Copy>(t: T) -> foo { {f:t} as foo //~ ERROR value may contain borrowed pointers; use `durable` bound } -fn to_foo_3<T:Copy Durable>(t: T) -> foo { +fn to_foo_3<T:Copy &static>(t: T) -> foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs {f:t} as foo diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs index 35dc066e320..63d8212f41d 100644 --- a/src/test/compile-fail/kindck-owned-trait.rs +++ b/src/test/compile-fail/kindck-owned-trait.rs @@ -14,7 +14,7 @@ fn to_foo<T: Copy foo>(t: T) -> foo { t as foo //~ ERROR value may contain borrowed pointers; use `durable` bound } -fn to_foo2<T: Copy foo Durable>(t: T) -> foo { +fn to_foo2<T: Copy foo &static>(t: T) -> foo { t as foo } diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs index 111b621c5a0..9cd7b36095f 100644 --- a/src/test/compile-fail/kindck-owned.rs +++ b/src/test/compile-fail/kindck-owned.rs @@ -12,7 +12,7 @@ fn copy1<T: Copy>(t: T) -> fn@() -> T { fn@() -> T { t } //~ ERROR value may contain borrowed pointers } -fn copy2<T: Copy Durable>(t: T) -> fn@() -> T { +fn copy2<T: Copy &static>(t: T) -> fn@() -> T { fn@() -> T { t } } diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs new file mode 100644 index 00000000000..b70b0cdf881 --- /dev/null +++ b/src/test/compile-fail/static-region-bound.rs @@ -0,0 +1,9 @@ +fn f<T:&static>(_: T) {} + +fn main() { + let x = @3; + f(x); + let x = &3; + f(x); //~ ERROR instantiating a type parameter with an incompatible type +} + diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 8acbee4400c..a880b50d628 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -12,7 +12,7 @@ type pair<A,B> = { a: A, b: B }; -fn f<A:Copy Durable>(a: A, b: u16) -> fn@() -> (A, u16) { +fn f<A:Copy &static>(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index a0b55a1ea8d..a2a97f531de 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -16,7 +16,7 @@ type pair<A,B> = { a: A, b: B }; -fn f<A:Copy Durable>(a: A, b: u16) -> fn@() -> (A, u16) { +fn f<A:Copy &static>(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs index a00afd8c6d9..f01b2b082d0 100644 --- a/src/test/run-pass/fixed-point-bind-unique.rs +++ b/src/test/run-pass/fixed-point-bind-unique.rs @@ -11,11 +11,11 @@ // xfail-fast #[legacy_modes]; -fn fix_help<A: Durable, B: Owned>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { +fn fix_help<A: &static, B: Owned>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { return f({|a|fix_help(f, a)}, x); } -fn fix<A: Durable, B: Owned>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { +fn fix<A: &static, B: Owned>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { return {|a|fix_help(f, a)}; } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 7156e015473..0ab6c630ac8 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -11,7 +11,7 @@ trait hax { } impl <A> A: hax { } -fn perform_hax<T: Durable>(x: @T) -> hax { +fn perform_hax<T: &static>(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index 360e7b3c241..675397a0881 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -11,7 +11,7 @@ trait hax { } impl <A> A: hax { } -fn perform_hax<T: Durable>(x: @T) -> hax { +fn perform_hax<T: &static>(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 33e5e386e39..5e66d2c7c19 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -59,7 +59,7 @@ fn square_from_char(c: char) -> square { } } -fn read_board_grid<rdr: Durable io::Reader>(+in: rdr) -> ~[~[square]] { +fn read_board_grid<rdr: &static io::Reader>(+in: rdr) -> ~[~[square]] { let in = (move in) as io::Reader; let mut grid = ~[]; for in.each_line |line| { |
