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

@ -684,26 +684,26 @@ pub enum Type {
Self(ast::NodeId),
/// Primitives are just the fixed-size numeric types (plus int/uint/float), and char.
Primitive(ast::PrimTy),
Closure(~ClosureDecl, Option<Lifetime>),
Proc(~ClosureDecl),
Closure(Box<ClosureDecl>, Option<Lifetime>),
Proc(Box<ClosureDecl>),
/// extern "ABI" fn
BareFunction(~BareFunctionDecl),
BareFunction(Box<BareFunctionDecl>),
Tuple(Vec<Type>),
Vector(~Type),
FixedVector(~Type, ~str),
Vector(Box<Type>),
FixedVector(Box<Type>, ~str),
String,
Bool,
/// aka TyNil
Unit,
/// aka TyBot
Bottom,
Unique(~Type),
Managed(~Type),
RawPointer(Mutability, ~Type),
Unique(Box<Type>),
Managed(Box<Type>),
RawPointer(Mutability, Box<Type>),
BorrowedRef {
pub lifetime: Option<Lifetime>,
pub mutability: Mutability,
pub type_: ~Type,
pub type_: Box<Type>,
},
// region, raw, other boxes, mutable
}

View file

@ -83,8 +83,8 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, class: Option<&
let klass = match next.tok {
// If this '&' token is directly adjacent to another token, assume
// that it's the address-of operator instead of the and-operator.
// This allows us to give all pointers their own class (~ and @ are
// below).
// This allows us to give all pointers their own class (`Box` and
// `@` are below).
t::BINOP(t::AND) if lexer.peek().sp.lo == next.sp.hi => "kw-2",
t::AT | t::TILDE => "kw-2",

View file

@ -36,8 +36,11 @@ use html::markdown;
use passes;
use visit_ast::RustdocVisitor;
pub fn run(input: &str, cfgs: Vec<~str>,
libs: HashSet<Path>, mut test_args: Vec<~str>) -> int {
pub fn run(input: &str,
cfgs: Vec<~str>,
libs: HashSet<Path>,
mut test_args: Vec<~str>)
-> int {
let input_path = Path::new(input);
let input = driver::FileInput(input_path.clone());
@ -126,7 +129,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
let old = io::stdio::set_stderr(box w1);
spawn(proc() {
let mut p = io::ChanReader::new(rx);
let mut err = old.unwrap_or(box io::stderr() as ~Writer:Send);
let mut err = old.unwrap_or(box io::stderr() as Box<Writer:Send>);
io::util::copy(&mut p, &mut err).unwrap();
});
let emitter = diagnostic::EmitterWriter::new(box w2);