2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2014-08-01 15:45:24 -07:00
|
|
|
// compile-flags: -C codegen-units=3
|
|
|
|
|
2018-05-08 16:10:16 +03:00
|
|
|
// Test references to items that haven't been codegened yet.
|
2014-08-01 15:45:24 -07:00
|
|
|
|
|
|
|
// Generate some code in the first compilation unit before declaring any
|
|
|
|
// modules. This ensures that the first module doesn't go into the same
|
|
|
|
// compilation unit as the top-level module.
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn pad() -> usize { 0 }
|
2014-08-01 15:45:24 -07:00
|
|
|
|
|
|
|
mod b {
|
2015-03-25 17:06:52 -07:00
|
|
|
pub fn three() -> usize {
|
2014-08-01 15:45:24 -07:00
|
|
|
::one() + ::a::two()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod a {
|
2015-03-25 17:06:52 -07:00
|
|
|
pub fn two() -> usize {
|
2014-08-01 15:45:24 -07:00
|
|
|
::one() + ::one()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn one() -> usize {
|
2014-08-01 15:45:24 -07:00
|
|
|
1
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(one(), 1);
|
|
|
|
assert_eq!(a::two(), 2);
|
|
|
|
assert_eq!(b::three(), 3);
|
|
|
|
}
|