]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coherence/coherence_inherent_cc.rs
Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync
[rust.git] / src / test / ui / coherence / coherence_inherent_cc.rs
1 // aux-build:coherence_inherent_cc_lib.rs
2
3 // Tests that methods that implement a trait cannot be invoked
4 // unless the trait is imported.
5
6 extern crate coherence_inherent_cc_lib;
7
8 mod Import {
9     // Trait is in scope here:
10     use coherence_inherent_cc_lib::TheStruct;
11     use coherence_inherent_cc_lib::TheTrait;
12
13     fn call_the_fn(s: &TheStruct) {
14         s.the_fn();
15     }
16 }
17
18 mod NoImport {
19     // Trait is not in scope here:
20     use coherence_inherent_cc_lib::TheStruct;
21
22     fn call_the_fn(s: &TheStruct) {
23         s.the_fn();
24         //~^ ERROR E0599
25     }
26 }
27
28 fn main() {}