2018-08-30 07:18:55 -05:00
|
|
|
//@ run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(unused_variables)]
|
2015-05-29 08:57:36 -05:00
|
|
|
// Test use of const fn from another crate without a feature gate.
|
|
|
|
|
|
|
|
//@ aux-build:const_fn_lib.rs
|
|
|
|
|
|
|
|
extern crate const_fn_lib;
|
|
|
|
|
|
|
|
use const_fn_lib::foo;
|
|
|
|
|
2017-09-08 13:26:54 -05:00
|
|
|
static FOO: usize = foo();
|
|
|
|
const BAR: usize = foo();
|
2015-05-29 08:57:36 -05:00
|
|
|
|
|
|
|
macro_rules! constant {
|
|
|
|
($n:ident: $t:ty = $v:expr) => {
|
|
|
|
const $n: $t = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
constant! {
|
2017-09-08 13:26:54 -05:00
|
|
|
BAZ: usize = foo()
|
2015-05-29 08:57:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2017-09-08 13:26:54 -05:00
|
|
|
let x: [usize; foo()] = [42; foo()];
|
2015-05-29 08:57:36 -05:00
|
|
|
}
|