Skip to content

Commit 6d8342f

Browse files
committed
auto merge of #14835 : alexcrichton/rust/no-more-at, r=brson
All functionality is now available through `Gc<T>` and `box(GC) expr`. This change also removes `GC` from the prelude (it's an experimental feature).
2 parents d64f18c + ade807c commit 6d8342f

File tree

258 files changed

+946
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+946
-677
lines changed

src/compiletest/compiletest.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@ extern crate test;
2020
extern crate getopts;
2121
extern crate green;
2222
extern crate rustuv;
23-
24-
#[cfg(stage0)]
25-
#[phase(syntax, link)]
26-
extern crate log;
27-
28-
#[cfg(not(stage0))]
29-
#[phase(plugin, link)]
30-
extern crate log;
23+
#[phase(plugin, link)] extern crate log;
3124

3225
extern crate regex;
3326

src/liballoc/lib.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,16 @@
7070
#![no_std]
7171
#![feature(phase)]
7272

73-
#[cfg(stage0)]
74-
#[phase(syntax, link)]
75-
extern crate core;
76-
77-
#[cfg(not(stage0))]
7873
#[phase(plugin, link)]
7974
extern crate core;
80-
8175
extern crate libc;
8276

83-
8477
// Allow testing this library
8578

8679
#[cfg(test)] extern crate debug;
8780
#[cfg(test)] extern crate native;
88-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
89-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
90-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
91-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
81+
#[cfg(test)] #[phase(plugin, link)] extern crate std;
82+
#[cfg(test)] #[phase(plugin, link)] extern crate log;
9283

9384
// Heaps provided for low-level allocation strategies
9485

src/libcollections/lib.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,15 @@
2323
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
2424
#![no_std]
2525

26+
#[phase(plugin, link)] extern crate core;
2627
extern crate alloc;
2728

28-
#[cfg(stage0)]
29-
#[phase(syntax, link)]
30-
extern crate core;
31-
32-
#[cfg(not(stage0))]
33-
#[phase(plugin, link)]
34-
extern crate core;
35-
3629
#[cfg(test)] extern crate native;
3730
#[cfg(test)] extern crate test;
3831
#[cfg(test)] extern crate debug;
3932

40-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
41-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
42-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
43-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
33+
#[cfg(test)] #[phase(plugin, link)] extern crate std;
34+
#[cfg(test)] #[phase(plugin, link)] extern crate log;
4435

4536
use core::prelude::*;
4637

src/libcollections/ringbuf.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ impl<T: fmt::Show> fmt::Show for RingBuf<T> {
419419
mod tests {
420420
use std::fmt::Show;
421421
use std::prelude::*;
422+
use std::gc::{GC, Gc};
422423
use test::Bencher;
423424
use test;
424425

@@ -473,10 +474,10 @@ mod tests {
473474

474475
#[test]
475476
fn test_boxes() {
476-
let a: @int = @5;
477-
let b: @int = @72;
478-
let c: @int = @64;
479-
let d: @int = @175;
477+
let a: Gc<int> = box(GC) 5;
478+
let b: Gc<int> = box(GC) 72;
479+
let c: Gc<int> = box(GC) 64;
480+
let d: Gc<int> = box(GC) 175;
480481

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

622623
#[test]
623624
fn test_param_at_int() {
624-
test_parameterized::<@int>(@5, @72, @64, @175);
625+
test_parameterized::<Gc<int>>(box(GC) 5, box(GC) 72,
626+
box(GC) 64, box(GC) 175);
625627
}
626628

627629
#[test]

src/libcore/iter.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,7 @@ mod tests {
23452345
use num;
23462346
use realstd::vec::Vec;
23472347
use realstd::slice::Vector;
2348+
use realstd::gc::GC;
23482349

23492350
use cmp;
23502351
use realstd::owned::Box;
@@ -2835,7 +2836,8 @@ mod tests {
28352836
#[test]
28362837
#[should_fail]
28372838
fn test_rposition_fail() {
2838-
let v = [(box 0, @0), (box 0, @0), (box 0, @0), (box 0, @0)];
2839+
let v = [(box 0, box(GC) 0), (box 0, box(GC) 0),
2840+
(box 0, box(GC) 0), (box 0, box(GC) 0)];
28392841
let mut i = 0;
28402842
v.iter().rposition(|_elt| {
28412843
if i == 2 {

src/libdebug/reflect.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Runtime type reflection
1818

1919
use std::intrinsics::{Disr, Opaque, TyDesc, TyVisitor};
2020
use std::mem;
21+
use std::gc::Gc;
2122

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

221222
fn visit_box(&mut self, mtbl: uint, inner: *TyDesc) -> bool {
222-
self.align_to::<@u8>();
223+
self.align_to::<Gc<u8>>();
223224
if ! self.inner.visit_box(mtbl, inner) { return false; }
224-
self.bump_past::<@u8>();
225+
self.bump_past::<Gc<u8>>();
225226
true
226227
}
227228

src/libdebug/repr.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
288288
_align: uint) -> bool { fail!(); }
289289

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

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

608-
exact_test(&(@10), "@10");
609+
exact_test(&(box(GC) 10), "box(GC) 10");
609610
exact_test(&(box 10), "box 10");
610611
exact_test(&(&10), "&10");
611612
let mut x = 10;
@@ -619,8 +620,8 @@ fn test_repr() {
619620
"&[\"hi\", \"there\"]");
620621
exact_test(&(P{a:10, b:1.234}),
621622
"repr::P{a: 10, b: 1.234f64}");
622-
exact_test(&(@P{a:10, b:1.234}),
623-
"@repr::P{a: 10, b: 1.234f64}");
623+
exact_test(&(box(GC) P{a:10, b:1.234}),
624+
"box(GC) repr::P{a: 10, b: 1.234f64}");
624625
exact_test(&(box P{a:10, b:1.234}),
625626
"box repr::P{a: 10, b: 1.234f64}");
626627

src/libflate/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ Simple [DEFLATE][def]-based compression. This is a wrapper around the
2727
html_root_url = "http://doc.rust-lang.org/")]
2828
#![feature(phase)]
2929

30-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
31-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
30+
#[cfg(test)] #[phase(plugin, link)] extern crate log;
3231

3332
extern crate libc;
3433

src/libfourcc/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ use syntax::parse::token;
6363
use syntax::parse::token::InternedString;
6464
use rustc::plugin::Registry;
6565

66+
use std::gc::Gc;
67+
6668
#[plugin_registrar]
6769
pub fn plugin_registrar(reg: &mut Registry) {
6870
reg.register_macro("fourcc", expand_syntax_ext);
@@ -130,7 +132,8 @@ struct Ident {
130132
span: Span
131133
}
132134

133-
fn parse_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> (@ast::Expr, Option<Ident>) {
135+
fn parse_tts(cx: &ExtCtxt,
136+
tts: &[ast::TokenTree]) -> (Gc<ast::Expr>, Option<Ident>) {
134137
let p = &mut parse::new_parser_from_tts(cx.parse_sess(),
135138
cx.cfg(),
136139
tts.iter()

src/libgetopts/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@
9090
#![deny(missing_doc)]
9191

9292
#[cfg(test)] extern crate debug;
93-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
94-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
93+
#[cfg(test)] #[phase(plugin, link)] extern crate log;
9594

9695
use std::cmp::PartialEq;
9796
use std::fmt;

src/libhexfloat/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ use syntax::parse;
5757
use syntax::parse::token;
5858
use rustc::plugin::Registry;
5959

60+
use std::gc::Gc;
61+
6062
#[plugin_registrar]
6163
pub fn plugin_registrar(reg: &mut Registry) {
6264
reg.register_macro("hexfloat", expand_syntax_ext);
@@ -163,7 +165,8 @@ struct Ident {
163165
span: Span
164166
}
165167

166-
fn parse_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> (@ast::Expr, Option<Ident>) {
168+
fn parse_tts(cx: &ExtCtxt,
169+
tts: &[ast::TokenTree]) -> (Gc<ast::Expr>, Option<Ident>) {
167170
let p = &mut parse::new_parser_from_tts(cx.parse_sess(),
168171
cx.cfg(),
169172
tts.iter()

src/librand/lib.rs

+2-17
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,11 @@
2828
#![no_std]
2929
#![experimental]
3030

31-
#[cfg(stage0)]
32-
#[phase(syntax, link)]
33-
extern crate core;
34-
35-
#[cfg(not(stage0))]
3631
#[phase(plugin, link)]
3732
extern crate core;
3833

39-
#[cfg(test, stage0)]
40-
#[phase(syntax, link)] extern crate std;
41-
42-
#[cfg(test, stage0)]
43-
#[phase(syntax, link)] extern crate log;
44-
45-
#[cfg(test, not(stage0))]
46-
#[phase(plugin, link)] extern crate std;
47-
48-
#[cfg(test, not(stage0))]
49-
#[phase(plugin, link)] extern crate log;
50-
34+
#[cfg(test)] #[phase(plugin, link)] extern crate std;
35+
#[cfg(test)] #[phase(plugin, link)] extern crate log;
5136
#[cfg(test)] extern crate native;
5237
#[cfg(test)] extern crate debug;
5338

src/libregex_macros/lib.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern crate syntax;
2626
extern crate rustc;
2727

2828
use std::rc::Rc;
29+
use std::gc::{Gc, GC};
2930

3031
use syntax::ast;
3132
use syntax::codemap;
@@ -110,7 +111,7 @@ struct NfaGen<'a> {
110111
}
111112

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

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

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

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

577-
fn empty_block(&self) -> @ast::Expr {
578+
fn empty_block(&self) -> Gc<ast::Expr> {
578579
quote_expr!(self.cx, {})
579580
}
580581

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

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

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

604605
// Converts `xs` to a `[x1, x2, .., xN]` expression by calling `to_expr`
605606
// on each element in `xs`.
606-
fn vec_expr<T, It: Iterator<T>>(&self, xs: It, to_expr: |&ExtCtxt, T| -> @ast::Expr)
607-
-> @ast::Expr {
607+
fn vec_expr<T, It: Iterator<T>>(&self, xs: It,
608+
to_expr: |&ExtCtxt, T| -> Gc<ast::Expr>)
609+
-> Gc<ast::Expr> {
608610
let exprs = xs.map(|x| to_expr(self.cx, x)).collect();
609611
self.cx.expr_vec(self.sp, exprs)
610612
}

src/librustc/front/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use syntax::fold::Folder;
1212
use syntax::{ast, fold, attr};
1313
use syntax::codemap;
1414

15-
use std::gc::Gc;
15+
use std::gc::{Gc, GC};
1616

1717
struct Context<'a> {
1818
in_cfg: |attrs: &[ast::Attribute]|: 'a -> bool,

src/librustc/front/std_inject.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use syntax::parse::token;
2323
use syntax::util::small_vector::SmallVector;
2424

2525
use std::mem;
26-
use std::gc::Gc;
26+
use std::gc::{Gc, GC};
2727

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

src/librustc/front/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use front::config;
1818
use front::std_inject::with_version;
1919

2020
use std::cell::RefCell;
21-
use std::gc::Gc;
21+
use std::gc::{Gc, GC};
2222
use std::slice;
2323
use std::vec;
2424
use syntax::ast_util::*;

0 commit comments

Comments
 (0)