Skip to content

Commit 7ae802f

Browse files
committed
rollup merge of rust-lang#17666 : eddyb/take-garbage-out
Conflicts: src/libcollections/lib.rs src/libcore/lib.rs src/librustdoc/lib.rs src/librustrt/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/test/run-pass/issue-8898.rs
2 parents ebe4da9 + 58bea31 commit 7ae802f

File tree

287 files changed

+435
-5088
lines changed

Some content is hidden

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

287 files changed

+435
-5088
lines changed

src/doc/guide-pointers.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -632,19 +632,6 @@ This part is coming soon.
632632

633633
This part is coming soon.
634634

635-
# Gc
636-
637-
The `Gc<T>` type exists for historical reasons, and is [still used
638-
internally](https://github.com/rust-lang/rust/issues/7929) by the compiler.
639-
It is not even a 'real' garbage collected type at the moment.
640-
641-
In the future, Rust may have a real garbage collected type, and so it
642-
has not yet been removed for that reason.
643-
644-
## Best practices
645-
646-
There is currently no legitimate use case for the `Gc<T>` type.
647-
648635
# Raw Pointers
649636

650637
This part is coming soon.

src/doc/guide-runtime.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ list):
3131
* Task synchronization
3232
* Task-local storage
3333
* Logging
34-
* Local heaps (GC heaps)
3534
* Task unwinding
3635

3736
## What is the runtime accomplishing?

src/doc/guide-unsafe.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ pub struct Unique<T> {
208208
// Implement methods for creating and using the values in the box.
209209
210210
// NB: For simplicity and correctness, we require that T has kind Send
211-
// (owned boxes relax this restriction, and can contain managed (GC) boxes).
212-
// This is because, as implemented, the garbage collector would not know
213-
// about any shared boxes stored in the malloc'd region of memory.
211+
// (owned boxes relax this restriction).
214212
impl<T: Send> Unique<T> {
215213
pub fn new(value: T) -> Unique<T> {
216214
unsafe {

src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3381,7 +3381,7 @@ fn main() {
33813381
33823382
```
33833383

3384-
Patterns can also dereference pointers by using the `&`, `box` or `@` symbols,
3384+
Patterns can also dereference pointers by using the `&`, `box` symbols,
33853385
as appropriate. For example, these two matches on `x: &int` are equivalent:
33863386

33873387
```

src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ pub use boxed as owned;
9292

9393
pub mod heap;
9494
pub mod libc_heap;
95-
pub mod util;
9695

9796
// Primitive types using the heaps above
9897

src/liballoc/rc.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,6 @@ mod tests {
541541
assert!(y.upgrade().is_none());
542542
}
543543

544-
#[test]
545-
fn gc_inside() {
546-
// see issue #11532
547-
use std::gc::GC;
548-
let a = Rc::new(RefCell::new(box(GC) 1i));
549-
assert!(a.try_borrow_mut().is_some());
550-
}
551-
552544
#[test]
553545
fn weak_self_cyclic() {
554546
struct Cycle {

src/liballoc/util.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
html_root_url = "http://doc.rust-lang.org/master/",
2020
html_playground_url = "http://play.rust-lang.org/")]
2121

22-
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
22+
#![feature(macro_rules, default_type_params, phase, globs)]
2323
#![feature(unsafe_destructor, import_shadowing)]
2424
#![no_std]
2525

src/libcollections/ringbuf.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ impl<T: fmt::Show> fmt::Show for RingBuf<T> {
532532
mod tests {
533533
use std::fmt::Show;
534534
use std::prelude::*;
535-
use std::gc::{GC, Gc};
536535
use std::hash;
537536
use test::Bencher;
538537
use test;
@@ -587,43 +586,6 @@ mod tests {
587586
assert_eq!(*d.get(3), 4);
588587
}
589588

590-
#[test]
591-
#[allow(deprecated)]
592-
fn test_boxes() {
593-
let a: Gc<int> = box(GC) 5;
594-
let b: Gc<int> = box(GC) 72;
595-
let c: Gc<int> = box(GC) 64;
596-
let d: Gc<int> = box(GC) 175;
597-
598-
let mut deq = RingBuf::new();
599-
assert_eq!(deq.len(), 0);
600-
deq.push_front(a);
601-
deq.push_front(b);
602-
deq.push(c);
603-
assert_eq!(deq.len(), 3);
604-
deq.push(d);
605-
assert_eq!(deq.len(), 4);
606-
assert_eq!(deq.front(), Some(&b));
607-
assert_eq!(deq.back(), Some(&d));
608-
assert_eq!(deq.pop_front(), Some(b));
609-
assert_eq!(deq.pop(), Some(d));
610-
assert_eq!(deq.pop(), Some(c));
611-
assert_eq!(deq.pop(), Some(a));
612-
assert_eq!(deq.len(), 0);
613-
deq.push(c);
614-
assert_eq!(deq.len(), 1);
615-
deq.push_front(b);
616-
assert_eq!(deq.len(), 2);
617-
deq.push(d);
618-
assert_eq!(deq.len(), 3);
619-
deq.push_front(a);
620-
assert_eq!(deq.len(), 4);
621-
assert_eq!(*deq.get(0), a);
622-
assert_eq!(*deq.get(1), b);
623-
assert_eq!(*deq.get(2), c);
624-
assert_eq!(*deq.get(3), d);
625-
}
626-
627589
#[cfg(test)]
628590
fn test_parameterized<T:Clone + PartialEq + Show>(a: T, b: T, c: T, d: T) {
629591
let mut deq = RingBuf::new();
@@ -755,12 +717,6 @@ mod tests {
755717
test_parameterized::<int>(5, 72, 64, 175);
756718
}
757719

758-
#[test]
759-
fn test_param_at_int() {
760-
test_parameterized::<Gc<int>>(box(GC) 5, box(GC) 72,
761-
box(GC) 64, box(GC) 175);
762-
}
763-
764720
#[test]
765721
fn test_param_taggy() {
766722
test_parameterized::<Taggy>(One(1), Two(1, 2), Three(1, 2, 3), Two(17, 42));

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
html_playground_url = "http://play.rust-lang.org/")]
5858

5959
#![no_std]
60-
#![feature(globs, intrinsics, lang_items, macro_rules, managed_boxes, phase)]
60+
#![feature(globs, intrinsics, lang_items, macro_rules, phase)]
6161
#![feature(simd, unsafe_destructor)]
6262
#![deny(missing_doc)]
6363

src/libcore/raw.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@
2020
2121
use mem;
2222

23-
/// The representation of `std::gc::Gc`.
24-
pub struct GcBox<T> {
25-
pub ref_count: uint,
26-
pub drop_glue: fn(ptr: *mut u8),
27-
pub prev: *mut GcBox<T>,
28-
pub next: *mut GcBox<T>,
29-
pub data: T,
30-
}
31-
3223
/// The representation of a Rust slice
3324
pub struct Slice<T> {
3425
pub data: *const T,

src/libcoretest/iter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,8 @@ fn test_rposition() {
528528
#[test]
529529
#[should_fail]
530530
fn test_rposition_fail() {
531-
use std::gc::GC;
532-
let v = [(box 0i, box(GC) 0i), (box 0i, box(GC) 0i),
533-
(box 0i, box(GC) 0i), (box 0i, box(GC) 0i)];
531+
let v = [(box 0i, box 0i), (box 0i, box 0i),
532+
(box 0i, box 0i), (box 0i, box 0i)];
534533
let mut i = 0i;
535534
v.iter().rposition(|_elt| {
536535
if i == 2 {

src/libdebug/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2626
html_root_url = "http://doc.rust-lang.org/master/")]
2727
#![experimental]
28-
#![feature(managed_boxes, macro_rules)]
28+
#![feature(macro_rules)]
2929
#![allow(experimental)]
3030

3131
pub mod fmt;

src/libdebug/reflect.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Runtime type reflection
1818

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

2322
/**
2423
* Trait for visitor that wishes to reflect on data.
@@ -194,9 +193,9 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
194193
}
195194

196195
fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
197-
self.align_to::<Gc<u8>>();
196+
self.align_to::<Box<u8>>();
198197
if ! self.inner.visit_box(mtbl, inner) { return false; }
199-
self.bump_past::<Gc<u8>>();
198+
self.bump_past::<Box<u8>>();
200199
true
201200
}
202201

src/libdebug/repr.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,9 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
274274
self.get::<&str>(|this, s| this.write_escaped_slice(*s))
275275
}
276276

277-
fn visit_box(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
278-
try!(self, self.writer.write("box(GC) ".as_bytes()));
279-
self.write_mut_qualifier(mtbl);
280-
self.get::<&raw::GcBox<()>>(|this, b| {
281-
let p = &b.data as *const () as *const u8;
282-
this.visit_ptr_inner(p, inner)
283-
})
277+
fn visit_box(&mut self, _mtbl: uint, _inner: *const TyDesc) -> bool {
278+
try!(self, self.writer.write("box(GC) ???".as_bytes()));
279+
true
284280
}
285281

286282
fn visit_uniq(&mut self, _mtbl: uint, inner: *const TyDesc) -> bool {
@@ -576,7 +572,6 @@ fn test_repr() {
576572
use std::io::stdio::println;
577573
use std::char::is_alphabetic;
578574
use std::mem::swap;
579-
use std::gc::GC;
580575

581576
fn exact_test<T>(t: &T, e:&str) {
582577
let mut m = io::MemWriter::new();
@@ -591,7 +586,6 @@ fn test_repr() {
591586
exact_test(&1.234f64, "1.234f64");
592587
exact_test(&("hello"), "\"hello\"");
593588

594-
exact_test(&(box(GC) 10i), "box(GC) 10");
595589
exact_test(&(box 10i), "box 10");
596590
exact_test(&(&10i), "&10");
597591
let mut x = 10i;
@@ -605,8 +599,6 @@ fn test_repr() {
605599
"&[\"hi\", \"there\"]");
606600
exact_test(&(P{a:10, b:1.234}),
607601
"repr::P{a: 10, b: 1.234f64}");
608-
exact_test(&(box(GC) P{a:10, b:1.234}),
609-
"box(GC) repr::P{a: 10, b: 1.234f64}");
610602
exact_test(&(box P{a:10, b:1.234}),
611603
"box repr::P{a: 10, b: 1.234f64}");
612604

src/libfourcc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() {
5050
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
5151
html_root_url = "http://doc.rust-lang.org/master/")]
5252

53-
#![feature(plugin_registrar, managed_boxes)]
53+
#![feature(plugin_registrar)]
5454

5555
extern crate syntax;
5656
extern crate rustc;

src/libhexfloat/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn main() {
4646
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
4747
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
4848
html_root_url = "http://doc.rust-lang.org/master/")]
49-
#![feature(plugin_registrar, managed_boxes)]
49+
#![feature(plugin_registrar)]
5050

5151
extern crate syntax;
5252
extern crate rustc;

src/libregex_macros/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2020
html_root_url = "http://doc.rust-lang.org/master/")]
2121

22-
#![feature(plugin_registrar, managed_boxes, quote)]
22+
#![feature(plugin_registrar, quote)]
2323

2424
extern crate regex;
2525
extern crate syntax;

src/librustc/lint/builtin.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -412,26 +412,16 @@ impl LintPass for CTypes {
412412
}
413413
}
414414

415-
declare_lint!(MANAGED_HEAP_MEMORY, Allow,
416-
"use of managed (@ type) heap memory")
417-
418415
declare_lint!(OWNED_HEAP_MEMORY, Allow,
419416
"use of owned (Box type) heap memory")
420417

421-
declare_lint!(HEAP_MEMORY, Allow,
422-
"use of any (Box type or @ type) heap memory")
423-
424418
pub struct HeapMemory;
425419

426420
impl HeapMemory {
427421
fn check_heap_type(&self, cx: &Context, span: Span, ty: ty::t) {
428-
let mut n_box = 0i;
429422
let mut n_uniq = 0i;
430423
ty::fold_ty(cx.tcx, ty, |t| {
431424
match ty::get(t).sty {
432-
ty::ty_box(_) => {
433-
n_box += 1;
434-
}
435425
ty::ty_uniq(_) |
436426
ty::ty_closure(box ty::ClosureTy {
437427
store: ty::UniqTraitStore,
@@ -449,21 +439,13 @@ impl HeapMemory {
449439
let s = ty_to_string(cx.tcx, ty);
450440
let m = format!("type uses owned (Box type) pointers: {}", s);
451441
cx.span_lint(OWNED_HEAP_MEMORY, span, m.as_slice());
452-
cx.span_lint(HEAP_MEMORY, span, m.as_slice());
453-
}
454-
455-
if n_box > 0 {
456-
let s = ty_to_string(cx.tcx, ty);
457-
let m = format!("type uses managed (@ type) pointers: {}", s);
458-
cx.span_lint(MANAGED_HEAP_MEMORY, span, m.as_slice());
459-
cx.span_lint(HEAP_MEMORY, span, m.as_slice());
460442
}
461443
}
462444
}
463445

464446
impl LintPass for HeapMemory {
465447
fn get_lints(&self) -> LintArray {
466-
lint_array!(MANAGED_HEAP_MEMORY, OWNED_HEAP_MEMORY, HEAP_MEMORY)
448+
lint_array!(OWNED_HEAP_MEMORY)
467449
}
468450

469451
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
@@ -1289,7 +1271,7 @@ impl LintPass for UnnecessaryAllocation {
12891271

12901272
fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
12911273
match e.node {
1292-
ast::ExprUnary(ast::UnUniq, _) | ast::ExprUnary(ast::UnBox, _) => (),
1274+
ast::ExprUnary(ast::UnUniq, _) => (),
12931275
_ => return
12941276
}
12951277

src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
397397
assert_eq!(next(st), '|');
398398
return ty::mk_param(st.tcx, space, index, did);
399399
}
400-
'@' => return ty::mk_box(st.tcx, parse_ty(st, |x,y| conv(x,y))),
401400
'~' => return ty::mk_uniq(st.tcx, parse_ty(st, |x,y| conv(x,y))),
402401
'*' => return ty::mk_ptr(st.tcx, parse_mt(st, |x,y| conv(x,y))),
403402
'&' => {

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ fn enc_sty(w: &mut SeekableMemWriter, cx: &ctxt, st: &ty::sty) {
244244
for t in ts.iter() { enc_ty(w, cx, *t); }
245245
mywrite!(w, "]");
246246
}
247-
ty::ty_box(typ) => { mywrite!(w, "@"); enc_ty(w, cx, typ); }
248247
ty::ty_uniq(typ) => { mywrite!(w, "~"); enc_ty(w, cx, typ); }
249248
ty::ty_ptr(mt) => { mywrite!(w, "*"); enc_mt(w, cx, mt); }
250249
ty::ty_rptr(r, mt) => {

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,6 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
815815
return;
816816
}
817817

818-
mc::cat_deref(_, _, mc::GcPtr) => {
819-
assert_eq!(cmt.mutbl, mc::McImmutable);
820-
return;
821-
}
822-
823818
mc::cat_rvalue(..) |
824819
mc::cat_static_item |
825820
mc::cat_deref(_, _, mc::UnsafePtr(..)) |

0 commit comments

Comments
 (0)