File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 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> {
735735 unresolved : Option < usize > ,
736736 path : & Path ,
737737 ) -> ( Ty , Option < VariantId > ) {
738- match unresolved {
738+ let remaining = unresolved. map ( |x| path. segments ( ) . skip ( x) . len ( ) ) . filter ( |x| x > & 0 ) ;
739+ match remaining {
739740 None => {
740741 let variant = ty. as_adt ( ) . and_then ( |( adt_id, _) | match adt_id {
741742 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() {
15881588 z.x;
15891589 z.y;
15901590 }
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+ }
15911601 "# ,
15921602 expect ! [ [ r#"
15931603 115..116 'x': A<u32, i128>
@@ -1606,6 +1616,15 @@ fn infer_type_alias() {
16061616 195..198 'z.x': u8
16071617 204..205 'z': A<u8, i8>
16081618 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
16091628 "# ] ] ,
16101629 )
16111630}
You can’t perform that action at this time.
0 commit comments