Skip to content

Commit 268f6c5

Browse files
committed
removed incomplete comment
as written, I don't believe this comment was helpful; I think it's better just to steer the reader toward a general understanding of hygiene.
1 parent 351a5fd commit 268f6c5

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

src/libsyntax/fold.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -391,23 +391,6 @@ fn fold_arg_<T: Folder>(a: &Arg, fld: &mut T) -> Arg {
391391

392392
// build a new vector of tts by appling the Folder's fold_ident to
393393
// all of the identifiers in the token trees.
394-
//
395-
// This is part of hygiene magic. As far as hygiene is concerned, there
396-
// are three types of let pattern bindings or loop labels:
397-
// - those defined and used in non-macro part of the program
398-
// - those used as part of macro invocation arguments
399-
// - those defined and used inside macro definitions
400-
// Lexically, type 1 and 2 are in one group and type 3 the other. If they
401-
// clash, in order for let and loop label to work hygienically, one group
402-
// or the other needs to be renamed. The problem is that type 2 and 3 are
403-
// parsed together (inside the macro expand function). After being parsed and
404-
// AST being constructed, they can no longer be distinguished from each other.
405-
//
406-
// For that reason, type 2 let bindings and loop labels are actually renamed
407-
// in the form of tokens instead of AST nodes, here. There are wasted effort
408-
// since many token::IDENT are not necessary part of let bindings and most
409-
// token::LIFETIME are certainly not loop labels. But we can't tell in their
410-
// token form. So this is less ideal and hacky but it works.
411394
pub fn fold_tts<T: Folder>(tts: &[TokenTree], fld: &mut T) -> Vec<TokenTree> {
412395
tts.iter().map(|tt| {
413396
match *tt {

0 commit comments

Comments
 (0)