]> git.proxmox.com Git - rustc.git/blob - tests/ui/coherence/coherence_inherent_cc.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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() {}