From 2ed473487323bb4e5a600a3318e0981981214210 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 10 Jun 2014 13:54:13 -0700 Subject: librustc: Fix the issue with labels shadowing variable names by making the leading quote part of the identifier for the purposes of hygiene. This adopts @jbclements' solution to #14539. I'm not sure if this is a breaking change or not. Closes #12512. [breaking-change] --- src/libsyntax/print/pprust.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/libsyntax/print') diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 33b7086d7ae..77bc967b92d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -9,8 +9,8 @@ // except according to those terms. use abi; -use ast::{P, StaticRegionTyParamBound, OtherRegionTyParamBound, - TraitTyParamBound, UnboxedFnTyParamBound, Required, Provided}; +use ast::{P, StaticRegionTyParamBound, OtherRegionTyParamBound}; +use ast::{TraitTyParamBound, UnboxedFnTyParamBound, Required, Provided}; use ast; use ast_util; use owned_slice::OwnedSlice; @@ -1325,7 +1325,6 @@ impl<'a> State<'a> { } ast::ExprForLoop(ref pat, ref iter, ref blk, opt_ident) => { for ident in opt_ident.iter() { - try!(word(&mut self.s, "'")); try!(self.print_ident(*ident)); try!(self.word_space(":")); } @@ -1339,7 +1338,6 @@ impl<'a> State<'a> { } ast::ExprLoop(ref blk, opt_ident) => { for ident in opt_ident.iter() { - try!(word(&mut self.s, "'")); try!(self.print_ident(*ident)); try!(self.word_space(":")); } @@ -1504,7 +1502,6 @@ impl<'a> State<'a> { try!(word(&mut self.s, "break")); try!(space(&mut self.s)); for ident in opt_ident.iter() { - try!(word(&mut self.s, "'")); try!(self.print_ident(*ident)); try!(space(&mut self.s)); } @@ -1513,7 +1510,6 @@ impl<'a> State<'a> { try!(word(&mut self.s, "continue")); try!(space(&mut self.s)); for ident in opt_ident.iter() { - try!(word(&mut self.s, "'")); try!(self.print_ident(*ident)); try!(space(&mut self.s)) } @@ -1943,7 +1939,7 @@ impl<'a> State<'a> { match *region { Some(ref lt) => { let token = token::get_name(lt.name); - if token.get() != "static" { + if token.get() != "'static" { try!(self.nbsp()); first = false; try!(self.print_lifetime(lt)); @@ -1988,7 +1984,6 @@ impl<'a> State<'a> { pub fn print_lifetime(&mut self, lifetime: &ast::Lifetime) -> IoResult<()> { - try!(word(&mut self.s, "'")); self.print_name(lifetime.name) } -- cgit 1.4.1-3-g733a5