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 = 4 * 4'
21 pub const CST: i32 = ($n * $n);
22 // @has issue_33302/static.ST.html \
23 // '//pre[@class="rust static"]' 'pub static ST: i32 = 4 * 4'
24 pub static ST: i32 = ($n * $n);
29 // @has issue_33302/trait.T.html \
30 // '//*[@class="rust trait"]' 'const D: i32'
31 // @has - '//*[@class="docblock"]' 'D: i32 = 4 * 4'
32 // @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
33 const D: i32 = ($n * $n);
36 // @has issue_33302/struct.S.html \
37 // '//h3[@class="impl"]' 'impl T<[i32; 16]> for S'
38 // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]'
39 // @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
40 // @has - '//*[@class="docblock"]' 'C: [i32; 16] = [0; 4 * 4]'
41 impl T<[i32; ($n * $n)]> for S {
42 const C: [i32; ($n * $n)] = [0; ($n * $n)];
45 // @has issue_33302/struct.S.html \
46 // '//h3[@class="impl"]' 'impl T<[i32; 16]> for S'
47 // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)'
48 // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32'
49 // @has - '//*[@class="docblock"]' 'C: (i32,) = (4,)'
50 impl T<(i32,)> for S {
51 const C: (i32,) = ($n,);
54 // @has issue_33302/struct.S.html \
55 // '//h3[@class="impl"]' 'impl T<(i32, i32)> for S'
56 // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)'
57 // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32'
58 // @has - '//*[@class="docblock"]' 'C: (i32, i32) = (4, 4)'
59 // @has - '//*[@class="docblock"]' 'D: i32 = 4 / 4'
60 impl T<(i32, i32)> for S {
61 const C: (i32, i32) = ($n, $n);
62 const D: i32 = ($n / $n);