From dbcd0b553d46c0e57ca851f54fe83e12837a3b8b Mon Sep 17 00:00:00 2001 From: Barosl Lee Date: Wed, 17 Feb 2016 06:21:24 +0900 Subject: [PATCH] Adapt to nightly changes introduced by rust-lang/rust#31487 --- .travis.yml | 2 +- diesel_codegen/Cargo.toml | 8 ++++---- diesel_codegen/README.md | 2 +- diesel_codegen/src/associations/mod.rs | 6 +++--- diesel_codegen/src/attr.rs | 3 ++- diesel_codegen/src/insertable.rs | 9 +++++---- diesel_codegen/src/queryable.rs | 3 ++- diesel_codegen/src/update.rs | 8 ++++---- diesel_codegen/src/util.rs | 3 ++- diesel_tests/Cargo.toml | 2 +- 10 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index e775b7157827..691862a1d71c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ dist: trusty rust: - stable - beta - - nightly-2016-01-23 + - nightly-2016-02-13 - nightly addons: postgresql: '9.4' diff --git a/diesel_codegen/Cargo.toml b/diesel_codegen/Cargo.toml index ea4b727a748c..ff40459403c7 100644 --- a/diesel_codegen/Cargo.toml +++ b/diesel_codegen/Cargo.toml @@ -11,12 +11,12 @@ repository = "https://github.com/sgrif/diesel/tree/master/diesel_codegen" keywords = ["orm", "database", "postgres", "sql", "codegen"] [build-dependencies] -syntex = { version = "^0.26.0", optional = true } -syntex_syntax = { version = "^0.26.0", optional = true } +syntex = { version = "^0.28.0", optional = true } +syntex_syntax = { version = "^0.28.0", optional = true } [dependencies] -syntex = { version = "^0.26.0", optional = true } -syntex_syntax = { version = "^0.26.0", optional = true } +syntex = { version = "^0.28.0", optional = true } +syntex_syntax = { version = "^0.28.0", optional = true } diesel = { version = "0.5.0", default-features = false } [features] diff --git a/diesel_codegen/README.md b/diesel_codegen/README.md index 654547be765e..ee5a1f3e57a8 100644 --- a/diesel_codegen/README.md +++ b/diesel_codegen/README.md @@ -34,7 +34,7 @@ build-dependencies. ```toml diesel_codegen = "0.5.0" -syntex = "0.26.0" +syntex = "0.28.0" ``` You'll need to move any code using annotations into a different file. diff --git a/diesel_codegen/src/associations/mod.rs b/diesel_codegen/src/associations/mod.rs index bd3b42064284..bf4fbb79a102 100644 --- a/diesel_codegen/src/associations/mod.rs +++ b/diesel_codegen/src/associations/mod.rs @@ -1,4 +1,4 @@ -use syntax::ast::{self, MetaItem}; +use syntax::ast::{self, MetaItem, MetaItemKind}; use syntax::codemap::Span; use syntax::ext::base::{Annotatable, ExtCtxt}; use syntax::parse::token::str_to_ident; @@ -50,9 +50,9 @@ fn build_association_options( None }; match meta_item.node { - ast::MetaList(_, ref options) => { + MetaItemKind::List(_, ref options) => { let association_name = match options[0].node { - ast::MetaWord(ref name) => str_to_ident(&name), + MetaItemKind::Word(ref name) => str_to_ident(&name), _ => return usage_err(), }; diff --git a/diesel_codegen/src/attr.rs b/diesel_codegen/src/attr.rs index 4c7d529650a9..15f523d83f49 100644 --- a/diesel_codegen/src/attr.rs +++ b/diesel_codegen/src/attr.rs @@ -1,6 +1,7 @@ use syntax::ast; use syntax::ext::base::ExtCtxt; use syntax::ptr::P; +use syntax::ast::ItemKind; use util::str_value_of_attr_with_name; @@ -47,7 +48,7 @@ impl Attr { -> Option<(ast::Generics, Vec)> { match item.node { - ast::ItemStruct(ref variant_data, ref generics) => { + ItemKind::Struct(ref variant_data, ref generics) => { let fields = match *variant_data { ast::VariantData::Struct(ref fields, _) => fields, ast::VariantData::Tuple(ref fields, _) => fields, diff --git a/diesel_codegen/src/insertable.rs b/diesel_codegen/src/insertable.rs index a83946f553f1..042148e6209c 100644 --- a/diesel_codegen/src/insertable.rs +++ b/diesel_codegen/src/insertable.rs @@ -2,7 +2,8 @@ use syntax::ast::{ self, Item, MetaItem, - MetaItem_, + MetaItemKind, + TyKind, }; use syntax::codemap::Span; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -33,7 +34,7 @@ pub fn expand_insert( fn insertable_tables(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Vec { match meta_item.node { - MetaItem_::MetaList(_, ref meta_items) => { + MetaItemKind::List(_, ref meta_items) => { meta_items.iter().map(|i| table_name(cx, i)).collect() } _ => usage_error(cx, meta_item), @@ -42,7 +43,7 @@ fn insertable_tables(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Vec InternedString { match meta_item.node { - MetaItem_::MetaWord(ref word) => word.clone(), + MetaItemKind::Word(ref word) => word.clone(), _ => usage_error(cx, meta_item), } } @@ -156,7 +157,7 @@ fn tuple_ty_from P>( fields: &[Attr], f: F, ) -> P { - cx.ty(span, ast::TyTup(fields.iter().map(f).collect())) + cx.ty(span, TyKind::Tup(fields.iter().map(f).collect())) } fn tuple_expr_from P>( diff --git a/diesel_codegen/src/queryable.rs b/diesel_codegen/src/queryable.rs index 266177e35c4e..febe5f050873 100644 --- a/diesel_codegen/src/queryable.rs +++ b/diesel_codegen/src/queryable.rs @@ -2,6 +2,7 @@ use syntax::ast::{ self, Item, MetaItem, + TyKind, }; use syntax::codemap::Span; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -30,7 +31,7 @@ pub fn expand_derive_queryable( let ty = struct_ty(cx, span, item.ident, &generics); - let row_type = cx.ty(span, ast::TyTup(attrs.iter().map(|f| f.ty.clone()).collect())); + let row_type = cx.ty(span, TyKind::Tup(attrs.iter().map(|f| f.ty.clone()).collect())); let build_impl = struct_literal_with_fields_assigned_to_row_elements( span, &item, cx, &attrs); diff --git a/diesel_codegen/src/update.rs b/diesel_codegen/src/update.rs index 4fa922c37e89..1e1065080ec8 100644 --- a/diesel_codegen/src/update.rs +++ b/diesel_codegen/src/update.rs @@ -1,4 +1,4 @@ -use syntax::ast::{self, MetaItem}; +use syntax::ast::{self, MetaItem, MetaItemKind, TyKind}; use syntax::attr::AttrMetaMethods; use syntax::codemap::Span; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -37,7 +37,7 @@ struct ChangesetOptions { fn changeset_options(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Result { match meta_item.node { - ast::MetaList(_, ref meta_items) => { + MetaItemKind::List(_, ref meta_items) => { let table_name = try!(table_name(cx, &meta_items[0])); let treat_none_as_null = try!(boolean_option(cx, &meta_items[1..], "treat_none_as_null")) .unwrap_or(false); @@ -52,7 +52,7 @@ fn changeset_options(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Result Result { match meta_item.node { - ast::MetaWord(ref word) => Ok(word.clone()), + MetaItemKind::Word(ref word) => Ok(word.clone()), _ => usage_error(cx, meta_item), } } @@ -93,7 +93,7 @@ fn changeset_impl( let table_name = options.table_name; let attrs_for_changeset = model.attrs.iter().filter(|a| a.column_name != pk) .collect::>(); - let changeset_ty = cx.ty(span, ast::TyTup( + let changeset_ty = cx.ty(span, TyKind::Tup( attrs_for_changeset.iter() .map(|a| changeset_ty(cx, span, &options, a)) .collect() diff --git a/diesel_codegen/src/util.rs b/diesel_codegen/src/util.rs index bc8fdcf9fd69..69c081dd31ee 100644 --- a/diesel_codegen/src/util.rs +++ b/diesel_codegen/src/util.rs @@ -1,4 +1,5 @@ use syntax::ast; +use syntax::ast::TyKind; use syntax::attr::AttrMetaMethods; use syntax::codemap::Span; use syntax::ext::base::ExtCtxt; @@ -68,7 +69,7 @@ pub fn struct_ty( pub fn ty_param_of_option(ty: &ast::Ty) -> Option<&P> { match ty.node { - ast::TyPath(_, ref path) => { + TyKind::Path(_, ref path) => { path.segments.first().iter() .filter(|s| s.identifier.name.as_str() == intern_and_get_ident("Option")) .flat_map(|s| s.parameters.types().first().map(|p| *p)) diff --git a/diesel_tests/Cargo.toml b/diesel_tests/Cargo.toml index 4006aad38c2e..62cbd6b13424 100644 --- a/diesel_tests/Cargo.toml +++ b/diesel_tests/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" build = "build.rs" [build-dependencies] -syntex = { version = "^0.26.0", optional = true } +syntex = { version = "^0.28.0", optional = true } diesel_codegen = { path = "../diesel_codegen", default-features = false } dotenv_codegen = { git = "https://github.com/slapresta/rust-dotenv.git", optional = true } diesel = { path = "../diesel", default-features = false }