Skip to content

Commit ebde8cf

Browse files
schmeealexcrichton
authored andcommitted
Change prints: @t -> Gc<T> , ~T -> Box<T>
Fixes #14915
1 parent 9945052 commit ebde8cf

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

src/librustc/util/ppaux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String {
351351
ty_uint(t) => ast_util::uint_ty_to_str(t, None,
352352
ast_util::AutoSuffix).to_string(),
353353
ty_float(t) => ast_util::float_ty_to_str(t).to_string(),
354-
ty_box(typ) => format!("@{}", ty_to_str(cx, typ)),
355-
ty_uniq(typ) => format!("~{}", ty_to_str(cx, typ)),
354+
ty_box(typ) => format!("Gc<{}>", ty_to_str(cx, typ)),
355+
ty_uniq(typ) => format!("Box<{}>", ty_to_str(cx, typ)),
356356
ty_ptr(ref tm) => format!("*{}", mt_to_str(cx, tm)),
357357
ty_rptr(r, ref tm) => {
358358
let mut buf = region_ptr_to_str(cx, r);

src/test/compile-fail/autoderef-full-lval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ struct fish {
2626
fn main() {
2727
let a: clam = clam{x: box(GC) 1, y: box(GC) 2};
2828
let b: clam = clam{x: box(GC) 10, y: box(GC) 20};
29-
let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `@int`
29+
let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `Gc<int>`
3030
println!("{:?}", z);
3131
assert_eq!(z, 21);
3232
let forty: fish = fish{a: box(GC) 40};
3333
let two: fish = fish{a: box(GC) 2};
3434
let answer: int = forty.a + two.a;
35-
//~^ ERROR binary operation `+` cannot be applied to type `@int`
35+
//~^ ERROR binary operation `+` cannot be applied to type `Gc<int>`
3636
println!("{:?}", answer);
3737
assert_eq!(answer, 42);
3838
}

src/test/compile-fail/issue-14915.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::gc::{GC,Gc};
12+
13+
fn main() {
14+
let x: Box<int> = box 0;
15+
let y: Gc<int> = box (GC) 0;
16+
17+
println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box<int>`
18+
//~^ ERROR cannot determine a type for this bounded type parameter: unconstrained type
19+
println!("{}", y + 1);
20+
//~^ ERROR binary operation `+` cannot be applied to type `Gc<int>`
21+
}

src/test/compile-fail/issue-7013.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct A {
3232

3333
fn main() {
3434
let a = A {v: box B{v: None} as Box<Foo+Send>};
35-
//~^ ERROR cannot pack type `~B`, which does not fulfill `Send`
35+
//~^ ERROR cannot pack type `Box<B>`, which does not fulfill `Send`
3636
let v = Rc::new(RefCell::new(a));
3737
let w = v.clone();
3838
let b = &*v;

src/test/compile-fail/issue-7061.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct BarStruct;
1616

1717
impl<'a> BarStruct {
1818
fn foo(&'a mut self) -> Gc<BarStruct> { self }
19-
//~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct
19+
//~^ ERROR: error: mismatched types: expected `Gc<BarStruct>` but found `&'a mut BarStruct
2020
}
2121

2222
fn main() {}

src/test/compile-fail/regions-infer-paramd-indirect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'a> set_f<'a> for c<'a> {
3333
}
3434

3535
fn set_f_bad(&self, b: Gc<b>) {
36-
self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int`
36+
self.f = b; //~ ERROR mismatched types: expected `Gc<Gc<&'a int>>` but found `Gc<Gc<&int>>`
3737
//~^ ERROR cannot infer
3838
}
3939
}

0 commit comments

Comments
 (0)