rollup merge of #19880: sanxiyn/assoc-resolve-lifetime
Fix #18790. Fix #19862.
This commit is contained in:
commit
c4c892d467
@ -555,14 +555,18 @@ pub fn walk_ty_param_bound<'v, V: Visitor<'v>>(visitor: &mut V,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_ty_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v TyParam) {
|
||||
visitor.visit_ident(param.span, param.ident);
|
||||
walk_ty_param_bounds_helper(visitor, ¶m.bounds);
|
||||
match param.default {
|
||||
Some(ref ty) => visitor.visit_ty(&**ty),
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics) {
|
||||
for type_parameter in generics.ty_params.iter() {
|
||||
visitor.visit_ident(type_parameter.span, type_parameter.ident);
|
||||
walk_ty_param_bounds_helper(visitor, &type_parameter.bounds);
|
||||
match type_parameter.default {
|
||||
Some(ref ty) => visitor.visit_ty(&**ty),
|
||||
None => {}
|
||||
}
|
||||
walk_ty_param(visitor, type_parameter);
|
||||
}
|
||||
walk_lifetime_decls_helper(visitor, &generics.lifetimes);
|
||||
for predicate in generics.where_clause.predicates.iter() {
|
||||
@ -665,8 +669,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_method: &'v Tr
|
||||
RequiredMethod(ref method_type) => visitor.visit_ty_method(method_type),
|
||||
ProvidedMethod(ref method) => walk_method_helper(visitor, &**method),
|
||||
TypeTraitItem(ref associated_type) => {
|
||||
visitor.visit_ident(associated_type.ty_param.span,
|
||||
associated_type.ty_param.ident)
|
||||
walk_ty_param(visitor, &associated_type.ty_param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
src/test/run-pass/associated-types-resolve-lifetime.rs
Normal file
22
src/test/run-pass/associated-types-resolve-lifetime.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(associated_types)]
|
||||
|
||||
trait Get<T> {
|
||||
fn get(&self) -> T;
|
||||
}
|
||||
|
||||
trait Trait<'a> {
|
||||
type T: 'static;
|
||||
type U: Get<&'a int>;
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user