Fix pretty-printer test failure by carrying the bound lifetime names through

the types.  Initially I thought it would be necessary to thread this data
through not only the AST but the types themselves, but then I remembered that
the pretty printer only cares about the AST.  Regardless, I have elected to
leave the changes to the types intact since they will eventually be needed.  I
left a few FIXMEs where it didn't seem worth finishing up since the code wasn't
crucial yet.
This commit is contained in:
Niko Matsakis
2013-03-27 12:55:18 -04:00
committed by Graydon Hoare
parent 83aa70d7e3
commit 2a74fda316
14 changed files with 130 additions and 100 deletions

View File

@@ -14,6 +14,7 @@ use ast::{RegionTyParamBound, TraitTyParamBound, required, provided};
use ast;
use ast_util;
use opt_vec::OptVec;
use opt_vec;
use attr;
use codemap::{CodeMap, BytePos};
use codemap;
@@ -402,14 +403,18 @@ pub fn print_type(s: @ps, &&ty: @ast::Ty) {
pclose(s);
}
ast::ty_bare_fn(f) => {
let generics = ast::Generics {lifetimes: copy f.lifetimes,
ty_params: opt_vec::Empty};
print_ty_fn(s, Some(f.abi), None, None,
f.purity, ast::Many, &f.decl, None,
None, None);
Some(&generics), None);
}
ast::ty_closure(f) => {
let generics = ast::Generics {lifetimes: copy f.lifetimes,
ty_params: opt_vec::Empty};
print_ty_fn(s, None, Some(f.sigil), f.region,
f.purity, f.onceness, &f.decl, None,
None, None);
Some(&generics), None);
}
ast::ty_path(path, _) => print_path(s, path, false),
ast::ty_fixed_length_vec(ref mt, v) => {
@@ -1923,7 +1928,8 @@ pub fn print_ty_fn(s: @ps,
opt_region: Option<@ast::Lifetime>,
purity: ast::purity,
onceness: ast::Onceness,
decl: &ast::fn_decl, id: Option<ast::ident>,
decl: &ast::fn_decl,
id: Option<ast::ident>,
generics: Option<&ast::Generics>,
opt_self_ty: Option<ast::self_ty_>) {
ibox(s, indent_unit);