From ebde8cfa618756ee615cb543c832b53653ce2977 Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Sun, 15 Jun 2014 10:04:55 -0700 Subject: [PATCH] Change prints: @T -> Gc , ~T -> Box Fixes #14915 --- src/librustc/util/ppaux.rs | 4 ++-- src/test/compile-fail/autoderef-full-lval.rs | 4 ++-- src/test/compile-fail/issue-14915.rs | 21 +++++++++++++++++++ src/test/compile-fail/issue-7013.rs | 2 +- src/test/compile-fail/issue-7061.rs | 2 +- .../regions-infer-paramd-indirect.rs | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 src/test/compile-fail/issue-14915.rs diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index aac0b12e46f..ac8ca05f8d0 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -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); diff --git a/src/test/compile-fail/autoderef-full-lval.rs b/src/test/compile-fail/autoderef-full-lval.rs index f4b410d3031..dd928bfa9d4 100644 --- a/src/test/compile-fail/autoderef-full-lval.rs +++ b/src/test/compile-fail/autoderef-full-lval.rs @@ -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` 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` println!("{:?}", answer); assert_eq!(answer, 42); } diff --git a/src/test/compile-fail/issue-14915.rs b/src/test/compile-fail/issue-14915.rs new file mode 100644 index 00000000000..e24830907d3 --- /dev/null +++ b/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 or the MIT license +// , 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 = box 0; + let y: Gc = box (GC) 0; + + println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box` + //~^ ERROR cannot determine a type for this bounded type parameter: unconstrained type + println!("{}", y + 1); + //~^ ERROR binary operation `+` cannot be applied to type `Gc` +} diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index bff8ba629aa..ea332c1e252 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -32,7 +32,7 @@ struct A { fn main() { let a = A {v: box B{v: None} as Box}; - //~^ ERROR cannot pack type `~B`, which does not fulfill `Send` + //~^ ERROR cannot pack type `Box`, which does not fulfill `Send` let v = Rc::new(RefCell::new(a)); let w = v.clone(); let b = &*v; diff --git a/src/test/compile-fail/issue-7061.rs b/src/test/compile-fail/issue-7061.rs index b05bff20825..b644d98926c 100644 --- a/src/test/compile-fail/issue-7061.rs +++ b/src/test/compile-fail/issue-7061.rs @@ -16,7 +16,7 @@ struct BarStruct; impl<'a> BarStruct { fn foo(&'a mut self) -> Gc { self } - //~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct + //~^ ERROR: error: mismatched types: expected `Gc` but found `&'a mut BarStruct } fn main() {} diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/compile-fail/regions-infer-paramd-indirect.rs index b5b89ebcc2f..ea2e6feba57 100644 --- a/src/test/compile-fail/regions-infer-paramd-indirect.rs +++ b/src/test/compile-fail/regions-infer-paramd-indirect.rs @@ -33,7 +33,7 @@ impl<'a> set_f<'a> for c<'a> { } fn set_f_bad(&self, b: Gc) { - self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int` + self.f = b; //~ ERROR mismatched types: expected `Gc>` but found `Gc>` //~^ ERROR cannot infer } }