]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/issue32829.rs
New upstream version 1.27.1+dfsg1
[rustc.git] / src / test / compile-fail / issue32829.rs
CommitLineData
a7813a04
XL
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.
4//
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.
83c7162d
XL
10
11// ignore-tidy-linelength
12
a7813a04
XL
13#![feature(const_fn)]
14
15const bad : u32 = {
16 {
17 5; //~ ERROR: blocks in constants are limited to items and tail expressions
18 0
19 }
20};
21
22const bad_two : u32 = {
23 {
24 invalid();
25 //~^ ERROR: blocks in constants are limited to items and tail expressions
83c7162d 26 //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants
a7813a04
XL
27 0
28 }
29};
30
31const bad_three : u32 = {
32 {
33 valid();
34 //~^ ERROR: blocks in constants are limited to items and tail expressions
35 0
36 }
37};
38
39static bad_four : u32 = {
40 {
41 5; //~ ERROR: blocks in statics are limited to items and tail expressions
42 0
43 }
44};
45
46static bad_five : u32 = {
47 {
48 invalid();
49 //~^ ERROR: blocks in statics are limited to items and tail expressions
83c7162d 50 //~^^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
a7813a04
XL
51 0
52 }
53};
54
55static bad_six : u32 = {
56 {
57 valid();
58 //~^ ERROR: blocks in statics are limited to items and tail expressions
59 0
60 }
61};
62
63static mut bad_seven : u32 = {
64 {
65 5; //~ ERROR: blocks in statics are limited to items and tail expressions
66 0
67 }
68};
69
70static mut bad_eight : u32 = {
71 {
72 invalid();
73 //~^ ERROR: blocks in statics are limited to items and tail expressions
83c7162d 74 //~^^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants
a7813a04
XL
75 0
76 }
77};
78
79static mut bad_nine : u32 = {
80 {
81 valid();
82 //~^ ERROR: blocks in statics are limited to items and tail expressions
83 0
84 }
85};
86
87
88fn invalid() {}
89const fn valid() {}
90
91fn main() {}