@@ -99,7 +99,22 @@ static STATIC10: UnsafeStruct = UnsafeStruct;
99
99
struct MyOwned ;
100
100
101
101
static STATIC11 : Box < MyOwned > = box MyOwned ;
102
- //~^ ERROR allocations are not allowed in statics
102
+ //~^ ERROR statics are not allowed to have destructors
103
+ //~| ERROR statics are not allowed to have destructors
104
+ //~| ERROR statics are not allowed to have destructors
105
+ //~| ERROR blocks in statics are limited to items and tail expressions
106
+ //~| ERROR blocks in statics are limited to items and tail expressions
107
+ //~| ERROR blocks in statics are limited to items and tail expressions
108
+ //~| ERROR blocks in statics are limited to items and tail expressions
109
+ //~| ERROR function calls in statics are limited to struct and enum constructors
110
+ //~| ERROR function calls in statics are limited to struct and enum constructors
111
+ //~| ERROR function calls in statics are limited to struct and enum constructors
112
+ //~| ERROR function calls in statics are limited to struct and enum constructors
113
+ //~| ERROR paths in statics may only refer to constants or functions
114
+ //~| ERROR paths in statics may only refer to constants or functions
115
+ //~| ERROR paths in statics may only refer to constants or functions
116
+ //~| ERROR paths in statics may only refer to constants or functions
117
+ //~| ERROR references in statics may only refer to immutable values
103
118
104
119
// The following examples test that mutable structs are just forbidden
105
120
// to have types with destructors
@@ -121,23 +136,117 @@ static mut STATIC14: SafeStruct = SafeStruct {
121
136
} ;
122
137
123
138
static STATIC15 : & ' static [ Box < MyOwned > ] = & [
124
- box MyOwned , //~ ERROR allocations are not allowed in statics
125
- box MyOwned , //~ ERROR allocations are not allowed in statics
139
+ box MyOwned ,
140
+ //~^ ERROR statics are not allowed to have destructors
141
+ //~| ERROR statics are not allowed to have destructors
142
+ //~| ERROR statics are not allowed to have destructors
143
+ //~| ERROR blocks in statics are limited to items and tail expressions
144
+ //~| ERROR blocks in statics are limited to items and tail expressions
145
+ //~| ERROR blocks in statics are limited to items and tail expressions
146
+ //~| ERROR blocks in statics are limited to items and tail expressions
147
+ //~| ERROR function calls in statics are limited to struct and enum constructors
148
+ //~| ERROR function calls in statics are limited to struct and enum constructors
149
+ //~| ERROR function calls in statics are limited to struct and enum constructors
150
+ //~| ERROR function calls in statics are limited to struct and enum constructors
151
+ //~| ERROR paths in statics may only refer to constants or functions
152
+ //~| ERROR paths in statics may only refer to constants or functions
153
+ //~| ERROR paths in statics may only refer to constants or functions
154
+ //~| ERROR paths in statics may only refer to constants or functions
155
+ //~| ERROR references in statics may only refer to immutable values
156
+ box MyOwned ,
157
+ //~^ ERROR statics are not allowed to have destructors
158
+ //~| ERROR statics are not allowed to have destructors
159
+ //~| ERROR statics are not allowed to have destructors
160
+ //~| ERROR blocks in statics are limited to items and tail expressions
161
+ //~| ERROR blocks in statics are limited to items and tail expressions
162
+ //~| ERROR blocks in statics are limited to items and tail expressions
163
+ //~| ERROR blocks in statics are limited to items and tail expressions
164
+ //~| ERROR function calls in statics are limited to struct and enum constructors
165
+ //~| ERROR function calls in statics are limited to struct and enum constructors
166
+ //~| ERROR function calls in statics are limited to struct and enum constructors
167
+ //~| ERROR function calls in statics are limited to struct and enum constructors
168
+ //~| ERROR paths in statics may only refer to constants or functions
169
+ //~| ERROR paths in statics may only refer to constants or functions
170
+ //~| ERROR paths in statics may only refer to constants or functions
171
+ //~| ERROR paths in statics may only refer to constants or functions
172
+ //~| ERROR references in statics may only refer to immutable values
126
173
] ;
127
174
128
175
static STATIC16 : ( & ' static Box < MyOwned > , & ' static Box < MyOwned > ) = (
129
- & box MyOwned , //~ ERROR allocations are not allowed in statics
130
- & box MyOwned , //~ ERROR allocations are not allowed in statics
176
+ & box MyOwned ,
177
+ //~^ ERROR statics are not allowed to have destructors
178
+ //~| ERROR statics are not allowed to have destructors
179
+ //~| ERROR statics are not allowed to have destructors
180
+ //~| ERROR blocks in statics are limited to items and tail expressions
181
+ //~| ERROR blocks in statics are limited to items and tail expressions
182
+ //~| ERROR blocks in statics are limited to items and tail expressions
183
+ //~| ERROR blocks in statics are limited to items and tail expressions
184
+ //~| ERROR function calls in statics are limited to struct and enum constructors
185
+ //~| ERROR function calls in statics are limited to struct and enum constructors
186
+ //~| ERROR function calls in statics are limited to struct and enum constructors
187
+ //~| ERROR function calls in statics are limited to struct and enum constructors
188
+ //~| ERROR paths in statics may only refer to constants or functions
189
+ //~| ERROR paths in statics may only refer to constants or functions
190
+ //~| ERROR paths in statics may only refer to constants or functions
191
+ //~| ERROR paths in statics may only refer to constants or functions
192
+ //~| ERROR references in statics may only refer to immutable values
193
+ & box MyOwned ,
194
+ //~^ ERROR statics are not allowed to have destructors
195
+ //~| ERROR statics are not allowed to have destructors
196
+ //~| ERROR statics are not allowed to have destructors
197
+ //~| ERROR blocks in statics are limited to items and tail expressions
198
+ //~| ERROR blocks in statics are limited to items and tail expressions
199
+ //~| ERROR blocks in statics are limited to items and tail expressions
200
+ //~| ERROR blocks in statics are limited to items and tail expressions
201
+ //~| ERROR function calls in statics are limited to struct and enum constructors
202
+ //~| ERROR function calls in statics are limited to struct and enum constructors
203
+ //~| ERROR function calls in statics are limited to struct and enum constructors
204
+ //~| ERROR function calls in statics are limited to struct and enum constructors
205
+ //~| ERROR paths in statics may only refer to constants or functions
206
+ //~| ERROR paths in statics may only refer to constants or functions
207
+ //~| ERROR paths in statics may only refer to constants or functions
208
+ //~| ERROR paths in statics may only refer to constants or functions
209
+ //~| ERROR references in statics may only refer to immutable values
131
210
) ;
132
211
133
212
static mut STATIC17 : SafeEnum = SafeEnum :: Variant1 ;
134
213
//~^ ERROR mutable statics are not allowed to have destructors
135
214
136
215
static STATIC19 : Box < isize > =
137
216
box 3 ;
138
- //~^ ERROR allocations are not allowed in statics
217
+ //~^ ERROR statics are not allowed to have destructors
218
+ //~| ERROR statics are not allowed to have destructors
219
+ //~| ERROR statics are not allowed to have destructors
220
+ //~| ERROR blocks in statics are limited to items and tail expressions
221
+ //~| ERROR blocks in statics are limited to items and tail expressions
222
+ //~| ERROR blocks in statics are limited to items and tail expressions
223
+ //~| ERROR blocks in statics are limited to items and tail expressions
224
+ //~| ERROR function calls in statics are limited to struct and enum constructors
225
+ //~| ERROR function calls in statics are limited to struct and enum constructors
226
+ //~| ERROR function calls in statics are limited to struct and enum constructors
227
+ //~| ERROR function calls in statics are limited to struct and enum constructors
228
+ //~| ERROR paths in statics may only refer to constants or functions
229
+ //~| ERROR paths in statics may only refer to constants or functions
230
+ //~| ERROR paths in statics may only refer to constants or functions
231
+ //~| ERROR paths in statics may only refer to constants or functions
232
+ //~| ERROR references in statics may only refer to immutable values
139
233
140
234
pub fn main ( ) {
141
235
let y = { static x: Box < isize > = box 3 ; x } ;
142
- //~^ ERROR allocations are not allowed in statics
236
+ //~^ ERROR statics are not allowed to have destructors
237
+ //~| ERROR statics are not allowed to have destructors
238
+ //~| ERROR statics are not allowed to have destructors
239
+ //~| ERROR blocks in statics are limited to items and tail expressions
240
+ //~| ERROR blocks in statics are limited to items and tail expressions
241
+ //~| ERROR blocks in statics are limited to items and tail expressions
242
+ //~| ERROR blocks in statics are limited to items and tail expressions
243
+ //~| ERROR function calls in statics are limited to struct and enum constructors
244
+ //~| ERROR function calls in statics are limited to struct and enum constructors
245
+ //~| ERROR function calls in statics are limited to struct and enum constructors
246
+ //~| ERROR function calls in statics are limited to struct and enum constructors
247
+ //~| ERROR paths in statics may only refer to constants or functions
248
+ //~| ERROR paths in statics may only refer to constants or functions
249
+ //~| ERROR paths in statics may only refer to constants or functions
250
+ //~| ERROR paths in statics may only refer to constants or functions
251
+ //~| ERROR references in statics may only refer to immutable values
143
252
}
0 commit comments