diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-03-25 21:14:18 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-05-25 05:52:09 +0000 |
| commit | 7fdc1fb2e40bc8fc5f1f59eb3b9d180619bcb210 (patch) | |
| tree | 3eafc3d795855f4eee2360daa08ac0144aa3104d /src/libsyntax | |
| parent | 8497061a49cde5b70c416f2c964d1f252d82a7a0 (diff) | |
| download | rust-7fdc1fb2e40bc8fc5f1f59eb3b9d180619bcb210.tar.gz rust-7fdc1fb2e40bc8fc5f1f59eb3b9d180619bcb210.zip | |
Hygienize lifetimes.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/test.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 2 |
8 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 3dcb77a0497..2eb39bc26b5 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -37,7 +37,7 @@ use std::u32; pub struct Lifetime { pub id: NodeId, pub span: Span, - pub name: Name + pub ident: Ident, } impl fmt::Debug for Lifetime { diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 73aeb40df84..2a5de3c7382 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -206,7 +206,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, (descriptions.len(), ecx.expr_vec(span, descriptions)) }); - let static_ = ecx.lifetime(span, ecx.name_of("'static")); + let static_ = ecx.lifetime(span, Ident::from_str("'static")); let ty_str = ecx.ty_rptr( span, ecx.ty_ident(span, ecx.ident_of("str")), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 09f22e8691e..a4580ea3939 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -76,10 +76,10 @@ pub trait AstBuilder { fn trait_ref(&self, path: ast::Path) -> ast::TraitRef; fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef; fn typarambound(&self, path: ast::Path) -> ast::TyParamBound; - fn lifetime(&self, span: Span, ident: ast::Name) -> ast::Lifetime; + fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime; fn lifetime_def(&self, span: Span, - name: ast::Name, + ident: ast::Ident, attrs: Vec<ast::Attribute>, bounds: Vec<ast::Lifetime>) -> ast::LifetimeDef; @@ -478,19 +478,19 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::TraitTyParamBound(self.poly_trait_ref(path.span, path), ast::TraitBoundModifier::None) } - fn lifetime(&self, span: Span, name: ast::Name) -> ast::Lifetime { - ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, name: name } + fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime { + ast::Lifetime { id: ast::DUMMY_NODE_ID, span: span, ident: ident } } fn lifetime_def(&self, span: Span, - name: ast::Name, + ident: ast::Ident, attrs: Vec<ast::Attribute>, bounds: Vec<ast::Lifetime>) -> ast::LifetimeDef { ast::LifetimeDef { attrs: attrs.into(), - lifetime: self.lifetime(span, name), + lifetime: self.lifetime(span, ident), bounds: bounds } } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 5bbda5f2689..4c6cf49a8db 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -694,7 +694,7 @@ pub fn noop_fold_ty_params<T: Folder>(tps: Vec<TyParam>, fld: &mut T) -> Vec<TyP pub fn noop_fold_lifetime<T: Folder>(l: Lifetime, fld: &mut T) -> Lifetime { Lifetime { id: fld.new_id(l.id), - name: l.name, + ident: fld.fold_ident(l.ident), span: fld.new_span(l.span) } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bc9be809ca4..8d7c8c5248b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1958,7 +1958,7 @@ impl<'a> Parser<'a> { token::Lifetime(ident) => { let ident_span = self.span; self.bump(); - Lifetime { name: ident.name, span: ident_span, id: ast::DUMMY_NODE_ID } + Lifetime { ident: ident, span: ident_span, id: ast::DUMMY_NODE_ID } } _ => self.span_bug(self.span, "not a lifetime") } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 6c5bf56070e..073ededcb0c 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2764,7 +2764,7 @@ impl<'a> State<'a> { lifetime: &ast::Lifetime) -> io::Result<()> { - self.print_name(lifetime.name) + self.print_name(lifetime.ident.name) } pub fn print_lifetime_bounds(&mut self, diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 3df61fadc35..837c3eb0100 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -591,7 +591,7 @@ fn mk_tests(cx: &TestCtxt) -> P<ast::Item> { let struct_type = ecx.ty_path(ecx.path(sp, vec![ecx.ident_of("self"), ecx.ident_of("test"), ecx.ident_of("TestDescAndFn")])); - let static_lt = ecx.lifetime(sp, keywords::StaticLifetime.name()); + let static_lt = ecx.lifetime(sp, keywords::StaticLifetime.ident()); // &'static [self::test::TestDescAndFn] let static_type = ecx.ty_rptr(sp, ecx.ty(sp, ast::TyKind::Slice(struct_type)), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index d29d2497afe..18a0949af0e 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -195,7 +195,7 @@ pub fn walk_local<'a, V: Visitor<'a>>(visitor: &mut V, local: &'a Local) { } pub fn walk_lifetime<'a, V: Visitor<'a>>(visitor: &mut V, lifetime: &'a Lifetime) { - visitor.visit_name(lifetime.span, lifetime.name); + visitor.visit_ident(lifetime.span, lifetime.ident); } pub fn walk_lifetime_def<'a, V: Visitor<'a>>(visitor: &mut V, lifetime_def: &'a LifetimeDef) { |
