From 75aaa85f46c517c98713317463dd4fb06ad610bf Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 7 Nov 2019 19:39:21 +0100 Subject: [PATCH] TAIT: adjust resolve --- src/librustc_resolve/build_reduced_graph.rs | 13 ++++++------- src/librustc_resolve/late.rs | 13 ------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 0fcac5aab62..6bd035f32bb 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -699,13 +699,12 @@ fn build_reduced_graph_for_item(&mut self, item: &'b Item) { } // These items live in the type namespace. - ItemKind::TyAlias(..) => { - let res = Res::Def(DefKind::TyAlias, self.r.definitions.local_def_id(item.id)); - self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion)); - } - - ItemKind::OpaqueTy(_, _) => { - let res = Res::Def(DefKind::OpaqueTy, self.r.definitions.local_def_id(item.id)); + ItemKind::TyAlias(ref ty, _) => { + let def_kind = match ty.kind.opaque_top_hack() { + None => DefKind::TyAlias, + Some(_) => DefKind::OpaqueTy, + }; + let res = Res::Def(def_kind, self.r.definitions.local_def_id(item.id)); self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion)); } diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 3340566a875..1316f8d8aa1 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -730,7 +730,6 @@ fn resolve_item(&mut self, item: &Item) { match item.kind { ItemKind::TyAlias(_, ref generics) | - ItemKind::OpaqueTy(_, ref generics) | ItemKind::Fn(_, ref generics, _) => { self.with_generic_param_rib(generics, ItemRibKind(HasGenericParams::Yes), |this| visit::walk_item(this, item)); @@ -1085,18 +1084,6 @@ fn resolve_implementation(&mut self, this.visit_ty(ty); } - ImplItemKind::OpaqueTy(ref bounds) => { - // If this is a trait impl, ensure the type - // exists in trait - this.check_trait_item(impl_item.ident, - TypeNS, - impl_item.span, - |n, s| TypeNotMemberOfTrait(n, s)); - - for bound in bounds { - this.visit_param_bound(bound); - } - } ImplItemKind::Macro(_) => panic!("unexpanded macro in resolve!"), }