Skip to content

Commit

Permalink
Adapt to nightly changes introduced by rust-lang/rust#31487
Browse files Browse the repository at this point in the history
  • Loading branch information
barosl committed Feb 17, 2016
1 parent e94a3cb commit 2498fe1
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dist: trusty
rust:
- stable
- beta
- nightly-2016-01-23
- nightly-2016-02-13
- nightly
addons:
postgresql: '9.4'
Expand Down
8 changes: 4 additions & 4 deletions diesel_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion diesel_codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions diesel_codegen/src/associations/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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(),
};

Expand Down
3 changes: 2 additions & 1 deletion diesel_codegen/src/attr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use syntax::ast;
use syntax::ast::ItemKind;
use syntax::ext::base::ExtCtxt;
use syntax::ptr::P;

Expand Down Expand Up @@ -47,7 +48,7 @@ impl Attr {
-> Option<(ast::Generics, Vec<Self>)>
{
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,
Expand Down
9 changes: 5 additions & 4 deletions diesel_codegen/src/insertable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use syntax::ast::{
self,
Item,
MetaItem,
MetaItem_,
MetaItemKind,
TyKind,
};
use syntax::codemap::Span;
use syntax::ext::base::{Annotatable, ExtCtxt};
Expand Down Expand Up @@ -33,7 +34,7 @@ pub fn expand_insert(

fn insertable_tables(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Vec<InternedString> {
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),
Expand All @@ -42,7 +43,7 @@ fn insertable_tables(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Vec<InternedStri

fn table_name(cx: &mut ExtCtxt, meta_item: &MetaItem) -> InternedString {
match meta_item.node {
MetaItem_::MetaWord(ref word) => word.clone(),
MetaItemKind::Word(ref word) => word.clone(),
_ => usage_error(cx, meta_item),
}
}
Expand Down Expand Up @@ -156,7 +157,7 @@ fn tuple_ty_from<F: Fn(&Attr) -> P<ast::Ty>>(
fields: &[Attr],
f: F,
) -> P<ast::Ty> {
cx.ty(span, ast::TyTup(fields.iter().map(f).collect()))
cx.ty(span, TyKind::Tup(fields.iter().map(f).collect()))
}

fn tuple_expr_from<F: Fn((usize, &Attr)) -> P<ast::Expr>>(
Expand Down
3 changes: 2 additions & 1 deletion diesel_codegen/src/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use syntax::ast::{
self,
Item,
MetaItem,
TyKind,
};
use syntax::codemap::Span;
use syntax::ext::base::{Annotatable, ExtCtxt};
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions diesel_codegen/src/update.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -37,7 +37,7 @@ struct ChangesetOptions {

fn changeset_options(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Result<ChangesetOptions, ()> {
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);
Expand All @@ -52,7 +52,7 @@ fn changeset_options(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Result<Changeset

fn table_name(cx: &mut ExtCtxt, meta_item: &MetaItem) -> Result<InternedString, ()> {
match meta_item.node {
ast::MetaWord(ref word) => Ok(word.clone()),
MetaItemKind::Word(ref word) => Ok(word.clone()),
_ => usage_error(cx, meta_item),
}
}
Expand Down Expand Up @@ -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::<Vec<_>>();
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()
Expand Down
3 changes: 2 additions & 1 deletion diesel_codegen/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use syntax::ast;
use syntax::ast::TyKind;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::Span;
use syntax::ext::base::ExtCtxt;
Expand Down Expand Up @@ -68,7 +69,7 @@ pub fn struct_ty(

pub fn ty_param_of_option(ty: &ast::Ty) -> Option<&P<ast::Ty>> {
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))
Expand Down
2 changes: 1 addition & 1 deletion diesel_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 2498fe1

Please sign in to comment.