2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_imports)]
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2014-05-04 08:39:11 +00:00
|
|
|
mod foo {
|
2024-02-07 02:42:01 +00:00
|
|
|
pub trait Value { //~ WARN trait `Value` is never used
|
2015-03-26 00:06:52 +00:00
|
|
|
fn value(&self) -> usize;
|
2014-05-04 08:39:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
static BLOCK_USE: usize = {
|
2014-05-04 08:39:11 +00:00
|
|
|
use foo::Value;
|
|
|
|
100
|
|
|
|
};
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
static BLOCK_STRUCT_DEF: usize = {
|
2014-05-04 08:39:11 +00:00
|
|
|
struct Foo {
|
2015-03-26 00:06:52 +00:00
|
|
|
a: usize
|
2014-05-04 08:39:11 +00:00
|
|
|
}
|
|
|
|
Foo{ a: 300 }.a
|
|
|
|
};
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
static BLOCK_FN_DEF: fn(usize) -> usize = {
|
|
|
|
fn foo(a: usize) -> usize {
|
2014-05-04 08:39:11 +00:00
|
|
|
a + 10
|
|
|
|
}
|
|
|
|
foo
|
|
|
|
};
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
static BLOCK_MACRO_RULES: usize = {
|
2014-05-04 08:39:11 +00:00
|
|
|
macro_rules! baz {
|
|
|
|
() => (412)
|
|
|
|
}
|
|
|
|
baz!()
|
|
|
|
};
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
assert_eq!(BLOCK_USE, 100);
|
|
|
|
assert_eq!(BLOCK_STRUCT_DEF, 300);
|
|
|
|
assert_eq!(BLOCK_FN_DEF(390), 400);
|
|
|
|
assert_eq!(BLOCK_MACRO_RULES, 412);
|
|
|
|
}
|