]> git.lizzy.rs Git - rust.git/blob - src/test/ui/functions-closures/fn-help-with-err.rs
Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco
[rust.git] / src / test / 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     //~| NOTE `Bar` defines an item `bar`, perhaps you need to implement it
8     fn bar(&self) {}
9 }
10
11 impl Bar for Foo {}
12
13 fn main() {
14     let arc = std::sync::Arc::new(oops);
15     //~^ ERROR cannot find value `oops` in this scope
16     //~| NOTE not found
17     arc.bar();
18     //~^ ERROR no method named `bar`
19     //~| NOTE method not found
20     //~| HELP items from traits can only be used if the trait is implemented and in scope
21
22     let arc2 = std::sync::Arc::new(|| Foo);
23     arc2.bar();
24     //~^ ERROR no method named `bar`
25     //~| NOTE method not found
26     //~| HELP items from traits can only be used if the trait is implemented and in scope
27     //~| HELP use parentheses to call this closure
28 }