1
Fork 0

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:
Patrick Walton 2014-05-05 18:56:44 -07:00
parent 24f6f26e63
commit 090040bf40
495 changed files with 2252 additions and 1897 deletions

View file

@ -113,7 +113,7 @@ pub struct MyStruct {
impl ToJson for MyStruct {
fn to_json( &self ) -> json::Json {
let mut d = ~TreeMap::new();
let mut d = box TreeMap::new();
d.insert("attr1".to_owned(), self.attr1.to_json());
d.insert("attr2".to_owned(), self.attr2.to_json());
json::Object(d)
@ -206,7 +206,7 @@ pub struct TestStruct1 {
impl ToJson for TestStruct1 {
fn to_json( &self ) -> json::Json {
let mut d = ~TreeMap::new();
let mut d = box TreeMap::new();
d.insert("data_int".to_owned(), self.data_int.to_json());
d.insert("data_str".to_owned(), self.data_str.to_json());
d.insert("data_vector".to_owned(), self.data_vector.to_json());
@ -232,21 +232,20 @@ fn main() {
*/
use collections::HashMap;
use std::char;
use std::f64;
use std::fmt;
use std::io::MemWriter;
use std::io;
use std::num;
use std::str;
use std::str::ScalarValue;
use std::strbuf::StrBuf;
use std::fmt;
use std::vec::Vec;
use std::mem::swap;
use std::num;
use std::str::ScalarValue;
use std::str;
use std::strbuf::StrBuf;
use std::vec::Vec;
use Encodable;
use collections::TreeMap;
use collections::{HashMap, TreeMap};
/// Represents a json value
#[deriving(Clone, Eq)]
@ -255,7 +254,7 @@ pub enum Json {
String(~str),
Boolean(bool),
List(List),
Object(~Object),
Object(Box<Object>),
Null,
}