Skip to content

Fix #14915 #14920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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