From d1c01734f3a34958333fefb2fe91cea5e753ddd7 Mon Sep 17 00:00:00 2001 From: John Clements Date: Fri, 7 Jun 2013 10:41:18 -0700 Subject: [PATCH] drop back to a simple gensym approach for fresh-name. this is necessary so that the new idents are connected to the original strings. this is important both for error messages, and so that top-level refs get connected to the right things. --- src/libsyntax/parse/token.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 66f121727af..6cdde3708a6 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -543,18 +543,9 @@ pub fn gensym_ident(str : &str) -> ast::Ident { ast::Ident::new(gensym(str)) } - -// create a fresh name. In principle, this is just a -// gensym, but for debugging purposes, you'd like the -// resulting name to have a suggestive stringify, without -// paying the cost of guaranteeing that the name is -// truly unique. I'm going to try to strike a balance -// by using a gensym with a name that has a random number -// at the end. So, the gensym guarantees the uniqueness, -// and the int helps to avoid confusion. -pub fn fresh_name(src_name : &ast::Ident) -> Name { - let num = rand::rng().gen_uint_range(0,0xffff); - gensym(fmt!("%s_%u",ident_to_str(src_name),num)) +// create a fresh name that maps to the same string as the old one. +pub fn fresh_name(src : &ast::Ident) -> Name { + gensym(ident_to_str(src)) } // create a fresh mark.