]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-block-item.rs
suggest fix for attempted integer identifier in patterns
[rust.git] / tests / ui / consts / const-block-item.rs
1 // run-pass
2 #![allow(unused_imports)]
3
4 mod foo {
5     pub trait Value {
6         fn value(&self) -> usize;
7     }
8 }
9
10 static BLOCK_USE: usize = {
11     use foo::Value;
12     100
13 };
14
15 static BLOCK_STRUCT_DEF: usize = {
16     struct Foo {
17         a: usize
18     }
19     Foo{ a: 300 }.a
20 };
21
22 static BLOCK_FN_DEF: fn(usize) -> usize = {
23     fn foo(a: usize) -> usize {
24         a + 10
25     }
26     foo
27 };
28
29 static BLOCK_MACRO_RULES: usize = {
30     macro_rules! baz {
31         () => (412)
32     }
33     baz!()
34 };
35
36 pub fn main() {
37     assert_eq!(BLOCK_USE, 100);
38     assert_eq!(BLOCK_STRUCT_DEF, 300);
39     assert_eq!(BLOCK_FN_DEF(390), 400);
40     assert_eq!(BLOCK_MACRO_RULES, 412);
41 }