From e7608913ff71469835c84afb19fedd1a4e33ab32 Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Mon, 2 May 2016 06:32:32 +0200 Subject: [PATCH 1/3] Adapt for removal of old interfaces in libsyntax https://github.com/rust-lang/rust/commit/9108fb7bae11f18715d971eeae1e5ca84662e1ee dropped some old methods -- adapt the code accordingly. These changes should actually be backwards-compatible I think... --- src/generics.rs | 4 ++-- tests/test_generics.rs | 2 +- tests/test_path.rs | 6 +++--- tests/test_ty_param.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/generics.rs b/src/generics.rs index 7c81182fd..1a47ab244 100644 --- a/src/generics.rs +++ b/src/generics.rs @@ -57,7 +57,7 @@ impl GenericsBuilder pub fn with(self, generics: ast::Generics) -> Self { self.with_lifetimes(generics.lifetimes.into_iter()) - .with_ty_params(generics.ty_params.move_iter()) + .with_ty_params(generics.ty_params.into_iter()) .with_predicates(generics.where_clause.predicates.into_iter()) } @@ -200,7 +200,7 @@ impl GenericsBuilder pub fn strip_ty_params(mut self) -> Self { for ty_param in &mut self.ty_params { - ty_param.bounds = P::empty(); + ty_param.bounds = P::new(); } self } diff --git a/tests/test_generics.rs b/tests/test_generics.rs index 40347cd32..3fa0adff8 100644 --- a/tests/test_generics.rs +++ b/tests/test_generics.rs @@ -12,7 +12,7 @@ fn test_empty() { generics, ast::Generics { lifetimes: vec![], - ty_params: P::empty(), + ty_params: P::new(), where_clause: ast::WhereClause { id: ast::DUMMY_NODE_ID, predicates: vec![], diff --git a/tests/test_path.rs b/tests/test_path.rs index f726144dc..9d4c51d16 100644 --- a/tests/test_path.rs +++ b/tests/test_path.rs @@ -110,7 +110,7 @@ fn test_option() { types: P::from_vec(vec![ builder.ty().isize(), ]), - bindings: P::empty(), + bindings: P::new(), }), }, ] @@ -139,8 +139,8 @@ fn test_lifetimes() { lifetimes: vec![ builder.lifetime("'a"), ], - types: P::empty(), - bindings: P::empty(), + types: P::new(), + bindings: P::new(), }), }, ] diff --git a/tests/test_ty_param.rs b/tests/test_ty_param.rs index a6da85bbe..c9389b413 100644 --- a/tests/test_ty_param.rs +++ b/tests/test_ty_param.rs @@ -16,7 +16,7 @@ fn test_ty_param_empty() { ast::TyParam { ident: builder.id("T"), id: ast::DUMMY_NODE_ID, - bounds: P::empty(), + bounds: P::new(), default: None, span: DUMMY_SP, } @@ -36,7 +36,7 @@ fn test_ty_param_default() { ast::TyParam { ident: builder.id("T"), id: ast::DUMMY_NODE_ID, - bounds: P::empty(), + bounds: P::new(), default: Some(builder.ty().usize()), span: DUMMY_SP, } From f6300c461d76a7d2552ff72813d41309da5ae30c Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Mon, 2 May 2016 06:38:53 +0200 Subject: [PATCH 2/3] Adapt for `special_idents` -> `keywords` change in libsyntax Changed upstream in https://github.com/rust-lang/rust/commit/b32d7b592306a2784585e842193db1546a2f9587 This one is definitely not backwards-compatible -- so we have to depend on a newer syntex for this. --- Cargo.toml | 2 +- src/item.rs | 4 ++-- tests/test_item.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1b442d100..b0371a4ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ with-syntex = ["syntex_syntax"] unstable-testing = ["clippy", "compiletest_rs"] [dependencies] -syntex_syntax = { version = "^0.31.0", optional = true } +syntex_syntax = { version = "^0.32.0", optional = true } clippy = { version = "0.*", optional = true } compiletest_rs = { version = "^0.1.1", optional = true } diff --git a/src/item.rs b/src/item.rs index 9f0172624..b099db27c 100644 --- a/src/item.rs +++ b/src/item.rs @@ -111,7 +111,7 @@ impl ItemBuilder pub fn build_use(self, view_path: ast::ViewPath_) -> F::Result { let item = ast::ItemKind::Use(P(respan(self.span, view_path))); - self.build_item_kind(token::special_idents::invalid, item) + self.build_item_kind(token::keywords::Invalid.ident(), item) } pub fn use_(self) -> PathBuilder> { @@ -1180,7 +1180,7 @@ impl ItemImplBuilder self.trait_ref, ty, self.items); - self.builder.build_item_kind(token::special_idents::invalid, ty_) + self.builder.build_item_kind(token::keywords::Invalid.ident(), ty_) } pub fn with_items(mut self, items: I) -> Self diff --git a/tests/test_item.rs b/tests/test_item.rs index 8a174fd00..2d2106ee1 100644 --- a/tests/test_item.rs +++ b/tests/test_item.rs @@ -268,7 +268,7 @@ fn test_use() { assert_eq!( item, P(ast::Item { - ident: token::special_idents::invalid, + ident: token::keywords::Invalid.ident(), attrs: vec![], id: ast::DUMMY_NODE_ID, node: ast::ItemKind::Use( From 1e5dc102ef3d4614539fdf3b1b5ddf5e4ecd8d68 Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Mon, 2 May 2016 06:43:50 +0200 Subject: [PATCH 3/3] Bump version to 0.16 The last change updated version requirements of the dependencies. The interface we export to users might also have changed -- though I haven't really checked that... Either way, updating our version is in order. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b0371a4ee..f570cd2e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aster" -version = "0.15.0" +version = "0.16.0" authors = ["Erick Tryzelaar "] license = "MIT/Apache-2.0" description = "A libsyntax ast builder"