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