2015-01-13 17:49:17 -06:00
|
|
|
// Copyright 2015 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.
|
|
|
|
|
|
|
|
// aux-build:no_method_suggested_traits.rs
|
|
|
|
|
|
|
|
extern crate no_method_suggested_traits;
|
|
|
|
|
2015-01-26 18:29:30 -06:00
|
|
|
struct Foo;
|
|
|
|
enum Bar { X }
|
|
|
|
|
2015-01-13 17:49:17 -06:00
|
|
|
mod foo {
|
2015-01-16 05:27:40 -06:00
|
|
|
trait Bar {
|
|
|
|
fn method(&self) {}
|
|
|
|
|
|
|
|
fn method2(&self) {}
|
2015-01-13 17:49:17 -06:00
|
|
|
}
|
2015-01-16 05:27:40 -06:00
|
|
|
|
|
|
|
impl Bar for u32 {}
|
|
|
|
|
|
|
|
impl Bar for char {}
|
2015-01-13 17:49:17 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-01-26 18:29:30 -06:00
|
|
|
// test the values themselves, and autoderef.
|
|
|
|
|
|
|
|
|
2015-01-13 17:49:17 -06:00
|
|
|
1u32.method();
|
2015-01-16 19:29:26 -06:00
|
|
|
//~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^^ ERROR no method named
|
2016-02-25 18:23:07 -06:00
|
|
|
//~^^^ HELP `use foo::Bar`
|
|
|
|
//~^^^^ HELP `use no_method_suggested_traits::foo::PubPub`
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&1u32)).method();
|
|
|
|
//~^ HELP following traits are implemented but not in scope, perhaps add a `use` for one of them
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^^ ERROR no method named
|
2016-02-25 18:23:07 -06:00
|
|
|
//~^^^ HELP `use foo::Bar`
|
|
|
|
//~^^^^ HELP `use no_method_suggested_traits::foo::PubPub`
|
2015-01-16 05:27:40 -06:00
|
|
|
|
|
|
|
'a'.method();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
2015-01-16 19:29:26 -06:00
|
|
|
//~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
|
2016-02-25 18:23:07 -06:00
|
|
|
//~^^^ HELP `use foo::Bar`
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&'a')).method();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
|
2016-02-25 18:23:07 -06:00
|
|
|
//~^^^ HELP `use foo::Bar`
|
2015-01-16 05:27:40 -06:00
|
|
|
|
|
|
|
1i32.method();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
2015-01-16 19:29:26 -06:00
|
|
|
//~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
|
2016-02-25 18:23:07 -06:00
|
|
|
//~^^^ HELP `use no_method_suggested_traits::foo::PubPub`
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&1i32)).method();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^ HELP the following trait is implemented but not in scope, perhaps add a `use` for it:
|
2016-02-25 18:23:07 -06:00
|
|
|
//~^^^ HELP `use no_method_suggested_traits::foo::PubPub`
|
2015-01-16 05:27:40 -06:00
|
|
|
|
2015-01-26 18:29:30 -06:00
|
|
|
Foo.method();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following traits define an item `method`, perhaps you need to implement one of them
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
//~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
|
|
|
//~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported`
|
|
|
|
//~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
|
|
|
|
//~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
|
|
|
|
//~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
|
|
|
|
std::rc::Rc::new(&mut Box::new(&Foo)).method();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following traits define an item `method`, perhaps you need to implement one of them
|
2015-01-16 05:27:40 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
//~^^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
|
|
|
//~^^^^^ HELP `no_method_suggested_traits::reexport::Reexported`
|
|
|
|
//~^^^^^^ HELP `no_method_suggested_traits::bar::PubPriv`
|
|
|
|
//~^^^^^^^ HELP `no_method_suggested_traits::qux::PrivPub`
|
|
|
|
//~^^^^^^^^ HELP `no_method_suggested_traits::quz::PrivPriv`
|
|
|
|
|
|
|
|
1u64.method2();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP the following trait defines an item `method2`, perhaps you need to implement it
|
2015-01-16 05:27:40 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&1u64)).method2();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP the following trait defines an item `method2`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
|
|
|
|
no_method_suggested_traits::Foo.method2();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
no_method_suggested_traits::Bar::X.method2();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method2`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `foo::Bar`
|
|
|
|
|
|
|
|
Foo.method3();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
|
|
|
std::rc::Rc::new(&mut Box::new(&Foo)).method3();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
|
|
|
Bar::X.method3();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
|
2015-01-13 17:49:17 -06:00
|
|
|
//~^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
//~^^ HELP following trait defines an item `method3`, perhaps you need to implement it
|
2015-01-26 18:29:30 -06:00
|
|
|
//~^^^ HELP `no_method_suggested_traits::foo::PubPub`
|
|
|
|
|
|
|
|
// should have no help:
|
2015-05-03 00:30:59 -05:00
|
|
|
1_usize.method3(); //~ ERROR no method named
|
|
|
|
std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named
|
|
|
|
no_method_suggested_traits::Foo.method3(); //~ ERROR no method named
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
|
|
|
no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named
|
2015-01-26 18:29:30 -06:00
|
|
|
std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
|
2015-05-03 00:30:59 -05:00
|
|
|
//~^ ERROR no method named
|
2015-01-13 17:49:17 -06:00
|
|
|
}
|