File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -735,7 +735,8 @@ impl<'a> InferenceContext<'a> {
735
735
unresolved : Option < usize > ,
736
736
path : & Path ,
737
737
) -> ( Ty , Option < VariantId > ) {
738
- match unresolved {
738
+ let remaining = unresolved. map ( |x| path. segments ( ) . skip ( x) . len ( ) ) . filter ( |x| x > & 0 ) ;
739
+ match remaining {
739
740
None => {
740
741
let variant = ty. as_adt ( ) . and_then ( |( adt_id, _) | match adt_id {
741
742
AdtId :: StructId ( s) => Some ( VariantId :: StructId ( s) ) ,
Original file line number Diff line number Diff line change @@ -1588,6 +1588,16 @@ fn infer_type_alias() {
1588
1588
z.x;
1589
1589
z.y;
1590
1590
}
1591
+ mod m {
1592
+ pub enum Enum {
1593
+ Foo(u8),
1594
+ }
1595
+ pub type Alias = Enum;
1596
+ }
1597
+ fn f() {
1598
+ let e = m::Alias::Foo(0);
1599
+ let m::Alias::Foo(x) = &e;
1600
+ }
1591
1601
"# ,
1592
1602
expect ! [ [ r#"
1593
1603
115..116 'x': A<u32, i128>
@@ -1606,6 +1616,15 @@ fn infer_type_alias() {
1606
1616
195..198 'z.x': u8
1607
1617
204..205 'z': A<u8, i8>
1608
1618
204..207 'z.y': i8
1619
+ 298..362 '{ ... &e; }': ()
1620
+ 308..309 'e': Enum
1621
+ 312..325 'm::Alias::Foo': Foo(u8) -> Enum
1622
+ 312..328 'm::Ali...Foo(0)': Enum
1623
+ 326..327 '0': u8
1624
+ 338..354 'm::Ali...Foo(x)': Enum
1625
+ 352..353 'x': &u8
1626
+ 357..359 '&e': &Enum
1627
+ 358..359 'e': Enum
1609
1628
"# ] ] ,
1610
1629
)
1611
1630
}
You can’t perform that action at this time.
0 commit comments