Skip to content

Commit 786c54d

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 107854 b: refs/heads/dist-snap c: f9af11d h: refs/heads/master v: v3
1 parent 3c63726 commit 786c54d

File tree

8 files changed

+47
-40
lines changed

8 files changed

+47
-40
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: b496d7bec2a79feab092e6b4e251f7b0cee2a6a6
9+
refs/heads/dist-snap: f9af11d6cc0266a5690897b4645d8cab2ed1115b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ fn extract_crate_info(i: &ast::ViewItem) -> Option<CrateInfo> {
168168
debug!("resolving extern mod stmt. ident: {:?} path_opt: {:?}",
169169
ident, path_opt);
170170
let (name, version) = match path_opt {
171-
Some((path_str, _)) => {
172-
let crateid: Option<CrateId> = from_str(path_str);
171+
Some((ref path_str, _)) => {
172+
let crateid: Option<CrateId> = from_str(path_str.get());
173173
match crateid {
174174
None => (@"", @""),
175175
Some(crateid) => {

branches/dist-snap/src/librustc/middle/trans/asm.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
3838
let temp_scope = fcx.push_custom_cleanup_scope();
3939

4040
// Prepare the output operands
41-
let outputs = ia.outputs.map(|&(c, out)| {
42-
constraints.push(c);
41+
let outputs = ia.outputs.map(|&(ref c, out)| {
42+
constraints.push((*c).clone());
4343

4444
let out_datum = unpack_datum!(bcx, expr::trans(bcx, out));
4545
output_types.push(type_of::type_of(bcx.ccx(), out_datum.ty));
@@ -48,8 +48,8 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
4848
});
4949

5050
// Now the input operands
51-
let inputs = ia.inputs.map(|&(c, input)| {
52-
constraints.push(c);
51+
let inputs = ia.inputs.map(|&(ref c, input)| {
52+
constraints.push((*c).clone());
5353

5454
unpack_result!(bcx, {
5555
callee::trans_arg_expr(bcx,
@@ -63,13 +63,13 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
6363
// no failure occurred preparing operands, no need to cleanup
6464
fcx.pop_custom_cleanup_scope(temp_scope);
6565

66-
let mut constraints = constraints.connect(",");
66+
let mut constraints = constraints.map(|s| s.get().to_str()).connect(",");
6767

6868
let mut clobbers = getClobbers();
69-
if !ia.clobbers.is_empty() && !clobbers.is_empty() {
70-
clobbers = format!("{},{}", ia.clobbers, clobbers);
69+
if !ia.clobbers.get().is_empty() && !clobbers.is_empty() {
70+
clobbers = format!("{},{}", ia.clobbers.get(), clobbers);
7171
} else {
72-
clobbers.push_str(ia.clobbers);
72+
clobbers.push_str(ia.clobbers.get());
7373
}
7474

7575
// Add the clobbers to our constraints list
@@ -98,7 +98,7 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
9898
ast::AsmIntel => lib::llvm::AD_Intel
9999
};
100100

101-
let r = ia.asm.with_c_str(|a| {
101+
let r = ia.asm.get().with_c_str(|a| {
102102
constraints.with_c_str(|c| {
103103
InlineAsmCall(bcx, a, c, inputs, output_type, ia.volatile, ia.alignstack, dialect)
104104
})

branches/dist-snap/src/libsyntax/ast.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,11 @@ pub enum AsmDialect {
898898

899899
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
900900
pub struct InlineAsm {
901-
asm: @str,
901+
asm: InternedString,
902902
asm_str_style: StrStyle,
903-
clobbers: @str,
904-
inputs: ~[(@str, @Expr)],
905-
outputs: ~[(@str, @Expr)],
903+
clobbers: InternedString,
904+
inputs: ~[(InternedString, @Expr)],
905+
outputs: ~[(InternedString, @Expr)],
906906
volatile: bool,
907907
alignstack: bool,
908908
dialect: AsmDialect
@@ -1075,7 +1075,7 @@ pub enum ViewItem_ {
10751075
// optional @str: if present, this is a location (containing
10761076
// arbitrary characters) from which to fetch the crate sources
10771077
// For example, extern mod whatever = "github.com/mozilla/rust"
1078-
ViewItemExternMod(Ident, Option<(@str, StrStyle)>, NodeId),
1078+
ViewItemExternMod(Ident, Option<(InternedString,StrStyle)>, NodeId),
10791079
ViewItemUse(~[@ViewPath]),
10801080
}
10811081

branches/dist-snap/src/libsyntax/ext/asm.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
8080

8181
let (constraint, _str_style) = p.parse_str();
8282

83-
if constraint.starts_with("+") {
83+
if constraint.get().starts_with("+") {
8484
cx.span_unimpl(p.last_span,
8585
"'+' (read+write) output operand constraint modifier");
86-
} else if !constraint.starts_with("=") {
86+
} else if !constraint.get().starts_with("=") {
8787
cx.span_err(p.last_span, "output operand constraint lacks '='");
8888
}
8989

@@ -105,9 +105,9 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
105105

106106
let (constraint, _str_style) = p.parse_str();
107107

108-
if constraint.starts_with("=") {
108+
if constraint.get().starts_with("=") {
109109
cx.span_err(p.last_span, "input operand constraint contains '='");
110-
} else if constraint.starts_with("+") {
110+
} else if constraint.get().starts_with("+") {
111111
cx.span_err(p.last_span, "input operand constraint contains '+'");
112112
}
113113

@@ -138,11 +138,11 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
138138
Options => {
139139
let (option, _str_style) = p.parse_str();
140140

141-
if "volatile" == option {
141+
if option.equiv(&("volatile")) {
142142
volatile = true;
143-
} else if "alignstack" == option {
143+
} else if option.equiv(&("alignstack")) {
144144
alignstack = true;
145-
} else if "intel" == option {
145+
} else if option.equiv(&("intel")) {
146146
dialect = ast::AsmIntel;
147147
}
148148

@@ -192,9 +192,9 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
192192
MRExpr(@ast::Expr {
193193
id: ast::DUMMY_NODE_ID,
194194
node: ast::ExprInlineAsm(ast::InlineAsm {
195-
asm: asm.get().to_managed(),
195+
asm: token::intern_and_get_ident(asm.get()),
196196
asm_str_style: asm_str_style.unwrap(),
197-
clobbers: cons.to_managed(),
197+
clobbers: token::intern_and_get_ident(cons),
198198
inputs: inputs,
199199
outputs: outputs,
200200
volatile: volatile,

branches/dist-snap/src/libsyntax/fold.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,12 @@ pub fn noop_fold_expr<T: Folder>(e: @Expr, folder: &mut T) -> @Expr {
814814
}
815815
ExprInlineAsm(ref a) => {
816816
ExprInlineAsm(InlineAsm {
817-
inputs: a.inputs.map(|&(c, input)| (c, folder.fold_expr(input))),
818-
outputs: a.outputs.map(|&(c, out)| (c, folder.fold_expr(out))),
817+
inputs: a.inputs.map(|&(ref c, input)| {
818+
((*c).clone(), folder.fold_expr(input))
819+
}),
820+
outputs: a.outputs.map(|&(ref c, out)| {
821+
((*c).clone(), folder.fold_expr(out))
822+
}),
819823
.. (*a).clone()
820824
})
821825
}

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5130,17 +5130,20 @@ impl Parser {
51305130
}
51315131
}
51325132

5133-
pub fn parse_optional_str(&mut self) -> Option<(@str, ast::StrStyle)> {
5133+
pub fn parse_optional_str(&mut self)
5134+
-> Option<(InternedString, ast::StrStyle)> {
51345135
let (s, style) = match self.token {
5135-
token::LIT_STR(s) => (s, ast::CookedStr),
5136-
token::LIT_STR_RAW(s, n) => (s, ast::RawStr(n)),
5136+
token::LIT_STR(s) => (self.id_to_interned_str(s), ast::CookedStr),
5137+
token::LIT_STR_RAW(s, n) => {
5138+
(self.id_to_interned_str(s), ast::RawStr(n))
5139+
}
51375140
_ => return None
51385141
};
51395142
self.bump();
5140-
Some((ident_to_str(&s), style))
5143+
Some((s, style))
51415144
}
51425145

5143-
pub fn parse_str(&mut self) -> (@str, StrStyle) {
5146+
pub fn parse_str(&mut self) -> (InternedString, StrStyle) {
51445147
match self.parse_optional_str() {
51455148
Some(s) => { s }
51465149
_ => self.fatal("expected string literal")

branches/dist-snap/src/libsyntax/print/pprust.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,25 +1466,25 @@ pub fn print_expr(s: &mut State, expr: &ast::Expr) {
14661466
word(&mut s.s, "asm!");
14671467
}
14681468
popen(s);
1469-
print_string(s, a.asm, a.asm_str_style);
1469+
print_string(s, a.asm.get(), a.asm_str_style);
14701470
word_space(s, ":");
1471-
for &(co, o) in a.outputs.iter() {
1472-
print_string(s, co, ast::CookedStr);
1471+
for &(ref co, o) in a.outputs.iter() {
1472+
print_string(s, co.get(), ast::CookedStr);
14731473
popen(s);
14741474
print_expr(s, o);
14751475
pclose(s);
14761476
word_space(s, ",");
14771477
}
14781478
word_space(s, ":");
1479-
for &(co, o) in a.inputs.iter() {
1480-
print_string(s, co, ast::CookedStr);
1479+
for &(ref co, o) in a.inputs.iter() {
1480+
print_string(s, co.get(), ast::CookedStr);
14811481
popen(s);
14821482
print_expr(s, o);
14831483
pclose(s);
14841484
word_space(s, ",");
14851485
}
14861486
word_space(s, ":");
1487-
print_string(s, a.clobbers, ast::CookedStr);
1487+
print_string(s, a.clobbers.get(), ast::CookedStr);
14881488
pclose(s);
14891489
}
14901490
ast::ExprMac(ref m) => print_mac(s, m),
@@ -1998,7 +1998,7 @@ pub fn print_view_item(s: &mut State, item: &ast::ViewItem) {
19981998
space(&mut s.s);
19991999
word(&mut s.s, "=");
20002000
space(&mut s.s);
2001-
print_string(s, *p, style);
2001+
print_string(s, p.get(), style);
20022002
}
20032003
}
20042004

0 commit comments

Comments
 (0)