Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Bump syntex to 0.43
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 31, 2016
1 parent f927cf3 commit a9d8689
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ with-syntex = ["syntex_syntax"]
unstable-testing = ["clippy", "compiletest_rs"]

[dependencies]
syntex_syntax = { version = "^0.42.0", optional = true }
syntex_syntax = { version = "^0.43.0", optional = true }
clippy = { version = "0.*", optional = true }
compiletest_rs = { version = "^0.2.0", optional = true }

Expand Down
9 changes: 6 additions & 3 deletions src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub struct AttrListBuilder<F> {
callback: F,
span: Span,
name: token::InternedString,
items: Vec<P<ast::MetaItem>>,
items: Vec<ast::NestedMetaItem>,
}

impl<F> AttrListBuilder<F>
Expand All @@ -194,7 +194,10 @@ impl<F> AttrListBuilder<F>
pub fn with_meta_items<I>(mut self, iter: I) -> Self
where I: IntoIterator<Item=P<ast::MetaItem>>,
{
self.items.extend(iter);
let span = self.span;
self.items.extend(iter.into_iter().map(|meta_item| {
respan(span, ast::NestedMetaItemKind::MetaItem(meta_item))
}));
self
}

Expand All @@ -207,7 +210,7 @@ impl<F> AttrListBuilder<F>
}

pub fn with_meta_item(mut self, item: P<ast::MetaItem>) -> Self {
self.items.push(item);
self.items.push(respan(self.span, ast::NestedMetaItemKind::MetaItem(item)));
self
}

Expand Down
1 change: 1 addition & 0 deletions src/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ impl<F> GenericsBuilder<F>
id: ast::DUMMY_NODE_ID,
predicates: self.predicates,
},
span: self.span,
})
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ impl<F> ItemBuilder<F>
where T: ToIdent,
{
let id = id.to_ident();
let span = self.span;
FnDeclBuilder::with_callback(ItemFnDeclBuilder {
builder: self,
span: span,
id: id,
})
}
Expand Down Expand Up @@ -253,6 +255,7 @@ impl<F> Invoke<ast::Attribute> for ItemBuilder<F>

pub struct ItemFnDeclBuilder<F> {
builder: ItemBuilder<F>,
span: Span,
id: ast::Ident,
}

Expand All @@ -266,6 +269,7 @@ impl<F> Invoke<P<ast::FnDecl>> for ItemFnDeclBuilder<F>

ItemFnBuilder {
builder: self.builder,
span: self.span,
id: self.id,
fn_decl: fn_decl,
unsafety: ast::Unsafety::Normal,
Expand All @@ -280,6 +284,7 @@ impl<F> Invoke<P<ast::FnDecl>> for ItemFnDeclBuilder<F>

pub struct ItemFnBuilder<F> {
builder: ItemBuilder<F>,
span: Span,
id: ast::Ident,
fn_decl: P<ast::FnDecl>,
unsafety: ast::Unsafety,
Expand Down Expand Up @@ -314,7 +319,7 @@ impl<F> ItemFnBuilder<F>
self.builder.build_item_kind(self.id, ast::ItemKind::Fn(
self.fn_decl,
self.unsafety,
self.constness,
respan(self.span, self.constness),
self.abi,
self.generics,
block,
Expand Down Expand Up @@ -423,17 +428,18 @@ impl<F> ItemUsePathListBuilder<F>
}

pub fn self_(mut self) -> Self {
self.idents.push(respan(self.span, ast::PathListItemKind::Mod {
id: ast::DUMMY_NODE_ID,
self.idents.push(respan(self.span, ast::PathListItem_ {
name: keywords::SelfValue.ident(),
rename: None,
id: ast::DUMMY_NODE_ID,
}));
self
}

pub fn id<T>(mut self, id: T) -> Self
where T: ToIdent,
{
self.idents.push(respan(self.span, ast::PathListItemKind::Ident {
self.idents.push(respan(self.span, ast::PathListItem_ {
name: id.to_ident(),
rename: None,
id: ast::DUMMY_NODE_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/method.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use syntax::abi::Abi;
use syntax::ast;
use syntax::codemap::{DUMMY_SP, Span};
use syntax::codemap::{DUMMY_SP, respan, Span};
use syntax::ptr::P;

use fn_decl::FnDeclBuilder;
Expand Down Expand Up @@ -70,7 +70,7 @@ impl<F> MethodSigBuilder<F>
pub fn build_fn_decl(self, fn_decl: P<ast::FnDecl>) -> F::Result {
self.callback.invoke(ast::MethodSig {
unsafety: self.unsafety,
constness: self.constness,
constness: respan(self.span, self.constness),
abi: self.abi,
decl: fn_decl,
generics: self.generics,
Expand Down

0 comments on commit a9d8689

Please sign in to comment.