]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-52557.rs
Auto merge of #52712 - oli-obk:const_eval_cleanups, r=RalfJung
[rust.git] / src / test / run-pass / issue-52557.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
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
11 // This test checks for namespace pollution by private tests.
12 // Tests used to marked as public causing name conflicts with normal
13 // functions only in test builds.
14
15 // compile-flags: --test
16
17 mod a {
18     pub fn foo() -> bool {
19         true
20     }
21 }
22
23 mod b {
24     #[test]
25     fn foo() {
26         local_name(); // ensure the local name still works
27     }
28
29     #[test]
30     fn local_name() {}
31 }
32
33 use a::*;
34 use b::*;
35
36 pub fn conflict() {
37     let _: bool = foo();
38 }