Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove @ syntax for Gc'd pointers #14835

Merged
merged 2 commits into from
Jun 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ extern crate test;
extern crate getopts;
extern crate green;
extern crate rustuv;

#[cfg(stage0)]
#[phase(syntax, link)]
extern crate log;

#[cfg(not(stage0))]
#[phase(plugin, link)]
extern crate log;
#[phase(plugin, link)] extern crate log;

extern crate regex;

Expand Down
13 changes: 2 additions & 11 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,16 @@
#![no_std]
#![feature(phase)]

#[cfg(stage0)]
#[phase(syntax, link)]
extern crate core;

#[cfg(not(stage0))]
#[phase(plugin, link)]
extern crate core;

extern crate libc;


// Allow testing this library

#[cfg(test)] extern crate debug;
#[cfg(test)] extern crate native;
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
#[cfg(test)] #[phase(plugin, link)] extern crate std;
#[cfg(test)] #[phase(plugin, link)] extern crate log;

// Heaps provided for low-level allocation strategies

Expand Down
15 changes: 3 additions & 12 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,15 @@
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
#![no_std]

#[phase(plugin, link)] extern crate core;
extern crate alloc;

#[cfg(stage0)]
#[phase(syntax, link)]
extern crate core;

#[cfg(not(stage0))]
#[phase(plugin, link)]
extern crate core;

#[cfg(test)] extern crate native;
#[cfg(test)] extern crate test;
#[cfg(test)] extern crate debug;

#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
#[cfg(test)] #[phase(plugin, link)] extern crate std;
#[cfg(test)] #[phase(plugin, link)] extern crate log;

use core::prelude::*;

Expand Down
12 changes: 7 additions & 5 deletions src/libcollections/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ impl<T: fmt::Show> fmt::Show for RingBuf<T> {
mod tests {
use std::fmt::Show;
use std::prelude::*;
use std::gc::{GC, Gc};
use test::Bencher;
use test;

Expand Down Expand Up @@ -473,10 +474,10 @@ mod tests {

#[test]
fn test_boxes() {
let a: @int = @5;
let b: @int = @72;
let c: @int = @64;
let d: @int = @175;
let a: Gc<int> = box(GC) 5;
let b: Gc<int> = box(GC) 72;
let c: Gc<int> = box(GC) 64;
let d: Gc<int> = box(GC) 175;

let mut deq = RingBuf::new();
assert_eq!(deq.len(), 0);
Expand Down Expand Up @@ -621,7 +622,8 @@ mod tests {

#[test]
fn test_param_at_int() {
test_parameterized::<@int>(@5, @72, @64, @175);
test_parameterized::<Gc<int>>(box(GC) 5, box(GC) 72,
box(GC) 64, box(GC) 175);
}

#[test]
Expand Down
4 changes: 3 additions & 1 deletion src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,7 @@ mod tests {
use num;
use realstd::vec::Vec;
use realstd::slice::Vector;
use realstd::gc::GC;

use cmp;
use realstd::owned::Box;
Expand Down Expand Up @@ -2835,7 +2836,8 @@ mod tests {
#[test]
#[should_fail]
fn test_rposition_fail() {
let v = [(box 0, @0), (box 0, @0), (box 0, @0), (box 0, @0)];
let v = [(box 0, box(GC) 0), (box 0, box(GC) 0),
(box 0, box(GC) 0), (box 0, box(GC) 0)];
let mut i = 0;
v.iter().rposition(|_elt| {
if i == 2 {
Expand Down
5 changes: 3 additions & 2 deletions src/libdebug/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Runtime type reflection

use std::intrinsics::{Disr, Opaque, TyDesc, TyVisitor};
use std::mem;
use std::gc::Gc;

/**
* Trait for visitor that wishes to reflect on data.
Expand Down Expand Up @@ -219,9 +220,9 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
}

fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
self.align_to::<@u8>();
self.align_to::<Gc<u8>>();
if ! self.inner.visit_box(mtbl, inner) { return false; }
self.bump_past::<@u8>();
self.bump_past::<Gc<u8>>();
true
}

Expand Down
9 changes: 5 additions & 4 deletions src/libdebug/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
_align: uint) -> bool { fail!(); }

fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
try!(self, self.writer.write(['@' as u8]));
try!(self, self.writer.write("box(GC) ".as_bytes()));
self.write_mut_qualifier(mtbl);
self.get::<&raw::Box<()>>(|this, b| {
let p = &b.data as *() as *u8;
Expand Down Expand Up @@ -591,6 +591,7 @@ fn test_repr() {
use std::io::stdio::println;
use std::char::is_alphabetic;
use std::mem::swap;
use std::gc::GC;

fn exact_test<T>(t: &T, e:&str) {
let mut m = io::MemWriter::new();
Expand All @@ -605,7 +606,7 @@ fn test_repr() {
exact_test(&1.234, "1.234f64");
exact_test(&("hello"), "\"hello\"");

exact_test(&(@10), "@10");
exact_test(&(box(GC) 10), "box(GC) 10");
exact_test(&(box 10), "box 10");
exact_test(&(&10), "&10");
let mut x = 10;
Expand All @@ -619,8 +620,8 @@ fn test_repr() {
"&[\"hi\", \"there\"]");
exact_test(&(P{a:10, b:1.234}),
"repr::P{a: 10, b: 1.234f64}");
exact_test(&(@P{a:10, b:1.234}),
"@repr::P{a: 10, b: 1.234f64}");
exact_test(&(box(GC) P{a:10, b:1.234}),
"box(GC) repr::P{a: 10, b: 1.234f64}");
exact_test(&(box P{a:10, b:1.234}),
"box repr::P{a: 10, b: 1.234f64}");

Expand Down
3 changes: 1 addition & 2 deletions src/libflate/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Simple [DEFLATE][def]-based compression. This is a wrapper around the
html_root_url = "http://doc.rust-lang.org/")]
#![feature(phase)]

#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
#[cfg(test)] #[phase(plugin, link)] extern crate log;

extern crate libc;

Expand Down
5 changes: 4 additions & 1 deletion src/libfourcc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ use syntax::parse::token;
use syntax::parse::token::InternedString;
use rustc::plugin::Registry;

use std::gc::Gc;

#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("fourcc", expand_syntax_ext);
Expand Down Expand Up @@ -130,7 +132,8 @@ struct Ident {
span: Span
}

fn parse_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> (@ast::Expr, Option<Ident>) {
fn parse_tts(cx: &ExtCtxt,
tts: &[ast::TokenTree]) -> (Gc<ast::Expr>, Option<Ident>) {
let p = &mut parse::new_parser_from_tts(cx.parse_sess(),
cx.cfg(),
tts.iter()
Expand Down
3 changes: 1 addition & 2 deletions src/libgetopts/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@
#![deny(missing_doc)]

#[cfg(test)] extern crate debug;
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
#[cfg(test)] #[phase(plugin, link)] extern crate log;

use std::cmp::PartialEq;
use std::fmt;
Expand Down
5 changes: 4 additions & 1 deletion src/libhexfloat/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ use syntax::parse;
use syntax::parse::token;
use rustc::plugin::Registry;

use std::gc::Gc;

#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("hexfloat", expand_syntax_ext);
Expand Down Expand Up @@ -163,7 +165,8 @@ struct Ident {
span: Span
}

fn parse_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> (@ast::Expr, Option<Ident>) {
fn parse_tts(cx: &ExtCtxt,
tts: &[ast::TokenTree]) -> (Gc<ast::Expr>, Option<Ident>) {
let p = &mut parse::new_parser_from_tts(cx.parse_sess(),
cx.cfg(),
tts.iter()
Expand Down
19 changes: 2 additions & 17 deletions src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,11 @@
#![no_std]
#![experimental]

#[cfg(stage0)]
#[phase(syntax, link)]
extern crate core;

#[cfg(not(stage0))]
#[phase(plugin, link)]
extern crate core;

#[cfg(test, stage0)]
#[phase(syntax, link)] extern crate std;

#[cfg(test, stage0)]
#[phase(syntax, link)] extern crate log;

#[cfg(test, not(stage0))]
#[phase(plugin, link)] extern crate std;

#[cfg(test, not(stage0))]
#[phase(plugin, link)] extern crate log;

#[cfg(test)] #[phase(plugin, link)] extern crate std;
#[cfg(test)] #[phase(plugin, link)] extern crate log;
#[cfg(test)] extern crate native;
#[cfg(test)] extern crate debug;

Expand Down
26 changes: 14 additions & 12 deletions src/libregex_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern crate syntax;
extern crate rustc;

use std::rc::Rc;
use std::gc::{Gc, GC};

use syntax::ast;
use syntax::codemap;
Expand Down Expand Up @@ -110,7 +111,7 @@ struct NfaGen<'a> {
}

impl<'a> NfaGen<'a> {
fn code(&mut self) -> @ast::Expr {
fn code(&mut self) -> Gc<ast::Expr> {
// Most or all of the following things are used in the quasiquoted
// expression returned.
let num_cap_locs = 2 * self.prog.num_captures();
Expand Down Expand Up @@ -331,7 +332,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,

// Generates code for the `add` method, which is responsible for adding
// zero-width states to the next queue of states to visit.
fn add_insts(&self) -> @ast::Expr {
fn add_insts(&self) -> Gc<ast::Expr> {
let arms = self.prog.insts.iter().enumerate().map(|(pc, inst)| {
let nextpc = pc + 1;
let body = match *inst {
Expand Down Expand Up @@ -432,7 +433,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,

// Generates the code for the `step` method, which processes all states
// in the current queue that consume a single character.
fn step_insts(&self) -> @ast::Expr {
fn step_insts(&self) -> Gc<ast::Expr> {
let arms = self.prog.insts.iter().enumerate().map(|(pc, inst)| {
let nextpc = pc + 1;
let body = match *inst {
Expand Down Expand Up @@ -523,7 +524,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
// Translates a character class into a match expression.
// This avoids a binary search (and is hopefully replaced by a jump
// table).
fn match_class(&self, casei: bool, ranges: &[(char, char)]) -> @ast::Expr {
fn match_class(&self, casei: bool, ranges: &[(char, char)]) -> Gc<ast::Expr> {
let expr_true = quote_expr!(self.cx, true);

let mut arms = ranges.iter().map(|&(mut start, mut end)| {
Expand All @@ -545,7 +546,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
// Generates code for checking a literal prefix of the search string.
// The code is only generated if the regex *has* a literal prefix.
// Otherwise, a no-op is returned.
fn check_prefix(&self) -> @ast::Expr {
fn check_prefix(&self) -> Gc<ast::Expr> {
if self.prog.prefix.len() == 0 {
self.empty_block()
} else {
Expand All @@ -569,28 +570,28 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
// A wild-card arm is automatically added that executes a no-op. It will
// never be used, but is added to satisfy the compiler complaining about
// non-exhaustive patterns.
fn match_insts(&self, mut arms: Vec<ast::Arm>) -> @ast::Expr {
fn match_insts(&self, mut arms: Vec<ast::Arm>) -> Gc<ast::Expr> {
arms.push(self.wild_arm_expr(self.empty_block()));
self.cx.expr_match(self.sp, quote_expr!(self.cx, pc), arms)
}

fn empty_block(&self) -> @ast::Expr {
fn empty_block(&self) -> Gc<ast::Expr> {
quote_expr!(self.cx, {})
}

// Creates a match arm for the instruction at `pc` with the expression
// `body`.
fn arm_inst(&self, pc: uint, body: @ast::Expr) -> ast::Arm {
fn arm_inst(&self, pc: uint, body: Gc<ast::Expr>) -> ast::Arm {
let pc_pat = self.cx.pat_lit(self.sp, quote_expr!(self.cx, $pc));

self.cx.arm(self.sp, vec!(pc_pat), body)
}

// Creates a wild-card match arm with the expression `body`.
fn wild_arm_expr(&self, body: @ast::Expr) -> ast::Arm {
fn wild_arm_expr(&self, body: Gc<ast::Expr>) -> ast::Arm {
ast::Arm {
attrs: vec!(),
pats: vec!(@ast::Pat{
pats: vec!(box(GC) ast::Pat{
id: ast::DUMMY_NODE_ID,
span: self.sp,
node: ast::PatWild,
Expand All @@ -603,8 +604,9 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,

// Converts `xs` to a `[x1, x2, .., xN]` expression by calling `to_expr`
// on each element in `xs`.
fn vec_expr<T, It: Iterator<T>>(&self, xs: It, to_expr: |&ExtCtxt, T| -> @ast::Expr)
-> @ast::Expr {
fn vec_expr<T, It: Iterator<T>>(&self, xs: It,
to_expr: |&ExtCtxt, T| -> Gc<ast::Expr>)
-> Gc<ast::Expr> {
let exprs = xs.map(|x| to_expr(self.cx, x)).collect();
self.cx.expr_vec(self.sp, exprs)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use syntax::fold::Folder;
use syntax::{ast, fold, attr};
use syntax::codemap;

use std::gc::Gc;
use std::gc::{Gc, GC};

struct Context<'a> {
in_cfg: |attrs: &[ast::Attribute]|: 'a -> bool,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/std_inject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use syntax::parse::token;
use syntax::util::small_vector::SmallVector;

use std::mem;
use std::gc::Gc;
use std::gc::{Gc, GC};

pub static VERSION: &'static str = "0.11.0-pre";

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use front::config;
use front::std_inject::with_version;

use std::cell::RefCell;
use std::gc::Gc;
use std::gc::{Gc, GC};
use std::slice;
use std::vec;
use syntax::ast_util::*;
Expand Down
Loading