From 3657ae13f5f7ef4367a6de4b61bd4143fc6b52b4 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 28 Dec 2014 10:07:21 -0500 Subject: Don't normalize associated types when in region binders, wait until we instantiate them. Also fix some assertions and handling of builtin bounds. --- src/libsyntax/visit.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 1cd21ccac7a..40ca6354ca6 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -133,6 +133,9 @@ pub trait Visitor<'v> { fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &'v PathParameters) { walk_path_parameters(self, path_span, path_parameters) } + fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding) { + walk_assoc_type_binding(self, type_binding) + } fn visit_attribute(&mut self, _attr: &'v Attribute) {} } @@ -467,6 +470,9 @@ pub fn walk_path_parameters<'v, V: Visitor<'v>>(visitor: &mut V, for lifetime in data.lifetimes.iter() { visitor.visit_lifetime_ref(lifetime); } + for binding in data.bindings.iter() { + visitor.visit_assoc_type_binding(&**binding); + } } ast::ParenthesizedParameters(ref data) => { for typ in data.inputs.iter() { @@ -479,6 +485,12 @@ pub fn walk_path_parameters<'v, V: Visitor<'v>>(visitor: &mut V, } } +pub fn walk_assoc_type_binding<'v, V: Visitor<'v>>(visitor: &mut V, + type_binding: &'v TypeBinding) { + visitor.visit_ident(type_binding.span, type_binding.ident); + visitor.visit_ty(&*type_binding.ty); +} + pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { match pattern.node { PatEnum(ref path, ref children) => { -- cgit 1.4.1-3-g733a5 From adca15a151422a72d69c39ade946f36a2ff072a6 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 29 Dec 2014 11:00:56 -0500 Subject: Add a FIXME relating to using `ast::Name` --- src/librustc/middle/def.rs | 1 + src/librustc_typeck/astconv.rs | 3 +-- src/libsyntax/ast.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libsyntax') diff --git a/src/librustc/middle/def.rs b/src/librustc/middle/def.rs index 59fd41b5d29..ff1ee394966 100644 --- a/src/librustc/middle/def.rs +++ b/src/librustc/middle/def.rs @@ -36,6 +36,7 @@ pub enum Def { // A partially resolved path to an associated type `T::U` where `T` is a concrete // type (indicated by the DefId) which implements a trait which has an associated // type `U` (indicated by the Ident). + // FIXME(#20301) -- should use Name DefAssociatedPath(TyParamProvenance, ast::Ident), DefTrait(ast::DefId), DefPrimTy(ast::PrimTy), diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 47717105164..480bba16e63 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -992,7 +992,7 @@ fn qpath_to_ty<'tcx,AC,RS>(this: &AC, return this.projected_ty(ast_ty.span, trait_ref, - qpath.item_name.name); // TODO change qpath to use name + qpath.item_name.name); } // Parses the programmer's textual representation of a type into our @@ -1155,7 +1155,6 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>( this.tcx().types.err } def::DefAssociatedPath(provenance, assoc_ident) => { - // TODO update DefAssociatedPath to use name associated_path_def_to_ty(this, ast_ty, provenance, assoc_ident.name) } _ => { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index f253943943d..12432c8c78f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -764,7 +764,7 @@ pub enum Expr_ { pub struct QPath { pub self_type: P, pub trait_ref: P, - pub item_name: Ident, + pub item_name: Ident, // FIXME(#20301) -- should use Name } #[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] -- cgit 1.4.1-3-g733a5