1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Ensure constant and array length values are not taken from source
12 // code, which wreaks havoc with macros.
19 // @has issue_33302/constant.CST.html \
20 // '//pre[@class="rust const"]' 'pub const CST: i32'
21 pub const CST: i32 = ($n * $n);
22 // @has issue_33302/static.ST.html \
23 // '//pre[@class="rust static"]' 'pub static ST: i32'
24 pub static ST: i32 = ($n * $n);
29 // @has issue_33302/trait.T.html \
30 // '//*[@class="rust trait"]' 'const D: i32'
31 // @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
32 const D: i32 = ($n * $n);
35 // @has issue_33302/struct.S.html \
36 // '//h3[@class="impl"]' 'impl T<[i32; 16]> for S'
37 // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]'
38 // @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
39 impl T<[i32; ($n * $n)]> for S {
40 const C: [i32; ($n * $n)] = [0; ($n * $n)];
43 // @has issue_33302/struct.S.html \
44 // '//h3[@class="impl"]' 'impl T<[i32; 16]> for S'
45 // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)'
46 // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32'
47 impl T<(i32,)> for S {
48 const C: (i32,) = ($n,);
51 // @has issue_33302/struct.S.html \
52 // '//h3[@class="impl"]' 'impl T<(i32, i32)> for S'
53 // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)'
54 // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32'
55 impl T<(i32, i32)> for S {
56 const C: (i32, i32) = ($n, $n);
57 const D: i32 = ($n / $n);