File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -681,6 +681,30 @@ fn baz(s: S) -> i32 {
681
681
)
682
682
}
683
683
684
+ #[ test]
685
+ fn missing_record_pat_field_box ( ) {
686
+ check_diagnostics (
687
+ r"
688
+ struct S { s: Box<u32> }
689
+ fn x(a: S) {
690
+ let S { box s } = a;
691
+ }
692
+ " ,
693
+ )
694
+ }
695
+
696
+ #[ test]
697
+ fn missing_record_pat_field_ref ( ) {
698
+ check_diagnostics (
699
+ r"
700
+ struct S { s: u32 }
701
+ fn x(a: S) {
702
+ let S { ref s } = a;
703
+ }
704
+ " ,
705
+ )
706
+ }
707
+
684
708
#[ test]
685
709
fn break_outside_of_loop ( ) {
686
710
check_diagnostics (
Original file line number Diff line number Diff line change @@ -381,11 +381,20 @@ impl ast::RecordPatField {
381
381
if let Some ( name_ref) = self . name_ref ( ) {
382
382
return Some ( NameOrNameRef :: NameRef ( name_ref) ) ;
383
383
}
384
- if let Some ( ast:: Pat :: IdentPat ( pat) ) = self . pat ( ) {
385
- let name = pat. name ( ) ?;
386
- return Some ( NameOrNameRef :: Name ( name) ) ;
384
+ match self . pat ( ) {
385
+ Some ( ast:: Pat :: IdentPat ( pat) ) => {
386
+ let name = pat. name ( ) ?;
387
+ Some ( NameOrNameRef :: Name ( name) )
388
+ }
389
+ Some ( ast:: Pat :: BoxPat ( pat) ) => match pat. pat ( ) {
390
+ Some ( ast:: Pat :: IdentPat ( pat) ) => {
391
+ let name = pat. name ( ) ?;
392
+ Some ( NameOrNameRef :: Name ( name) )
393
+ }
394
+ _ => None ,
395
+ } ,
396
+ _ => None ,
387
397
}
388
- None
389
398
}
390
399
}
391
400
You can’t perform that action at this time.
0 commit comments