Skip to content

Commit 8c000de

Browse files
author
Alexander Regueiro
committed
Wrapped long lines of code.
1 parent ad54054 commit 8c000de

File tree

3 files changed

+54
-12
lines changed

3 files changed

+54
-12
lines changed

src/libsyntax/ext/tt/macro_rules.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@ pub fn compile(sess: &ParseSess, features: &Features, def: &ast::Item) -> Syntax
237237
s.iter().map(|m| {
238238
if let MatchedNonterminal(ref nt) = *m {
239239
if let NtTT(ref tt) = **nt {
240-
let tt = quoted::parse(tt.clone().into(), false, true, sess, features, &def.attrs)
240+
let tt = quoted::parse(tt.clone().into(),
241+
false,
242+
true,
243+
sess,
244+
features,
245+
&def.attrs)
241246
.pop().unwrap();
242247
valid &= check_lhs_nt_follows(sess, features, &def.attrs, &tt);
243248
return tt;
@@ -254,7 +259,12 @@ pub fn compile(sess: &ParseSess, features: &Features, def: &ast::Item) -> Syntax
254259
s.iter().map(|m| {
255260
if let MatchedNonterminal(ref nt) = *m {
256261
if let NtTT(ref tt) = **nt {
257-
return quoted::parse(tt.clone().into(), !body.legacy, false, sess, features, &def.attrs)
262+
return quoted::parse(tt.clone().into(),
263+
!body.legacy,
264+
false,
265+
sess,
266+
features,
267+
&def.attrs)
258268
.pop().unwrap();
259269
}
260270
}

src/libsyntax/ext/tt/quoted.rs

+37-5
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ pub fn parse(
204204
while let Some(tree) = trees.next() {
205205
// Given the parsed tree, if there is a metavar and we are expecting matchers, actually
206206
// parse out the matcher (i.e. in `$id:ident` this would parse the `:` and `ident`).
207-
let tree = parse_tree(tree, &mut trees, hygiene_optout, expect_matchers, sess, features, attrs);
207+
let tree = parse_tree(tree,
208+
&mut trees,
209+
hygiene_optout,
210+
expect_matchers,
211+
sess,
212+
features,
213+
attrs);
208214
match tree {
209215
TokenTree::MetaVar(start_sp, ident, _) if expect_matchers => {
210216
let span = match trees.next() {
@@ -273,7 +279,14 @@ where
273279
tokenstream::TokenTree::Token(span, token::Pound) if hygiene_optout => match trees.peek() {
274280
Some(tokenstream::TokenTree::Token(_, token::Dollar)) => {
275281
if let tokenstream::TokenTree::Token(span, token::Dollar) = trees.next().unwrap() {
276-
parse_meta_var(true, span, trees, hygiene_optout, expect_matchers, sess, features, attrs)
282+
parse_meta_var(true,
283+
span,
284+
trees,
285+
hygiene_optout,
286+
expect_matchers,
287+
sess,
288+
features,
289+
attrs)
277290
} else {
278291
unreachable!();
279292
}
@@ -302,7 +315,14 @@ where
302315

303316
// `tree` is a `$` token. Look at the next token in `trees`.
304317
tokenstream::TokenTree::Token(span, token::Dollar) =>
305-
parse_meta_var(false, span, trees, hygiene_optout, expect_matchers, sess, features, attrs),
318+
parse_meta_var(false,
319+
span,
320+
trees,
321+
hygiene_optout,
322+
expect_matchers,
323+
sess,
324+
features,
325+
attrs),
306326

307327
// `tree` is an arbitrary token. Keep it.
308328
tokenstream::TokenTree::Token(span, tok) => TokenTree::Token(span, tok, false),
@@ -313,7 +333,12 @@ where
313333
span,
314334
Lrc::new(Delimited {
315335
delim: delimited.delim,
316-
tts: parse(delimited.tts.into(), hygiene_optout, expect_matchers, sess, features, attrs),
336+
tts: parse(delimited.tts.into(),
337+
hygiene_optout,
338+
expect_matchers,
339+
sess,
340+
features,
341+
attrs),
317342
}),
318343
),
319344
}
@@ -344,7 +369,14 @@ where
344369
sess.span_diagnostic.span_err(span, &msg);
345370
}
346371
// Parse the contents of the sequence itself
347-
let sequence = parse(delimited.tts.into(), hygiene_optout, expect_matchers, sess, features, attrs);
372+
let sequence = parse(
373+
delimited.tts.into(),
374+
hygiene_optout,
375+
expect_matchers,
376+
sess,
377+
features,
378+
attrs
379+
);
348380
// Get the Kleene operator and optional separator
349381
let (separator, op) = parse_sep_and_kleene_op(trees, span, sess, features, attrs);
350382
// Count the number of captured "names" (i.e. named metavars)

src/libsyntax/ext/tt/transcribe.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,19 @@ pub fn transcribe(cx: &ExtCtxt,
182182
let sp = sp.with_ctxt(sp_ctxt.apply_mark(cx.current_expansion.mark));
183183

184184
let update_ident_ctxt = |ident: Ident| {
185-
let ident_ctxt = if escape_hygiene {
186-
cx.call_site().ctxt()
185+
let new_span = if escape_hygiene {
186+
cx.call_site()
187187
} else {
188-
ident.ctxt.apply_mark(cx.current_expansion.mark)
188+
ident.span.apply_mark(cx.current_expansion.mark)
189189
};
190-
Ident { ctxt: ident_ctxt, ..ident }
190+
Ident::new(ident.name, new_span)
191191
};
192192

193193
let result_tok = match tok {
194194
token::Ident(ident, is_raw) =>
195195
TokenTree::Token(sp, token::Ident(update_ident_ctxt(ident), is_raw)),
196196
token::Lifetime(ident) =>
197-
TokenTree::Token(sp, token::Lifetime(ident)),
197+
TokenTree::Token(sp, token::Lifetime()),
198198
_ => {
199199
let mut marker = Marker(cx.current_expansion.mark);
200200
noop_fold_tt(TokenTree::Token(sp, tok), &mut marker)

0 commit comments

Comments
 (0)