2022-02-13 14:06:06 -06:00
|
|
|
// This test case checks the behavior of typeck::check::method::suggest::is_fn on Ty::Error.
|
2022-08-27 15:59:07 -05:00
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
trait Bar {
|
|
|
|
//~^ NOTE `Bar` defines an item `bar`, perhaps you need to implement it
|
|
|
|
fn bar(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Bar for Foo {}
|
|
|
|
|
2022-02-13 14:06:06 -06:00
|
|
|
fn main() {
|
|
|
|
let arc = std::sync::Arc::new(oops);
|
|
|
|
//~^ ERROR cannot find value `oops` in this scope
|
|
|
|
//~| NOTE not found
|
2022-08-27 15:59:07 -05:00
|
|
|
arc.bar();
|
|
|
|
|
|
|
|
let arc2 = std::sync::Arc::new(|| Foo);
|
|
|
|
arc2.bar();
|
|
|
|
//~^ ERROR no method named `bar`
|
2022-02-13 14:06:06 -06:00
|
|
|
//~| NOTE method not found
|
2022-08-27 15:59:07 -05:00
|
|
|
//~| HELP items from traits can only be used if the trait is implemented and in scope
|
|
|
|
//~| HELP use parentheses to call this closure
|
2022-02-13 14:06:06 -06:00
|
|
|
}
|