Skip to content

Commit 6e33fbe

Browse files
committed
Merge pull request rust-lang#245 from erickt/master
Update to syntex_syntax 0.23.0
2 parents cd4c8dc + aa84a15 commit 6e33fbe

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build = "build.rs"
1111
[dependencies]
1212
log = "0.3.*"
1313
libc = "0.1.*"
14-
syntex_syntax = "0.7.*"
14+
syntex_syntax = "0.23.*"
1515

1616
[features]
1717
static = []

src/bin/bindgen.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::path;
1010
use std::env;
1111
use std::default::Default;
1212
use std::fs;
13-
use std::borrow::ToOwned;
1413
use std::process::exit;
1514

1615
struct StdLogger;

src/gen.rs

+17-20
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn ref_eq<'a, 'b, T>(thing: &'a T, other: &'b T) -> bool {
3737

3838
fn to_intern_str(ctx: &mut GenCtx, s: String) -> parse::token::InternedString {
3939
let id = ctx.ext_cx.ident_of(&s[..]);
40-
parse::token::get_ident(id)
40+
id.name.as_str()
4141
}
4242

4343
fn empty_generics() -> ast::Generics {
@@ -124,20 +124,21 @@ pub fn gen_mod(links: &[(String, LinkType)], globs: Vec<Global>, span: Span) ->
124124
trace_mac: false,
125125
};
126126
let sess = &parse::ParseSess::new();
127+
let mut feature_gated_cfgs = Vec::new();
127128
let mut ctx = GenCtx {
128129
ext_cx: base::ExtCtxt::new(
129130
sess,
130131
Vec::new(),
131132
cfg,
133+
&mut feature_gated_cfgs,
132134
),
133135
unnamed_ty: 0,
134136
span: span
135137
};
136138
ctx.ext_cx.bt_push(ExpnInfo {
137139
call_site: ctx.span,
138140
callee: NameAndSpan {
139-
name: String::new(),
140-
format: MacroBang,
141+
format: MacroBang(parse::token::intern("")),
141142
allow_internal_unstable: false,
142143
span: None
143144
}
@@ -309,7 +310,7 @@ fn mk_extern(ctx: &mut GenCtx, links: &[(String, LinkType)],
309310
};
310311
respan(ctx.span, ast::Attribute_ {
311312
id: mk_attr_id(),
312-
style: ast::AttrOuter,
313+
style: ast::AttrStyle::Outer,
313314
value: P(respan(ctx.span, ast::MetaList(
314315
to_intern_str(ctx, "link".to_string()),
315316
link_args)
@@ -547,12 +548,8 @@ fn cstruct_to_rs(ctx: &mut GenCtx, name: String,
547548
}
548549
}
549550

550-
let ctor_id = if fields.is_empty() { Some(ast::DUMMY_NODE_ID) } else { None };
551551
let def = ast::ItemStruct(
552-
P(ast::StructDef {
553-
fields: fields,
554-
ctor_id: ctor_id,
555-
}),
552+
ast::VariantData::Struct(fields, ast::DUMMY_NODE_ID),
556553
empty_generics()
557554
);
558555

@@ -634,10 +631,9 @@ fn cunion_to_rs(ctx: &mut GenCtx, name: String, layout: Layout, members: Vec<Com
634631
let data_field = mk_blob_field(ctx, data_field_name, layout);
635632

636633
let def = ast::ItemStruct(
637-
P(ast::StructDef {
638-
fields: vec!(data_field),
639-
ctor_id: None,
640-
}),
634+
ast::VariantData::Struct(
635+
vec!(data_field),
636+
ast::DUMMY_NODE_ID),
641637
empty_generics()
642638
);
643639
let union_id = rust_type_id(ctx, name.clone());
@@ -727,7 +723,7 @@ fn gen_comp_methods(ctx: &mut GenCtx, data_field: &str, data_offset: usize,
727723
", f_name, tts_to_string(&ret_ty.to_tokens(&ctx.ext_cx)[..]), data_field, offset);
728724

729725
parse::new_parser_from_source_str(ctx.ext_cx.parse_sess(),
730-
ctx.ext_cx.cfg(), "".to_string(), impl_str).parse_item().unwrap()
726+
ctx.ext_cx.cfg(), "".to_string(), impl_str).parse_item().unwrap().unwrap()
731727
};
732728

733729
method.and_then(|i| {
@@ -780,7 +776,7 @@ fn mk_default_impl(ctx: &GenCtx, ty_name: &str) -> P<ast::Item> {
780776
", ty_name);
781777

782778
parse::new_parser_from_source_str(ctx.ext_cx.parse_sess(),
783-
ctx.ext_cx.cfg(), "".to_string(), impl_str).parse_item().unwrap()
779+
ctx.ext_cx.cfg(), "".to_string(), impl_str).parse_item().unwrap().unwrap()
784780
}
785781

786782
// Implements std::clone::Clone using dereferencing
@@ -792,7 +788,7 @@ fn mk_clone_impl(ctx: &GenCtx, ty_name: &str) -> P<ast::Item> {
792788
", ty_name);
793789

794790
parse::new_parser_from_source_str(ctx.ext_cx.parse_sess(),
795-
ctx.ext_cx.cfg(), "".to_string(), impl_str).parse_item().unwrap()
791+
ctx.ext_cx.cfg(), "".to_string(), impl_str).parse_item().unwrap().unwrap()
796792
}
797793

798794
fn mk_blob_field(ctx: &GenCtx, name: &str, layout: Layout) -> Spanned<ast::StructField_> {
@@ -827,7 +823,7 @@ fn mk_link_name_attr(ctx: &mut GenCtx, name: String) -> ast::Attribute {
827823
)));
828824
let attr = ast::Attribute_ {
829825
id: mk_attr_id(),
830-
style: ast::AttrOuter,
826+
style: ast::AttrStyle::Outer,
831827
value: attr_val,
832828
is_sugared_doc: false
833829
};
@@ -846,7 +842,7 @@ fn mk_repr_attr(ctx: &mut GenCtx, layout: Layout) -> ast::Attribute {
846842

847843
respan(ctx.span, ast::Attribute_ {
848844
id: mk_attr_id(),
849-
style: ast::AttrOuter,
845+
style: ast::AttrStyle::Outer,
850846
value: attr_val,
851847
is_sugared_doc: false
852848
})
@@ -860,7 +856,7 @@ fn mk_deriving_copy_attr(ctx: &mut GenCtx) -> ast::Attribute {
860856

861857
respan(ctx.span, ast::Attribute_ {
862858
id: mk_attr_id(),
863-
style: ast::AttrOuter,
859+
style: ast::AttrStyle::Outer,
864860
value: attr_val,
865861
is_sugared_doc: false
866862
})
@@ -1083,7 +1079,8 @@ fn mk_arrty(ctx: &GenCtx, base: &ast::Ty, n: usize) -> ast::Ty {
10831079
P(ast::Expr {
10841080
id: ast::DUMMY_NODE_ID,
10851081
node: sz,
1086-
span: ctx.span
1082+
span: ctx.span,
1083+
attrs: None,
10871084
})
10881085
);
10891086

tests/support.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn assert_bind_eq(filename: &str, reference_items_str: &str)
3838

3939
let mut parser = parse::new_parser_from_source_str(ext_cx.parse_sess(), ext_cx.cfg(), "".to_string(), reference_items_str.to_string());
4040
let mut reference_items = Vec::new();
41-
while let Some(item) = parser.parse_item() {
41+
while let Some(item) = parser.parse_item().unwrap() {
4242
reference_items.push(item);
4343
}
4444

0 commit comments

Comments
 (0)