@@ -52,19 +52,17 @@ impl Origin {
52
52
}
53
53
}
54
54
55
- pub trait BorrowckErrors < ' cx > {
55
+ pub trait BorrowckErrors < ' cx > : Sized + Copy {
56
56
fn struct_span_err_with_code < S : Into < MultiSpan > > ( self ,
57
57
sp : S ,
58
58
msg : & str ,
59
59
code : DiagnosticId )
60
- -> DiagnosticBuilder < ' cx >
61
- where Self : Sized + Copy ;
60
+ -> DiagnosticBuilder < ' cx > ;
62
61
63
62
fn struct_span_err < S : Into < MultiSpan > > ( self ,
64
63
sp : S ,
65
64
msg : & str )
66
- -> DiagnosticBuilder < ' cx >
67
- where Self : Sized + Copy ;
65
+ -> DiagnosticBuilder < ' cx > ;
68
66
69
67
/// Cancels the given error if we shouldn't emit errors for a given
70
68
/// origin in the current mode.
@@ -74,12 +72,10 @@ pub trait BorrowckErrors<'cx> {
74
72
fn cancel_if_wrong_origin ( self ,
75
73
diag : DiagnosticBuilder < ' cx > ,
76
74
o : Origin )
77
- -> DiagnosticBuilder < ' cx >
78
- where Self : Sized + Copy ;
75
+ -> DiagnosticBuilder < ' cx > ;
79
76
80
77
fn cannot_move_when_borrowed ( self , span : Span , desc : & str , o : Origin )
81
78
-> DiagnosticBuilder < ' cx >
82
- where Self : Sized + Copy
83
79
{
84
80
let err = struct_span_err ! ( self , span, E0505 ,
85
81
"cannot move out of `{}` because it is borrowed{OGN}" ,
@@ -94,7 +90,6 @@ pub trait BorrowckErrors<'cx> {
94
90
borrow_desc : & str ,
95
91
o : Origin )
96
92
-> DiagnosticBuilder < ' cx >
97
- where Self : Sized + Copy
98
93
{
99
94
let mut err = struct_span_err ! ( self , span, E0503 ,
100
95
"cannot use `{}` because it was mutably borrowed{OGN}" ,
@@ -112,7 +107,6 @@ pub trait BorrowckErrors<'cx> {
112
107
desc : & str ,
113
108
o : Origin )
114
109
-> DiagnosticBuilder < ' cx >
115
- where Self : Sized + Copy
116
110
{
117
111
let err = struct_span_err ! ( self , span, E0381 ,
118
112
"{} of possibly uninitialized variable: `{}`{OGN}" ,
@@ -129,7 +123,6 @@ pub trait BorrowckErrors<'cx> {
129
123
old_load_end_span : Option < Span > ,
130
124
o : Origin )
131
125
-> DiagnosticBuilder < ' cx >
132
- where Self : Sized + Copy
133
126
{
134
127
let mut err = struct_span_err ! ( self , new_loan_span, E0499 ,
135
128
"cannot borrow `{}`{} as mutable more than once at a time{OGN}" ,
@@ -162,7 +155,6 @@ pub trait BorrowckErrors<'cx> {
162
155
old_load_end_span : Option < Span > ,
163
156
o : Origin )
164
157
-> DiagnosticBuilder < ' cx >
165
- where Self : Sized + Copy
166
158
{
167
159
let mut err = struct_span_err ! ( self , new_loan_span, E0524 ,
168
160
"two closures require unique access to `{}` at the same time{OGN}" ,
@@ -191,7 +183,6 @@ pub trait BorrowckErrors<'cx> {
191
183
previous_end_span : Option < Span > ,
192
184
o : Origin )
193
185
-> DiagnosticBuilder < ' cx >
194
- where Self : Sized + Copy
195
186
{
196
187
let mut err = struct_span_err ! ( self , new_loan_span, E0500 ,
197
188
"closure requires unique access to `{}` but {} is already borrowed{}{OGN}" ,
@@ -216,7 +207,6 @@ pub trait BorrowckErrors<'cx> {
216
207
previous_end_span : Option < Span > ,
217
208
o : Origin )
218
209
-> DiagnosticBuilder < ' cx >
219
- where Self : Sized + Copy
220
210
{
221
211
let mut err = struct_span_err ! ( self , new_loan_span, E0501 ,
222
212
"cannot borrow `{}`{} as {} because previous closure \
@@ -244,7 +234,6 @@ pub trait BorrowckErrors<'cx> {
244
234
old_load_end_span : Option < Span > ,
245
235
o : Origin )
246
236
-> DiagnosticBuilder < ' cx >
247
- where Self : Sized + Copy
248
237
{
249
238
let mut err = struct_span_err ! ( self , span, E0502 ,
250
239
"cannot borrow `{}`{} as {} because {} is also borrowed as {}{}{OGN}" ,
@@ -259,7 +248,6 @@ pub trait BorrowckErrors<'cx> {
259
248
260
249
fn cannot_assign_to_borrowed ( self , span : Span , borrow_span : Span , desc : & str , o : Origin )
261
250
-> DiagnosticBuilder < ' cx >
262
- where Self : Sized + Copy
263
251
{
264
252
let mut err = struct_span_err ! ( self , span, E0506 ,
265
253
"cannot assign to `{}` because it is borrowed{OGN}" ,
@@ -273,7 +261,6 @@ pub trait BorrowckErrors<'cx> {
273
261
274
262
fn cannot_move_into_closure ( self , span : Span , desc : & str , o : Origin )
275
263
-> DiagnosticBuilder < ' cx >
276
- where Self : Sized + Copy
277
264
{
278
265
let err = struct_span_err ! ( self , span, E0504 ,
279
266
"cannot move `{}` into closure because it is borrowed{OGN}" ,
@@ -284,7 +271,6 @@ pub trait BorrowckErrors<'cx> {
284
271
285
272
fn cannot_reassign_immutable ( self , span : Span , desc : & str , is_arg : bool , o : Origin )
286
273
-> DiagnosticBuilder < ' cx >
287
- where Self : Sized + Copy
288
274
{
289
275
let msg = if is_arg {
290
276
"to immutable argument"
@@ -299,7 +285,6 @@ pub trait BorrowckErrors<'cx> {
299
285
}
300
286
301
287
fn cannot_assign ( self , span : Span , desc : & str , o : Origin ) -> DiagnosticBuilder < ' cx >
302
- where Self : Sized + Copy
303
288
{
304
289
let err = struct_span_err ! ( self , span, E0594 ,
305
290
"cannot assign to {}{OGN}" ,
@@ -309,14 +294,12 @@ pub trait BorrowckErrors<'cx> {
309
294
310
295
fn cannot_assign_static ( self , span : Span , desc : & str , o : Origin )
311
296
-> DiagnosticBuilder < ' cx >
312
- where Self : Sized + Copy
313
297
{
314
298
self . cannot_assign ( span, & format ! ( "immutable static item `{}`" , desc) , o)
315
299
}
316
300
317
301
fn cannot_move_out_of ( self , move_from_span : Span , move_from_desc : & str , o : Origin )
318
302
-> DiagnosticBuilder < ' cx >
319
- where Self : Sized + Copy
320
303
{
321
304
let mut err = struct_span_err ! ( self , move_from_span, E0507 ,
322
305
"cannot move out of {}{OGN}" ,
@@ -334,7 +317,6 @@ pub trait BorrowckErrors<'cx> {
334
317
is_index : bool ,
335
318
o : Origin )
336
319
-> DiagnosticBuilder < ' cx >
337
- where Self : Sized + Copy
338
320
{
339
321
let type_name = match ( & ty. sty , is_index) {
340
322
( & ty:: TyArray ( _, _) , true ) => "array" ,
@@ -355,7 +337,6 @@ pub trait BorrowckErrors<'cx> {
355
337
container_ty : ty:: Ty ,
356
338
o : Origin )
357
339
-> DiagnosticBuilder < ' cx >
358
- where Self : Sized + Copy
359
340
{
360
341
let mut err = struct_span_err ! ( self , move_from_span, E0509 ,
361
342
"cannot move out of type `{}`, \
@@ -373,7 +354,6 @@ pub trait BorrowckErrors<'cx> {
373
354
moved_path : & str ,
374
355
o : Origin )
375
356
-> DiagnosticBuilder < ' cx >
376
- where Self : Sized + Copy
377
357
{
378
358
let err = struct_span_err ! ( self , use_span, E0382 ,
379
359
"{} of {}moved value: `{}`{OGN}" ,
@@ -387,7 +367,6 @@ pub trait BorrowckErrors<'cx> {
387
367
uninit_path : & str ,
388
368
o : Origin )
389
369
-> DiagnosticBuilder < ' cx >
390
- where Self : Sized + Copy
391
370
{
392
371
let err = struct_span_err ! ( self ,
393
372
span,
@@ -403,7 +382,6 @@ pub trait BorrowckErrors<'cx> {
403
382
descr : & str ,
404
383
o : Origin )
405
384
-> DiagnosticBuilder < ' cx >
406
- where Self : Sized + Copy
407
385
{
408
386
let err = struct_span_err ! ( self , span, E0595 , "closure cannot assign to {}{OGN}" ,
409
387
descr, OGN =o) ;
@@ -416,7 +394,6 @@ pub trait BorrowckErrors<'cx> {
416
394
path : & str ,
417
395
o : Origin )
418
396
-> DiagnosticBuilder < ' cx >
419
- where Self : Sized + Copy
420
397
{
421
398
let err = struct_span_err ! ( self , span, E0596 , "cannot borrow {} as mutable{OGN}" ,
422
399
path, OGN =o) ;
@@ -429,7 +406,6 @@ pub trait BorrowckErrors<'cx> {
429
406
yield_span : Span ,
430
407
o : Origin )
431
408
-> DiagnosticBuilder < ' cx >
432
- where Self : Sized + Copy
433
409
{
434
410
let mut err = struct_span_err ! ( self ,
435
411
span,
@@ -446,7 +422,6 @@ pub trait BorrowckErrors<'cx> {
446
422
path : & str ,
447
423
o : Origin )
448
424
-> DiagnosticBuilder < ' cx >
449
- where Self : Sized + Copy
450
425
{
451
426
let err = struct_span_err ! ( self , span, E0597 , "{} does not live long enough{OGN}" ,
452
427
path, OGN =o) ;
@@ -459,7 +434,6 @@ pub trait BorrowckErrors<'cx> {
459
434
path : & str ,
460
435
o : Origin )
461
436
-> DiagnosticBuilder < ' cx >
462
- where Self : Sized + Copy
463
437
{
464
438
let err = struct_span_err ! ( self , span, E0598 ,
465
439
"lifetime of {} is too short to guarantee \
@@ -475,7 +449,6 @@ pub trait BorrowckErrors<'cx> {
475
449
help : ( Span , & str ) ,
476
450
o : Origin )
477
451
-> DiagnosticBuilder < ' cx >
478
- where Self : Sized + Copy
479
452
{
480
453
let ( help_span, help_msg) = help;
481
454
let mut err = struct_span_err ! ( self , span, E0387 ,
@@ -491,7 +464,6 @@ pub trait BorrowckErrors<'cx> {
491
464
bad_thing : & str ,
492
465
o : Origin )
493
466
-> DiagnosticBuilder < ' cx >
494
- where Self : Sized + Copy
495
467
{
496
468
let mut err = struct_span_err ! ( self , span, E0389 , "{} in a `&` reference{OGN}" ,
497
469
bad_thing, OGN =o) ;
@@ -506,7 +478,6 @@ pub trait BorrowckErrors<'cx> {
506
478
capture_span : Span ,
507
479
o : Origin )
508
480
-> DiagnosticBuilder < ' cx >
509
- where Self : Sized + Copy
510
481
{
511
482
let mut err = struct_span_err ! ( self , closure_span, E0373 ,
512
483
"closure may outlive the current function, \
@@ -526,7 +497,6 @@ impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
526
497
msg : & str ,
527
498
code : DiagnosticId )
528
499
-> DiagnosticBuilder < ' cx >
529
- where Self : Sized + Copy
530
500
{
531
501
self . sess . struct_span_err_with_code ( sp, msg, code)
532
502
}
@@ -535,7 +505,6 @@ impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
535
505
sp : S ,
536
506
msg : & str )
537
507
-> DiagnosticBuilder < ' cx >
538
- where Self : Sized + Copy
539
508
{
540
509
self . sess . struct_span_err ( sp, msg)
541
510
}
@@ -544,7 +513,6 @@ impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
544
513
mut diag : DiagnosticBuilder < ' cx > ,
545
514
o : Origin )
546
515
-> DiagnosticBuilder < ' cx >
547
- where Self : Sized + Copy
548
516
{
549
517
if !o. should_emit_errors ( self . borrowck_mode ( ) ) {
550
518
self . sess . diagnostic ( ) . cancel ( & mut diag) ;
0 commit comments