2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(unused_variables)]
|
2015-05-29 13:57:36 +00: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 18:26:54 +00:00
|
|
|
static FOO: usize = foo();
|
|
|
|
const BAR: usize = foo();
|
2015-05-29 13:57:36 +00:00
|
|
|
|
|
|
|
macro_rules! constant {
|
|
|
|
($n:ident: $t:ty = $v:expr) => {
|
|
|
|
const $n: $t = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
constant! {
|
2017-09-08 18:26:54 +00:00
|
|
|
BAZ: usize = foo()
|
2015-05-29 13:57:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2017-09-08 18:26:54 +00:00
|
|
|
let x: [usize; foo()] = [42; foo()];
|
2015-05-29 13:57:36 +00:00
|
|
|
}
|