Skip to content

Commit

Permalink
Change prints: @t -> Gc<T> , ~T -> Box<T>
Browse files Browse the repository at this point in the history
Fixes #14915
  • Loading branch information
schmee authored and alexcrichton committed Jun 17, 2014
1 parent 9945052 commit ebde8cf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/librustc/util/ppaux.rs
Expand Up @@ -351,8 +351,8 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String {
ty_uint(t) => ast_util::uint_ty_to_str(t, None,
ast_util::AutoSuffix).to_string(),
ty_float(t) => ast_util::float_ty_to_str(t).to_string(),
ty_box(typ) => format!("@{}", ty_to_str(cx, typ)),
ty_uniq(typ) => format!("~{}", ty_to_str(cx, typ)),
ty_box(typ) => format!("Gc<{}>", ty_to_str(cx, typ)),
ty_uniq(typ) => format!("Box<{}>", ty_to_str(cx, typ)),
ty_ptr(ref tm) => format!("*{}", mt_to_str(cx, tm)),
ty_rptr(r, ref tm) => {
let mut buf = region_ptr_to_str(cx, r);
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/autoderef-full-lval.rs
Expand Up @@ -26,13 +26,13 @@ struct fish {
fn main() {
let a: clam = clam{x: box(GC) 1, y: box(GC) 2};
let b: clam = clam{x: box(GC) 10, y: box(GC) 20};
let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `@int`
let z: int = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `Gc<int>`
println!("{:?}", z);
assert_eq!(z, 21);
let forty: fish = fish{a: box(GC) 40};
let two: fish = fish{a: box(GC) 2};
let answer: int = forty.a + two.a;
//~^ ERROR binary operation `+` cannot be applied to type `@int`
//~^ ERROR binary operation `+` cannot be applied to type `Gc<int>`
println!("{:?}", answer);
assert_eq!(answer, 42);
}
21 changes: 21 additions & 0 deletions src/test/compile-fail/issue-14915.rs
@@ -0,0 +1,21 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

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

fn main() {
let x: Box<int> = box 0;
let y: Gc<int> = box (GC) 0;

println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box<int>`
//~^ ERROR cannot determine a type for this bounded type parameter: unconstrained type
println!("{}", y + 1);
//~^ ERROR binary operation `+` cannot be applied to type `Gc<int>`
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-7013.rs
Expand Up @@ -32,7 +32,7 @@ struct A {

fn main() {
let a = A {v: box B{v: None} as Box<Foo+Send>};
//~^ ERROR cannot pack type `~B`, which does not fulfill `Send`
//~^ ERROR cannot pack type `Box<B>`, which does not fulfill `Send`
let v = Rc::new(RefCell::new(a));
let w = v.clone();
let b = &*v;
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-7061.rs
Expand Up @@ -16,7 +16,7 @@ struct BarStruct;

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

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/regions-infer-paramd-indirect.rs
Expand Up @@ -33,7 +33,7 @@ impl<'a> set_f<'a> for c<'a> {
}

fn set_f_bad(&self, b: Gc<b>) {
self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int`
self.f = b; //~ ERROR mismatched types: expected `Gc<Gc<&'a int>>` but found `Gc<Gc<&int>>`
//~^ ERROR cannot infer
}
}
Expand Down

0 comments on commit ebde8cf

Please sign in to comment.