]> git.lizzy.rs Git - rust.git/blob - src/test/pretty/issue-4264.pp
Rollup merge of #29060 - tshepang:consistency, r=nikomatsakis
[rust.git] / src / test / pretty / issue-4264.pp
1 #[prelude_import]
2 use std::prelude::v1::*;
3 #[macro_use]
4 extern crate std as std;
5 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
6 // file at the top-level directory of this distribution and at
7 // http://rust-lang.org/COPYRIGHT.
8 //
9 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
10 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
11 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
12 // option. This file may not be copied, modified, or distributed
13 // except according to those terms.
14
15 // pretty-compare-only
16 // pretty-mode:hir,typed
17 // pp-exact:issue-4264.pp
18
19 // #4264 fixed-length vector types
20
21 pub fn foo(_: [i32; (3 as usize)]) { }
22
23 pub fn bar() {
24     const FOO: usize = ((5 as usize) - (4 as usize) as usize);
25     let _: [(); (FOO as usize)] = ([(() as ())] as [(); 1]);
26
27     let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
28
29     let _ =
30         (((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as &[i32; 3])
31              as *const _ as *const [i32; 3]) as *const [i32; (3 as usize)] as
32             *const [i32; 3]);
33
34
35
36
37
38
39
40
41     ((::std::fmt::format as
42          fn(core::fmt::Arguments<'_>) -> collections::string::String {collections::fmt::format})(((::std::fmt::Arguments::new_v1
43                                                                                                       as
44                                                                                                       fn(&[&str], &[core::fmt::ArgumentV1<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new_v1})(({
45                                                                                                                                                                                                                      static __STATIC_FMTSTR:
46                                                                                                                                                                                                                             &'static [&'static str]
47                                                                                                                                                                                                                             =
48                                                                                                                                                                                                                          (&([("test"
49                                                                                                                                                                                                                                  as
50                                                                                                                                                                                                                                  &'static str)]
51                                                                                                                                                                                                                                as
52                                                                                                                                                                                                                                [&'static str; 1])
53                                                                                                                                                                                                                              as
54                                                                                                                                                                                                                              &'static [&'static str; 1]);
55                                                                                                                                                                                                                      (__STATIC_FMTSTR
56                                                                                                                                                                                                                          as
57                                                                                                                                                                                                                          &'static [&'static str])
58                                                                                                                                                                                                                  }
59                                                                                                                                                                                                                     as
60                                                                                                                                                                                                                     &[&str]),
61                                                                                                                                                                                                                 (&(match (()
62                                                                                                                                                                                                                              as
63                                                                                                                                                                                                                              ())
64                                                                                                                                                                                                                        {
65                                                                                                                                                                                                                        ()
66                                                                                                                                                                                                                        =>
67                                                                                                                                                                                                                        ([]
68                                                                                                                                                                                                                            as
69                                                                                                                                                                                                                            [core::fmt::ArgumentV1<'_>; 0]),
70                                                                                                                                                                                                                    }
71                                                                                                                                                                                                                       as
72                                                                                                                                                                                                                       [core::fmt::ArgumentV1<'_>; 0])
73                                                                                                                                                                                                                     as
74                                                                                                                                                                                                                     &[core::fmt::ArgumentV1<'_>; 0]))
75                                                                                                      as
76                                                                                                      core::fmt::Arguments<'_>))
77         as collections::string::String);
78 }
79 pub type Foo = [i32; (3 as usize)];
80 pub struct Bar {
81     pub x: [i32; (3 as usize)],
82 }
83 pub struct TupleBar([i32; (4 as usize)]);
84 pub enum Baz { BazVariant([i32; (5 as usize)]), }
85 pub fn id<T>(x: T) -> T { (x as T) }
86 pub fn use_id() {
87     let _ =
88         ((id::<[i32; (3 as usize)]> as
89              fn([i32; 3]) -> [i32; 3] {id})(([(1 as i32), (2 as i32),
90                                               (3 as i32)] as [i32; 3])) as
91             [i32; 3]);
92 }
93 fn main() { }