Removed @self and @Trait.

This commit is contained in:
Eduard Burtescu 2014-02-07 00:38:33 +02:00
parent c13a929d58
commit b2d30b72bf
122 changed files with 627 additions and 1694 deletions

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
trait Foo {
fn borrowed<'a>(&'a self) -> &'a ();
}
@ -18,14 +16,6 @@ fn borrowed_receiver<'a>(x: &'a Foo) -> &'a () {
x.borrowed()
}
fn managed_receiver(x: @Foo) -> &() {
x.borrowed() //~ ERROR cannot root managed value long enough
}
fn managed_receiver_1(x: @Foo) {
*x.borrowed()
}
fn owned_receiver(x: ~Foo) -> &() {
x.borrowed() //~ ERROR borrowed value does not live long enough
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
trait Foo {
fn borrowed(&self);
fn borrowed_mut(&mut self);
@ -25,11 +23,6 @@ fn borrowed_mut_receiver(x: &mut Foo) {
x.borrowed_mut();
}
fn managed_receiver(x: @Foo) {
x.borrowed();
x.borrowed_mut(); //~ ERROR cannot borrow
}
fn owned_receiver(x: ~Foo) {
x.borrowed();
x.borrowed_mut(); //~ ERROR cannot borrow

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
trait noisy {
fn speak(&self);
}
@ -59,6 +57,6 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
}
fn main() {
let nyan : @noisy = @cat(0, 2, ~"nyan") as @noisy;
let nyan: ~noisy = ~cat(0, 2, ~"nyan") as ~noisy;
nyan.eat(); //~ ERROR does not implement any method in scope named `eat`
}

View file

@ -8,9 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
// error-pattern: type `@Foo:'static` does not implement any method in scope named `foo`
// error-pattern: type `&Foo<no-bounds>` does not implement any method in scope named `foo`
trait Foo {
fn foo(~self);
@ -21,5 +19,5 @@ impl Foo for int {
}
fn main() {
(@5 as @Foo).foo();
(&5 as &Foo).foo();
}

View file

@ -1,26 +0,0 @@
// Copyright 2012 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.
#[feature(managed_boxes)];
trait foo { fn foo(&self); }
fn to_foo<T:Clone + foo>(t: T) -> @foo {
@t as @foo
//~^ ERROR value may contain references; add `'static` bound
//~^^ ERROR cannot pack type
//~^^^ ERROR value may contain references
}
fn to_foo2<T:Clone + foo + 'static>(t: T) -> @foo {
@t as @foo
}
fn main() {}

View file

@ -23,8 +23,6 @@ fn main() {
@2; //~ ERROR type uses managed
fn f(_: @Clone) {} //~ ERROR type uses managed
~2; //~ ERROR type uses owned
~[1]; //~ ERROR type uses owned
//~^ ERROR type uses owned

View file

@ -8,16 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
use std::container::Map;
use std::hashmap::HashMap;
// Test that trait types printed in error msgs include the type arguments.
fn main() {
let x: @HashMap<~str, ~str> = @HashMap::new();
let x: @Map<~str, ~str> = x;
let y: @Map<uint, ~str> = @x;
//~^ ERROR failed to find an implementation of trait std::container::Map<uint,~str> for @std::container::Map<~str,~str>:'static
let x: ~HashMap<~str, ~str> = ~HashMap::new();
let x: ~Map<~str, ~str> = x;
let y: ~Map<uint, ~str> = ~x;
//~^ ERROR failed to find an implementation of trait std::container::Map<uint,~str> for ~std::container::Map<~str,~str>:Send
}

View file

@ -8,12 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
// Test that an object type `@Foo` is not considered to implement the
// Test that an object type `~Foo` is not considered to implement the
// trait `Foo`. Issue #5087.
trait Foo {}
fn take_foo<F:Foo>(f: F) {}
fn take_object(f: @Foo) { take_foo(f); } //~ ERROR failed to find an implementation of trait
fn take_object(f: ~Foo) { take_foo(f); } //~ ERROR failed to find an implementation of trait
fn main() {}

View file

@ -8,35 +8,22 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
trait Foo {
fn borrowed(&self);
fn borrowed_mut(&mut self);
fn managed(@self);
fn owned(~self);
}
fn borrowed_receiver(x: &Foo) {
x.borrowed();
x.borrowed_mut(); // See [1]
x.managed(); //~ ERROR does not implement any method
x.owned(); //~ ERROR does not implement any method
}
fn borrowed_mut_receiver(x: &mut Foo) {
x.borrowed();
x.borrowed_mut();
x.managed(); //~ ERROR does not implement any method
x.owned(); //~ ERROR does not implement any method
}
fn managed_receiver(x: @Foo) {
x.borrowed();
x.borrowed_mut(); // See [1]
x.managed();
x.owned(); //~ ERROR does not implement any method
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
struct ctxt { v: uint }
trait get_ctxt {
@ -29,12 +27,12 @@ impl<'a> get_ctxt for has_ctxt<'a> {
}
fn get_v(gc: @get_ctxt) -> uint {
fn get_v(gc: ~get_ctxt) -> uint {
gc.get_ctxt().v
}
fn main() {
let ctxt = ctxt { v: 22u };
let hc = has_ctxt { c: &ctxt };
assert_eq!(get_v(@hc as @get_ctxt), 22u);
assert_eq!(get_v(~hc as ~get_ctxt), 22u);
}

View file

@ -8,13 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
trait add {
fn plus(&self, x: Self) -> Self;
}
fn do_add(x: @add, y: @add) -> @add {
fn do_add(x: ~add, y: ~add) -> ~add {
x.plus(y) //~ ERROR cannot call a method whose type contains a self-type through an object
}

View file

@ -8,32 +8,22 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
// Tests for "default" bounds inferred for traits with no bounds list.
trait Foo {
}
trait Foo {}
fn a(_x: ~Foo) { // should be same as ~Foo:Send
}
fn b(_x: @Foo) { // should be same as ~Foo:'static
fn b(_x: &'static Foo) { // should be same as &'static Foo:'static
}
fn c(_x: &'static Foo) { // should be same as &'static Foo:'static
}
fn d(x: ~Foo:Freeze) {
fn c(x: ~Foo:Freeze) {
a(x); //~ ERROR expected bounds `Send`
}
fn e(x: @Foo:Freeze) {
fn d(x: &'static Foo:Freeze) {
b(x); //~ ERROR expected bounds `'static`
}
fn f(x: &'static Foo:Freeze) {
c(x); //~ ERROR expected bounds `'static`
}
fn main() { }
fn main() {}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
struct Struct {
person: &'static str
}
@ -25,7 +23,7 @@ impl Trait<&'static str> for Struct {
}
fn main() {
let s: @Trait<int> = @Struct { person: "Fred" }; //~ ERROR expected Trait<int>, but found Trait<&'static str>
let s: ~Trait<int> = ~Struct { person: "Fred" }; //~ ERROR expected Trait<int>, but found Trait<&'static str>
//~^ ERROR expected Trait<int>, but found Trait<&'static str>
s.f(1);
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
struct Struct {
person: &'static str
}
@ -27,6 +25,6 @@ impl Trait<&'static str> for Struct {
fn main() {
let person = ~"Fred";
let person: &str = person; //~ ERROR borrowed value does not live long enough
let s: @Trait<&'static str> = @Struct { person: person };
let s: ~Trait<&'static str> = ~Struct { person: person };
}

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(managed_boxes)];
trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
impl bar for int { fn dup(&self) -> int { *self } fn blah<X>(&self) {} }
impl bar for uint { fn dup(&self) -> uint { *self } fn blah<X>(&self) {} }
@ -17,5 +15,5 @@ impl bar for uint { fn dup(&self) -> uint { *self } fn blah<X>(&self) {} }
fn main() {
10i.dup::<int>(); //~ ERROR does not take type parameters
10i.blah::<int, int>(); //~ ERROR incorrect number of type parameters
(@10 as @bar).dup(); //~ ERROR contains a self-type
(~10 as ~bar).dup(); //~ ERROR contains a self-type
}