librustc: Remove ~EXPR
, ~TYPE
, and ~PAT
from the language, except
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
This commit is contained in:
parent
24f6f26e63
commit
090040bf40
495 changed files with 2252 additions and 1897 deletions
|
@ -94,7 +94,7 @@ static STATIC10: UnsafeStruct = UnsafeStruct;
|
|||
|
||||
struct MyOwned;
|
||||
|
||||
static STATIC11: ~MyOwned = ~MyOwned;
|
||||
static STATIC11: Box<MyOwned> = box MyOwned;
|
||||
//~^ ERROR static items are not allowed to have owned pointers
|
||||
|
||||
// The following examples test that mutable structs are just forbidden
|
||||
|
@ -109,11 +109,12 @@ static mut STATIC13: SafeStruct = SafeStruct{field1: Variant1, field2: Variant3(
|
|||
static mut STATIC14: SafeStruct = SafeStruct{field1: Variant1, field2: Variant4("str".to_owned())};
|
||||
//~^ ERROR mutable static items are not allowed to have destructors
|
||||
|
||||
static STATIC15: &'static [~MyOwned] = &'static [~MyOwned, ~MyOwned];
|
||||
static STATIC15: &'static [Box<MyOwned>] = &'static [box MyOwned, box MyOwned];
|
||||
//~^ ERROR static items are not allowed to have owned pointers
|
||||
//~^^ ERROR static items are not allowed to have owned pointers
|
||||
|
||||
static STATIC16: (&'static ~MyOwned, &'static ~MyOwned) = (&'static ~MyOwned, &'static ~MyOwned);
|
||||
static STATIC16: (&'static Box<MyOwned>, &'static Box<MyOwned>) =
|
||||
(&'static box MyOwned, &'static box MyOwned);
|
||||
//~^ ERROR static items are not allowed to have owned pointers
|
||||
//~^^ ERROR static items are not allowed to have owned pointers
|
||||
|
||||
|
@ -123,10 +124,10 @@ static mut STATIC17: SafeEnum = Variant1;
|
|||
static STATIC18: @SafeStruct = @SafeStruct{field1: Variant1, field2: Variant2(0)};
|
||||
//~^ ERROR static items are not allowed to have managed pointers
|
||||
|
||||
static STATIC19: ~int = box 3;
|
||||
static STATIC19: Box<int> = box 3;
|
||||
//~^ ERROR static items are not allowed to have owned pointers
|
||||
|
||||
pub fn main() {
|
||||
let y = { static x: ~int = ~3; x };
|
||||
let y = { static x: Box<int> = box 3; x };
|
||||
//~^ ERROR static items are not allowed to have owned pointers
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue