rustc: Obsolete the @ syntax entirely

This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
This commit is contained in:
Alex Crichton 2014-06-11 19:33:52 -07:00
parent f20b1293fc
commit ade807c6dc
239 changed files with 922 additions and 561 deletions

View file

@ -21,7 +21,7 @@ use std::fmt;
use std::fmt::Show;
use std::option::Option;
use std::rc::Rc;
use std::gc::Gc;
use std::gc::{Gc, GC};
use serialize::{Encodable, Decodable, Encoder, Decoder};
/// A pointer abstraction. FIXME(eddyb) #10676 use Rc<T> in the future.

View file

@ -20,7 +20,7 @@ use util::small_vector::SmallVector;
use std::cell::RefCell;
use std::fmt;
use std::gc::Gc;
use std::gc::{Gc, GC};
use std::iter;
use std::slice;

View file

@ -21,7 +21,7 @@ use visit;
use std::cell::Cell;
use std::cmp;
use std::gc::Gc;
use std::gc::{Gc, GC};
use std::u32;
pub fn path_name_i(idents: &[Ident]) -> String {

View file

@ -22,7 +22,7 @@ use crateid::CrateId;
use std::collections::HashSet;
use std::collections::BitvSet;
use std::gc::Gc;
use std::gc::{Gc, GC};
local_data_key!(used_attrs: BitvSet)

View file

@ -20,6 +20,8 @@ use parse;
use parse::token::InternedString;
use parse::token;
use std::gc::GC;
enum State {
Asm,
Outputs,

View file

@ -20,7 +20,7 @@ use parse::token::{InternedString, intern, str_to_ident};
use util::small_vector::SmallVector;
use std::collections::HashMap;
use std::gc::Gc;
use std::gc::{Gc, GC};
// new-style macro! tt code:
//

View file

@ -21,7 +21,7 @@ use parse::token::special_idents;
use parse::token::InternedString;
use parse::token;
use std::gc::Gc;
use std::gc::{Gc, GC};
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {

View file

@ -16,7 +16,7 @@ use owned_slice::OwnedSlice;
use parse::token;
use parse::token::{str_to_ident};
use std::string::String;
use std::gc::GC;
pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
-> Box<base::MacResult> {

View file

@ -178,7 +178,7 @@ StaticEnum(<ast::EnumDef of C>, ~[(<ident of C0>, <span of C0>, Unnamed(~[<span
*/
use std::cell::RefCell;
use std::gc::Gc;
use std::gc::{Gc, GC};
use ast;
use ast::{P, EnumDef, Expr, Ident, Generics, StructDef};

View file

@ -29,7 +29,7 @@ use visit;
use visit::Visitor;
use util::small_vector::SmallVector;
use std::gc::Gc;
use std::gc::{Gc, GC};
pub fn expand_expr(e: Gc<ast::Expr>, fld: &mut MacroExpander) -> Gc<ast::Expr> {
match e.node {
@ -1030,6 +1030,8 @@ mod test {
use visit;
use visit::Visitor;
use std::gc::GC;
// a visitor that extracts the paths
// from a given thingy and puts them in a mutable
// array (passed in to the traversal)

View file

@ -20,7 +20,7 @@ use rsparse = parse;
use parse = fmt_macros;
use std::collections::HashMap;
use std::gc::Gc;
use std::gc::{Gc, GC};
#[deriving(PartialEq)]
enum ArgumentType {

View file

@ -22,6 +22,7 @@ use parse::token::{Token, EOF, Nonterminal};
use parse::token;
use std::rc::Rc;
use std::gc::GC;
use std::collections::HashMap;
/* This is an Earley-like parser, without support for in-grammar nonterminals,

View file

@ -17,7 +17,7 @@ use owned_slice::OwnedSlice;
use util::small_vector::SmallVector;
use std::rc::Rc;
use std::gc::Gc;
use std::gc::{Gc, GC};
// We may eventually want to be able to fold over type parameters, too.
pub trait Folder {

View file

@ -16,7 +16,7 @@ use parse::token;
use parse::parser::Parser;
use parse::token::INTERPOLATED;
use std::gc::Gc;
use std::gc::{Gc, GC};
// a parser that can parse attributes.
pub trait ParserAttr {

View file

@ -282,6 +282,7 @@ mod test {
use std::io;
use std::io::MemWriter;
use std::str;
use std::gc::GC;
use codemap::{Span, BytePos, Spanned};
use owned_slice::OwnedSlice;
use ast;

View file

@ -22,7 +22,7 @@ use codemap::{Span, respan};
use parse::parser;
use parse::token;
use std::gc::Gc;
use std::gc::{Gc, GC};
/// The specific types of unsupported syntax
#[deriving(PartialEq, Eq, Hash)]
@ -31,6 +31,8 @@ pub enum ObsoleteSyntax {
ObsoleteOwnedExpr,
ObsoleteOwnedPattern,
ObsoleteOwnedVector,
ObsoleteManagedType,
ObsoleteManagedExpr,
}
pub trait ParserObsoleteMethods {
@ -68,6 +70,14 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
"`~[T]` is no longer a type",
"use the `Vec` type instead"
),
ObsoleteManagedType => (
"`@` notation for managed pointers",
"use `Gc<T>` in `std::gc` instead"
),
ObsoleteManagedExpr => (
"`@` notation for a managed pointer allocation",
"use the `box(GC)` oeprator instead of `@`"
),
};
self.report(sp, kind, kind_str, desc);

View file

@ -79,7 +79,7 @@ use owned_slice::OwnedSlice;
use std::collections::HashSet;
use std::mem::replace;
use std::rc::Rc;
use std::gc::Gc;
use std::gc::{Gc, GC};
#[allow(non_camel_case_types)]
#[deriving(PartialEq)]
@ -1342,6 +1342,8 @@ impl<'a> Parser<'a> {
} else if self.token == token::AT {
// MANAGED POINTER
self.bump();
let span = self.last_span;
self.obsolete(span, ObsoleteManagedType);
TyBox(self.parse_ty(plus_allowed))
} else if self.token == token::TILDE {
// OWNED POINTER
@ -2375,9 +2377,10 @@ impl<'a> Parser<'a> {
}
token::AT => {
self.bump();
let span = self.last_span;
self.obsolete(span, ObsoleteManagedExpr);
let e = self.parse_prefix_expr();
hi = e.span.hi;
// HACK: pretending @[] is a (removed) @-vec
ex = self.mk_unary(UnBox, e);
}
token::TILDE => {

View file

@ -15,6 +15,8 @@ use parse::{new_parser_from_source_str};
use parse::parser::Parser;
use parse::token;
use std::gc::Gc;
// map a string to tts, using a made-up filename:
pub fn string_to_tts(source_str: String) -> Vec<ast::TokenTree> {
let ps = new_parse_sess();
@ -46,21 +48,21 @@ pub fn string_to_crate (source_str : String) -> ast::Crate {
}
// parse a string, return an expr
pub fn string_to_expr (source_str : String) -> @ast::Expr {
pub fn string_to_expr (source_str : String) -> Gc<ast::Expr> {
with_error_checking_parse(source_str, |p| {
p.parse_expr()
})
}
// parse a string, return an item
pub fn string_to_item (source_str : String) -> Option<@ast::Item> {
pub fn string_to_item (source_str : String) -> Option<Gc<ast::Item>> {
with_error_checking_parse(source_str, |p| {
p.parse_item(Vec::new())
})
}
// parse a string, return a stmt
pub fn string_to_stmt(source_str : String) -> @ast::Stmt {
pub fn string_to_stmt(source_str : String) -> Gc<ast::Stmt> {
with_error_checking_parse(source_str, |p| {
p.parse_stmt(Vec::new())
})
@ -68,7 +70,7 @@ pub fn string_to_stmt(source_str : String) -> @ast::Stmt {
// parse a string, return a pat. Uses "irrefutable"... which doesn't
// (currently) affect parsing.
pub fn string_to_pat(source_str: String) -> @ast::Pat {
pub fn string_to_pat(source_str: String) -> Gc<ast::Pat> {
string_to_parser(&new_parse_sess(), source_str).parse_pat()
}