Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
da-x committed Jun 23, 2020
1 parent 404df1c commit 037e930
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,6 @@ impl<'a> Resolver<'a> {
return;
}

let via_import = name_binding.is_import() && !name_binding.is_extern_crate();

let child_accessible =
accessible && this.is_accessible_from(name_binding.vis, parent_scope.module);

Expand All @@ -669,6 +667,13 @@ impl<'a> Resolver<'a> {
return;
}

let via_import = name_binding.is_import() && !name_binding.is_extern_crate();

// There is an assumption elsewhere that paths of variants are in the enum's
// declaration and not imported. With this assumption, the variant component is
// chopped and the rest of the path is assumed to be the enum's own path. For
// errors where a variant is used as the type instead of the enum, this causes
// funny looking invalid suggestions, i.e `foo` instead of `foo::MyEnum`.
if via_import && name_binding.is_possibly_imported_variant() {
return;
}
Expand Down

0 comments on commit 037e930

Please sign in to comment.