]>
Commit | Line | Data |
---|---|---|
1a4d82fc | 1 | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT |
223e47cc LB |
2 | // file at the top-level directory of this distribution and at |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
223e47cc LB |
11 | // aux-build:coherence_inherent_cc_lib.rs |
12 | ||
13 | // Tests that methods that implement a trait cannot be invoked | |
14 | // unless the trait is imported. | |
15 | ||
1a4d82fc | 16 | extern crate coherence_inherent_cc_lib; |
223e47cc LB |
17 | |
18 | mod Import { | |
19 | // Trait is in scope here: | |
20 | use coherence_inherent_cc_lib::TheStruct; | |
21 | use coherence_inherent_cc_lib::TheTrait; | |
22 | ||
23 | fn call_the_fn(s: &TheStruct) { | |
24 | s.the_fn(); | |
25 | } | |
26 | } | |
27 | ||
28 | mod NoImport { | |
29 | // Trait is not in scope here: | |
30 | use coherence_inherent_cc_lib::TheStruct; | |
31 | ||
32 | fn call_the_fn(s: &TheStruct) { | |
d9579d0f | 33 | s.the_fn(); //~ ERROR no method named `the_fn` found |
223e47cc LB |
34 | } |
35 | } | |
36 | ||
1a4d82fc | 37 | fn main() {} |