2014-05-19 16:27:03 -05:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
fn bar(&self);
|
|
|
|
fn baz(&self) { }
|
2015-12-11 01:59:11 -06:00
|
|
|
fn bah(_: Option<&Self>) { }
|
2014-05-19 16:27:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
struct BarTy {
|
2015-01-08 04:54:35 -06:00
|
|
|
x : isize,
|
2014-05-19 16:27:03 -05:00
|
|
|
y : f64,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl BarTy {
|
|
|
|
fn a() {}
|
|
|
|
fn b(&self) {}
|
|
|
|
}
|
|
|
|
|
2014-06-25 14:47:34 -05:00
|
|
|
impl Foo for *const BarTy {
|
2014-05-19 16:27:03 -05:00
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
a;
|
2015-02-20 00:17:05 -06:00
|
|
|
//~^ ERROR: unresolved name `a`
|
2014-05-19 16:27:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Foo for &'a BarTy {
|
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
x;
|
|
|
|
//~^ ERROR: unresolved name `x`. Did you mean `self.x`?
|
|
|
|
y;
|
|
|
|
//~^ ERROR: unresolved name `y`. Did you mean `self.y`?
|
|
|
|
a;
|
2015-02-20 00:17:05 -06:00
|
|
|
//~^ ERROR: unresolved name `a`
|
2014-05-19 16:27:03 -05:00
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
b;
|
2015-02-20 00:17:05 -06:00
|
|
|
//~^ ERROR: unresolved name `b`
|
2014-05-19 16:27:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Foo for &'a mut BarTy {
|
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
x;
|
|
|
|
//~^ ERROR: unresolved name `x`. Did you mean `self.x`?
|
|
|
|
y;
|
|
|
|
//~^ ERROR: unresolved name `y`. Did you mean `self.y`?
|
|
|
|
a;
|
2015-02-20 00:17:05 -06:00
|
|
|
//~^ ERROR: unresolved name `a`
|
2014-05-19 16:27:03 -05:00
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
b;
|
2015-02-20 00:17:05 -06:00
|
|
|
//~^ ERROR: unresolved name `b`
|
2014-05-19 16:27:03 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo for Box<BarTy> {
|
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
impl Foo for *const isize {
|
2014-05-19 16:27:03 -05:00
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
impl<'a> Foo for &'a isize {
|
2014-05-19 16:27:03 -05:00
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
impl<'a> Foo for &'a mut isize {
|
2014-05-19 16:27:03 -05:00
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
impl Foo for Box<isize> {
|
2014-05-19 16:27:03 -05:00
|
|
|
fn bar(&self) {
|
|
|
|
baz();
|
|
|
|
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
|
|
|
|
bah;
|
|
|
|
//~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
|
|
|
|
}
|
|
|
|
}
|