Skip to content

Commit 8a91d33

Browse files
committed
rustc: remove support for Gc.
1 parent d1a57e4 commit 8a91d33

Some content is hidden

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

43 files changed

+55
-565
lines changed

src/librustc/lint/builtin.rs

Lines changed: 1 addition & 19 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) {

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(..)) |

src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ fn check_and_get_illegal_move_origin(bccx: &BorrowckCtxt,
132132
match cmt.cat {
133133
mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
134134
mc::cat_deref(_, _, mc::Implicit(..)) |
135-
mc::cat_deref(_, _, mc::GcPtr) |
136135
mc::cat_deref(_, _, mc::UnsafePtr(..)) |
137136
mc::cat_upvar(..) | mc::cat_static_item |
138137
mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, .. }) => {

src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
8282

8383
mc::cat_downcast(ref base) |
8484
mc::cat_deref(ref base, _, mc::OwnedPtr) | // L-Deref-Send
85-
mc::cat_interior(ref base, _) | // L-Field
86-
mc::cat_deref(ref base, _, mc::GcPtr) => {
85+
mc::cat_interior(ref base, _) => { // L-Field
8786
self.check(base, discr_scope)
8887
}
8988

@@ -185,7 +184,6 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
185184
}
186185
mc::cat_downcast(ref cmt) |
187186
mc::cat_deref(ref cmt, _, mc::OwnedPtr) |
188-
mc::cat_deref(ref cmt, _, mc::GcPtr) |
189187
mc::cat_interior(ref cmt, _) |
190188
mc::cat_discr(ref cmt, _) => {
191189
self.scope(cmt)

src/librustc/middle/borrowck/gather_loans/move_error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ fn report_cannot_move_out_of(bccx: &BorrowckCtxt, move_from: mc::cmt) {
114114
match move_from.cat {
115115
mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
116116
mc::cat_deref(_, _, mc::Implicit(..)) |
117-
mc::cat_deref(_, _, mc::GcPtr) |
118117
mc::cat_deref(_, _, mc::UnsafePtr(..)) |
119118
mc::cat_upvar(..) | mc::cat_static_item |
120119
mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, .. }) => {

src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,13 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
101101
self.extend(result, cmt.mutbl, LpInterior(i))
102102
}
103103

104-
mc::cat_deref(cmt_base, _, pk @ mc::OwnedPtr) |
105-
mc::cat_deref(cmt_base, _, pk @ mc::GcPtr) => {
104+
mc::cat_deref(cmt_base, _, pk @ mc::OwnedPtr) => {
106105
// R-Deref-Send-Pointer
107106
//
108107
// When we borrow the interior of an owned pointer, we
109108
// cannot permit the base to be mutated, because that
110109
// would cause the unique pointer to be freed.
111110
//
112-
// For a managed pointer, the rules are basically the
113-
// same, because this could be the last ref.
114111
// Eventually we should make these non-special and
115112
// just rely on Deref<T> implementation.
116113
let result = self.restrict(cmt_base);

src/librustc/middle/borrowck/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
730730
span,
731731
format!("{} in a static location", prefix).as_slice());
732732
}
733-
mc::AliasableManaged => {
734-
self.tcx.sess.span_err(
735-
span,
736-
format!("{} in a `Gc` pointer", prefix).as_slice());
737-
}
738733
mc::AliasableBorrowed => {
739734
self.tcx.sess.span_err(
740735
span,

src/librustc/middle/check_match.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,6 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
440440
}
441441
}
442442

443-
ty::ty_box(_) => {
444-
assert_eq!(pats_len, 1);
445-
PatBox(pats.nth(0).unwrap())
446-
}
447-
448443
ty::ty_vec(_, Some(len)) => {
449444
assert_eq!(pats_len, len);
450445
PatVec(pats.collect(), None, vec![])
@@ -681,7 +676,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
681676
pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) -> uint {
682677
match ty::get(ty).sty {
683678
ty::ty_tup(ref fs) => fs.len(),
684-
ty::ty_box(_) | ty::ty_uniq(_) => 1u,
679+
ty::ty_uniq(_) => 1u,
685680
ty::ty_rptr(_, ty::mt { ty: ty, .. }) => match ty::get(ty).sty {
686681
ty::ty_vec(_, None) => match *ctor {
687682
Slice(length) => length,

0 commit comments

Comments
 (0)