Skip to content

Commit 0455b48

Browse files
committed
---
yaml --- r: 137702 b: refs/heads/auto c: 9c09c94 h: refs/heads/master v: v3
1 parent d9482c7 commit 0455b48

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 01d58fe2cbad0872f92571960ca3d8a5b01d0784
16+
refs/heads/auto: 9c09c9434764127f857a9599b93dc090ac63cc2b
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libsyntax/ext/bytes.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,14 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt,
104104
return DummyResult::expr(sp);
105105
}
106106

107-
let e = cx.expr_vec_slice(sp, bytes);
108-
let ty = cx.ty(sp, ast::TyVec(cx.ty_ident(sp, cx.ident_of("u8"))));
109-
let lifetime = cx.lifetime(sp, cx.ident_of("'static").name);
110-
let item = cx.item_static(sp,
111-
cx.ident_of("BYTES"),
112-
cx.ty_rptr(sp,
113-
ty,
114-
Some(lifetime),
115-
ast::MutImmutable),
116-
ast::MutImmutable,
117-
e);
118-
let e = cx.expr_block(cx.block(sp,
119-
vec!(cx.stmt_item(sp, item)),
120-
Some(cx.expr_ident(sp, cx.ident_of("BYTES")))));
107+
let len = bytes.len();
108+
let e = cx.expr_vec(sp, bytes);
109+
let ty = cx.ty(sp, ast::TyFixedLengthVec(cx.ty_ident(sp, cx.ident_of("u8")),
110+
cx.expr_uint(sp, len)));
111+
let item = cx.item_static(sp, cx.ident_of("BYTES"), ty, ast::MutImmutable, e);
112+
let ret = cx.expr_ident(sp, cx.ident_of("BYTES"));
113+
let ret = cx.expr_addr_of(sp, ret);
114+
let e = cx.expr_block(cx.block(sp, vec![cx.stmt_item(sp, item)],
115+
Some(ret)));
121116
MacExpr::new(e)
122117
}

0 commit comments

Comments
 (0)