File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -659,8 +659,6 @@ impl<'a> Resolver<'a> {
659659 return ;
660660 }
661661
662- let via_import = name_binding. is_import ( ) && !name_binding. is_extern_crate ( ) ;
663-
664662 let child_accessible =
665663 accessible && this. is_accessible_from ( name_binding. vis , parent_scope. module ) ;
666664
@@ -669,6 +667,13 @@ impl<'a> Resolver<'a> {
669667 return ;
670668 }
671669
670+ let via_import = name_binding. is_import ( ) && !name_binding. is_extern_crate ( ) ;
671+
672+ // There is an assumption elsewhere that paths of variants are in the enum's
673+ // declaration and not imported. With this assumption, the variant component is
674+ // chopped and the rest of the path is assumed to be the enum's own path. For
675+ // errors where a variant is used as the type instead of the enum, this causes
676+ // funny looking invalid suggestions, i.e `foo` instead of `foo::MyEnum`.
672677 if via_import && name_binding. is_possibly_imported_variant ( ) {
673678 return ;
674679 }
You can’t perform that action at this time.
0 commit comments