]> git.lizzy.rs Git - rust.git/blob - tests/ui/functions-closures/fn-help-with-err.rs
Rollup merge of #106785 - compiler-errors:better-impl-wf-spans, r=estebank
[rust.git] / tests / ui / functions-closures / fn-help-with-err.rs
1 // This test case checks the behavior of typeck::check::method::suggest::is_fn on Ty::Error.
2
3 struct Foo;
4
5 trait Bar {
6     //~^ NOTE `Bar` defines an item `bar`, perhaps you need to implement it
7     fn bar(&self) {}
8 }
9
10 impl Bar for Foo {}
11
12 fn main() {
13     let arc = std::sync::Arc::new(oops);
14     //~^ ERROR cannot find value `oops` in this scope
15     //~| NOTE not found
16     arc.bar();
17
18     let arc2 = std::sync::Arc::new(|| Foo);
19     arc2.bar();
20     //~^ ERROR no method named `bar`
21     //~| NOTE method not found
22     //~| HELP items from traits can only be used if the trait is implemented and in scope
23     //~| HELP use parentheses to call this closure
24 }