Skip to content

Commit 86e14d6

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 107873 b: refs/heads/dist-snap c: 0d0a3da h: refs/heads/master i: 107871: 5623e1d v: v3
1 parent b7702d5 commit 86e14d6

File tree

3 files changed

+17
-33
lines changed

3 files changed

+17
-33
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 875c9ce30b13de02e447ee95cb50b0111894b14a
9+
refs/heads/dist-snap: 0d0a3dad68fe03b45ab779e0565e33689edc1c0b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustdoc/clean.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
//! This module contains the "cleaned" pieces of the AST, and the functions
1212
//! that clean them.
1313
14-
use its = syntax::parse::token::ident_to_str;
15-
1614
use syntax;
1715
use syntax::ast;
1816
use syntax::ast_map;
@@ -893,7 +891,8 @@ fn path_to_str(p: &ast::Path) -> ~str {
893891

894892
impl Clean<~str> for ast::Ident {
895893
fn clean(&self) -> ~str {
896-
its(self).to_owned()
894+
let string = token::get_ident(self.name);
895+
string.get().to_owned()
897896
}
898897
}
899898

branches/dist-snap/src/libsyntax/parse/token.rs

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,29 @@ pub fn to_str(input: @IdentInterner, t: &Token) -> ~str {
188188
}
189189
LIT_INT_UNSUFFIXED(i) => { i.to_str() }
190190
LIT_FLOAT(ref s, t) => {
191-
let mut body = ident_to_str(s).to_owned();
191+
let body_string = get_ident(s.name);
192+
let mut body = body_string.get().to_str();
192193
if body.ends_with(".") {
193194
body.push_char('0'); // `10.f` is not a float literal
194195
}
195196
body + ast_util::float_ty_to_str(t)
196197
}
197198
LIT_FLOAT_UNSUFFIXED(ref s) => {
198-
let mut body = ident_to_str(s).to_owned();
199+
let body_string = get_ident(s.name);
200+
let mut body = body_string.get().to_owned();
199201
if body.ends_with(".") {
200202
body.push_char('0'); // `10.f` is not a float literal
201203
}
202204
body
203205
}
204-
LIT_STR(ref s) => { format!("\"{}\"", ident_to_str(s).escape_default()) }
206+
LIT_STR(ref s) => {
207+
let literal_string = get_ident(s.name);
208+
format!("\"{}\"", literal_string.get().escape_default())
209+
}
205210
LIT_STR_RAW(ref s, n) => {
211+
let literal_string = get_ident(s.name);
206212
format!("r{delim}\"{string}\"{delim}",
207-
delim="#".repeat(n), string=ident_to_str(s))
213+
delim="#".repeat(n), string=literal_string.get())
208214
}
209215

210216
/* Name components */
@@ -213,7 +219,10 @@ pub fn to_str(input: @IdentInterner, t: &Token) -> ~str {
213219
UNDERSCORE => ~"_",
214220

215221
/* Other */
216-
DOC_COMMENT(ref s) => ident_to_str(s).to_owned(),
222+
DOC_COMMENT(ref s) => {
223+
let comment_string = get_ident(s.name);
224+
comment_string.get().to_str()
225+
}
217226
EOF => ~"<eof>",
218227
INTERPOLATED(ref nt) => {
219228
match nt {
@@ -647,11 +656,6 @@ pub fn interner_get(name : Name) -> @str {
647656
get_ident_interner().get(name)
648657
}
649658

650-
// maps an identifier to the string that it corresponds to
651-
pub fn ident_to_str(id : &ast::Ident) -> @str {
652-
interner_get(id.name)
653-
}
654-
655659
// maps a string to an identifier with an empty syntax context
656660
pub fn str_to_ident(str : &str) -> ast::Ident {
657661
ast::Ident::new(intern(str))
@@ -768,23 +772,4 @@ mod test {
768772
let a1 = mark_ident(a,92);
769773
assert!(mtwt_token_eq(&IDENT(a,true),&IDENT(a1,false)));
770774
}
771-
772-
773-
#[test] fn str_ptr_eq_tests(){
774-
let a = @"abc";
775-
let b = @"abc";
776-
let c = a;
777-
assert!(str_ptr_eq(a,c));
778-
assert!(!str_ptr_eq(a,b));
779-
}
780-
781-
#[test] fn fresh_name_pointer_sharing() {
782-
let ghi = str_to_ident("ghi");
783-
assert_eq!(ident_to_str(&ghi),@"ghi");
784-
assert!(str_ptr_eq(ident_to_str(&ghi),ident_to_str(&ghi)))
785-
let fresh = ast::Ident::new(fresh_name(&ghi));
786-
assert_eq!(ident_to_str(&fresh),@"ghi");
787-
assert!(str_ptr_eq(ident_to_str(&ghi),ident_to_str(&fresh)));
788-
}
789-
790775
}

0 commit comments

Comments
 (0)