Skip to content

Commit 5511624

Browse files
committed
remove unneeded where clause
1 parent c62d9eb commit 5511624

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

src/librustc_mir/util/borrowck_errors.rs

+4-36
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,17 @@ impl Origin {
5252
}
5353
}
5454

55-
pub trait BorrowckErrors<'cx> {
55+
pub trait BorrowckErrors<'cx>: Sized + Copy {
5656
fn struct_span_err_with_code<S: Into<MultiSpan>>(self,
5757
sp: S,
5858
msg: &str,
5959
code: DiagnosticId)
60-
-> DiagnosticBuilder<'cx>
61-
where Self: Sized + Copy;
60+
-> DiagnosticBuilder<'cx>;
6261

6362
fn struct_span_err<S: Into<MultiSpan>>(self,
6463
sp: S,
6564
msg: &str)
66-
-> DiagnosticBuilder<'cx>
67-
where Self: Sized + Copy;
65+
-> DiagnosticBuilder<'cx>;
6866

6967
/// Cancels the given error if we shouldn't emit errors for a given
7068
/// origin in the current mode.
@@ -74,12 +72,10 @@ pub trait BorrowckErrors<'cx> {
7472
fn cancel_if_wrong_origin(self,
7573
diag: DiagnosticBuilder<'cx>,
7674
o: Origin)
77-
-> DiagnosticBuilder<'cx>
78-
where Self: Sized + Copy;
75+
-> DiagnosticBuilder<'cx>;
7976

8077
fn cannot_move_when_borrowed(self, span: Span, desc: &str, o: Origin)
8178
-> DiagnosticBuilder<'cx>
82-
where Self: Sized + Copy
8379
{
8480
let err = struct_span_err!(self, span, E0505,
8581
"cannot move out of `{}` because it is borrowed{OGN}",
@@ -94,7 +90,6 @@ pub trait BorrowckErrors<'cx> {
9490
borrow_desc: &str,
9591
o: Origin)
9692
-> DiagnosticBuilder<'cx>
97-
where Self: Sized + Copy
9893
{
9994
let mut err = struct_span_err!(self, span, E0503,
10095
"cannot use `{}` because it was mutably borrowed{OGN}",
@@ -112,7 +107,6 @@ pub trait BorrowckErrors<'cx> {
112107
desc: &str,
113108
o: Origin)
114109
-> DiagnosticBuilder<'cx>
115-
where Self: Sized + Copy
116110
{
117111
let err = struct_span_err!(self, span, E0381,
118112
"{} of possibly uninitialized variable: `{}`{OGN}",
@@ -129,7 +123,6 @@ pub trait BorrowckErrors<'cx> {
129123
old_load_end_span: Option<Span>,
130124
o: Origin)
131125
-> DiagnosticBuilder<'cx>
132-
where Self: Sized + Copy
133126
{
134127
let mut err = struct_span_err!(self, new_loan_span, E0499,
135128
"cannot borrow `{}`{} as mutable more than once at a time{OGN}",
@@ -162,7 +155,6 @@ pub trait BorrowckErrors<'cx> {
162155
old_load_end_span: Option<Span>,
163156
o: Origin)
164157
-> DiagnosticBuilder<'cx>
165-
where Self: Sized + Copy
166158
{
167159
let mut err = struct_span_err!(self, new_loan_span, E0524,
168160
"two closures require unique access to `{}` at the same time{OGN}",
@@ -191,7 +183,6 @@ pub trait BorrowckErrors<'cx> {
191183
previous_end_span: Option<Span>,
192184
o: Origin)
193185
-> DiagnosticBuilder<'cx>
194-
where Self: Sized + Copy
195186
{
196187
let mut err = struct_span_err!(self, new_loan_span, E0500,
197188
"closure requires unique access to `{}` but {} is already borrowed{}{OGN}",
@@ -216,7 +207,6 @@ pub trait BorrowckErrors<'cx> {
216207
previous_end_span: Option<Span>,
217208
o: Origin)
218209
-> DiagnosticBuilder<'cx>
219-
where Self: Sized + Copy
220210
{
221211
let mut err = struct_span_err!(self, new_loan_span, E0501,
222212
"cannot borrow `{}`{} as {} because previous closure \
@@ -244,7 +234,6 @@ pub trait BorrowckErrors<'cx> {
244234
old_load_end_span: Option<Span>,
245235
o: Origin)
246236
-> DiagnosticBuilder<'cx>
247-
where Self: Sized + Copy
248237
{
249238
let mut err = struct_span_err!(self, span, E0502,
250239
"cannot borrow `{}`{} as {} because {} is also borrowed as {}{}{OGN}",
@@ -259,7 +248,6 @@ pub trait BorrowckErrors<'cx> {
259248

260249
fn cannot_assign_to_borrowed(self, span: Span, borrow_span: Span, desc: &str, o: Origin)
261250
-> DiagnosticBuilder<'cx>
262-
where Self: Sized + Copy
263251
{
264252
let mut err = struct_span_err!(self, span, E0506,
265253
"cannot assign to `{}` because it is borrowed{OGN}",
@@ -273,7 +261,6 @@ pub trait BorrowckErrors<'cx> {
273261

274262
fn cannot_move_into_closure(self, span: Span, desc: &str, o: Origin)
275263
-> DiagnosticBuilder<'cx>
276-
where Self: Sized + Copy
277264
{
278265
let err = struct_span_err!(self, span, E0504,
279266
"cannot move `{}` into closure because it is borrowed{OGN}",
@@ -284,7 +271,6 @@ pub trait BorrowckErrors<'cx> {
284271

285272
fn cannot_reassign_immutable(self, span: Span, desc: &str, is_arg: bool, o: Origin)
286273
-> DiagnosticBuilder<'cx>
287-
where Self: Sized + Copy
288274
{
289275
let msg = if is_arg {
290276
"to immutable argument"
@@ -299,7 +285,6 @@ pub trait BorrowckErrors<'cx> {
299285
}
300286

301287
fn cannot_assign(self, span: Span, desc: &str, o: Origin) -> DiagnosticBuilder<'cx>
302-
where Self: Sized + Copy
303288
{
304289
let err = struct_span_err!(self, span, E0594,
305290
"cannot assign to {}{OGN}",
@@ -309,14 +294,12 @@ pub trait BorrowckErrors<'cx> {
309294

310295
fn cannot_assign_static(self, span: Span, desc: &str, o: Origin)
311296
-> DiagnosticBuilder<'cx>
312-
where Self: Sized + Copy
313297
{
314298
self.cannot_assign(span, &format!("immutable static item `{}`", desc), o)
315299
}
316300

317301
fn cannot_move_out_of(self, move_from_span: Span, move_from_desc: &str, o: Origin)
318302
-> DiagnosticBuilder<'cx>
319-
where Self: Sized + Copy
320303
{
321304
let mut err = struct_span_err!(self, move_from_span, E0507,
322305
"cannot move out of {}{OGN}",
@@ -334,7 +317,6 @@ pub trait BorrowckErrors<'cx> {
334317
is_index: bool,
335318
o: Origin)
336319
-> DiagnosticBuilder<'cx>
337-
where Self: Sized + Copy
338320
{
339321
let type_name = match (&ty.sty, is_index) {
340322
(&ty::TyArray(_, _), true) => "array",
@@ -355,7 +337,6 @@ pub trait BorrowckErrors<'cx> {
355337
container_ty: ty::Ty,
356338
o: Origin)
357339
-> DiagnosticBuilder<'cx>
358-
where Self: Sized + Copy
359340
{
360341
let mut err = struct_span_err!(self, move_from_span, E0509,
361342
"cannot move out of type `{}`, \
@@ -373,7 +354,6 @@ pub trait BorrowckErrors<'cx> {
373354
moved_path: &str,
374355
o: Origin)
375356
-> DiagnosticBuilder<'cx>
376-
where Self: Sized + Copy
377357
{
378358
let err = struct_span_err!(self, use_span, E0382,
379359
"{} of {}moved value: `{}`{OGN}",
@@ -387,7 +367,6 @@ pub trait BorrowckErrors<'cx> {
387367
uninit_path: &str,
388368
o: Origin)
389369
-> DiagnosticBuilder<'cx>
390-
where Self: Sized + Copy
391370
{
392371
let err = struct_span_err!(self,
393372
span,
@@ -403,7 +382,6 @@ pub trait BorrowckErrors<'cx> {
403382
descr: &str,
404383
o: Origin)
405384
-> DiagnosticBuilder<'cx>
406-
where Self: Sized + Copy
407385
{
408386
let err = struct_span_err!(self, span, E0595, "closure cannot assign to {}{OGN}",
409387
descr, OGN=o);
@@ -416,7 +394,6 @@ pub trait BorrowckErrors<'cx> {
416394
path: &str,
417395
o: Origin)
418396
-> DiagnosticBuilder<'cx>
419-
where Self: Sized + Copy
420397
{
421398
let err = struct_span_err!(self, span, E0596, "cannot borrow {} as mutable{OGN}",
422399
path, OGN=o);
@@ -429,7 +406,6 @@ pub trait BorrowckErrors<'cx> {
429406
yield_span: Span,
430407
o: Origin)
431408
-> DiagnosticBuilder<'cx>
432-
where Self: Sized + Copy
433409
{
434410
let mut err = struct_span_err!(self,
435411
span,
@@ -446,7 +422,6 @@ pub trait BorrowckErrors<'cx> {
446422
path: &str,
447423
o: Origin)
448424
-> DiagnosticBuilder<'cx>
449-
where Self: Sized + Copy
450425
{
451426
let err = struct_span_err!(self, span, E0597, "{} does not live long enough{OGN}",
452427
path, OGN=o);
@@ -459,7 +434,6 @@ pub trait BorrowckErrors<'cx> {
459434
path: &str,
460435
o: Origin)
461436
-> DiagnosticBuilder<'cx>
462-
where Self: Sized + Copy
463437
{
464438
let err = struct_span_err!(self, span, E0598,
465439
"lifetime of {} is too short to guarantee \
@@ -475,7 +449,6 @@ pub trait BorrowckErrors<'cx> {
475449
help: (Span, &str),
476450
o: Origin)
477451
-> DiagnosticBuilder<'cx>
478-
where Self: Sized + Copy
479452
{
480453
let (help_span, help_msg) = help;
481454
let mut err = struct_span_err!(self, span, E0387,
@@ -491,7 +464,6 @@ pub trait BorrowckErrors<'cx> {
491464
bad_thing: &str,
492465
o: Origin)
493466
-> DiagnosticBuilder<'cx>
494-
where Self: Sized + Copy
495467
{
496468
let mut err = struct_span_err!(self, span, E0389, "{} in a `&` reference{OGN}",
497469
bad_thing, OGN=o);
@@ -506,7 +478,6 @@ pub trait BorrowckErrors<'cx> {
506478
capture_span: Span,
507479
o: Origin)
508480
-> DiagnosticBuilder<'cx>
509-
where Self: Sized + Copy
510481
{
511482
let mut err = struct_span_err!(self, closure_span, E0373,
512483
"closure may outlive the current function, \
@@ -526,7 +497,6 @@ impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
526497
msg: &str,
527498
code: DiagnosticId)
528499
-> DiagnosticBuilder<'cx>
529-
where Self: Sized + Copy
530500
{
531501
self.sess.struct_span_err_with_code(sp, msg, code)
532502
}
@@ -535,7 +505,6 @@ impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
535505
sp: S,
536506
msg: &str)
537507
-> DiagnosticBuilder<'cx>
538-
where Self: Sized + Copy
539508
{
540509
self.sess.struct_span_err(sp, msg)
541510
}
@@ -544,7 +513,6 @@ impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
544513
mut diag: DiagnosticBuilder<'cx>,
545514
o: Origin)
546515
-> DiagnosticBuilder<'cx>
547-
where Self: Sized + Copy
548516
{
549517
if !o.should_emit_errors(self.borrowck_mode()) {
550518
self.sess.diagnostic().cancel(&mut diag);

0 commit comments

Comments
 (0)