]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/coherence_inherent_cc.rs
Imported Upstream version 1.1.0+dfsg1
[rustc.git] / src / test / compile-fail / coherence_inherent_cc.rs
CommitLineData
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 16extern crate coherence_inherent_cc_lib;
223e47cc
LB
17
18mod 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
28mod 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 37fn main() {}