@@ -342,7 +342,38 @@ LL | let _: u32 = *x;
342
342
| +
343
343
344
344
error[E0308]: mismatched types
345
- --> $DIR/pattern-errors.rs:101:11
345
+ --> $DIR/pattern-errors.rs:98:11
346
+ |
347
+ LL | let [&&mut x] = &mut [&mut 0];
348
+ | ^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
349
+ | |
350
+ | expected integer, found `&mut _`
351
+ |
352
+ = note: expected type `{integer}`
353
+ found mutable reference `&mut _`
354
+ help: consider removing `&mut` from the pattern
355
+ |
356
+ LL - let [&&mut x] = &mut [&mut 0];
357
+ LL + let [&x] = &mut [&mut 0];
358
+ |
359
+
360
+ error[E0308]: mismatched types
361
+ --> $DIR/pattern-errors.rs:100:18
362
+ |
363
+ LL | let _: u32 = x;
364
+ | --- ^ expected `u32`, found `&_`
365
+ | |
366
+ | expected due to this
367
+ |
368
+ = note: expected type `u32`
369
+ found reference `&_`
370
+ help: consider dereferencing the borrow
371
+ |
372
+ LL | let _: u32 = *x;
373
+ | +
374
+
375
+ error[E0308]: mismatched types
376
+ --> $DIR/pattern-errors.rs:103:11
346
377
|
347
378
LL | let [&&mut ref x] = &[&mut 0];
348
379
| ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -358,7 +389,23 @@ LL + let [&ref x] = &[&mut 0];
358
389
|
359
390
360
391
error[E0308]: mismatched types
361
- --> $DIR/pattern-errors.rs:108:11
392
+ --> $DIR/pattern-errors.rs:107:11
393
+ |
394
+ LL | let [&&mut ref x] = &mut [&mut 0];
395
+ | ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
396
+ | |
397
+ | expected integer, found `&mut _`
398
+ |
399
+ = note: expected type `{integer}`
400
+ found mutable reference `&mut _`
401
+ help: consider removing `&mut` from the pattern
402
+ |
403
+ LL - let [&&mut ref x] = &mut [&mut 0];
404
+ LL + let [&ref x] = &mut [&mut 0];
405
+ |
406
+
407
+ error[E0308]: mismatched types
408
+ --> $DIR/pattern-errors.rs:111:11
362
409
|
363
410
LL | let [&&mut mut x] = &[&mut 0];
364
411
| ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -374,7 +421,7 @@ LL + let [&mut x] = &[&mut 0];
374
421
|
375
422
376
423
error[E0658]: binding cannot be both mutable and by-reference
377
- --> $DIR/pattern-errors.rs:108 :16
424
+ --> $DIR/pattern-errors.rs:111 :16
378
425
|
379
426
LL | let [&&mut mut x] = &[&mut 0];
380
427
| ^^^^
@@ -384,7 +431,48 @@ LL | let [&&mut mut x] = &[&mut 0];
384
431
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
385
432
386
433
error[E0308]: mismatched types
387
- --> $DIR/pattern-errors.rs:111:18
434
+ --> $DIR/pattern-errors.rs:114:18
435
+ |
436
+ LL | let _: u32 = x;
437
+ | --- ^ expected `u32`, found `&_`
438
+ | |
439
+ | expected due to this
440
+ |
441
+ = note: expected type `u32`
442
+ found reference `&_`
443
+ help: consider dereferencing the borrow
444
+ |
445
+ LL | let _: u32 = *x;
446
+ | +
447
+
448
+ error[E0308]: mismatched types
449
+ --> $DIR/pattern-errors.rs:117:11
450
+ |
451
+ LL | let [&&mut mut x] = &mut [&mut 0];
452
+ | ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
453
+ | |
454
+ | expected integer, found `&mut _`
455
+ |
456
+ = note: expected type `{integer}`
457
+ found mutable reference `&mut _`
458
+ help: consider removing `&mut` from the pattern
459
+ |
460
+ LL - let [&&mut mut x] = &mut [&mut 0];
461
+ LL + let [&mut x] = &mut [&mut 0];
462
+ |
463
+
464
+ error[E0658]: binding cannot be both mutable and by-reference
465
+ --> $DIR/pattern-errors.rs:117:16
466
+ |
467
+ LL | let [&&mut mut x] = &mut [&mut 0];
468
+ | ^^^^
469
+ |
470
+ = note: see issue #123076 <https://github.com/rust-lang/rust/issues/123076> for more information
471
+ = help: add `#![feature(mut_ref)]` to the crate attributes to enable
472
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
473
+
474
+ error[E0308]: mismatched types
475
+ --> $DIR/pattern-errors.rs:120:18
388
476
|
389
477
LL | let _: u32 = x;
390
478
| --- ^ expected `u32`, found `&_`
@@ -398,7 +486,7 @@ help: consider dereferencing the borrow
398
486
LL | let _: u32 = *x;
399
487
| +
400
488
401
- error: aborting due to 27 previous errors
489
+ error: aborting due to 33 previous errors
402
490
403
491
Some errors have detailed explanations: E0308, E0658.
404
492
For more information about an error, try `rustc --explain E0308`.
0 commit comments