Skip to content

Commit c8ec75c

Browse files
committed
---
yaml --- r: 47855 b: refs/heads/incoming c: 3792eb2 h: refs/heads/master i: 47853: 36a24d7 47851: 2240623 47847: 14f17fb 47839: 34464e9 v: v3
1 parent 8076af9 commit c8ec75c

File tree

30 files changed

+249
-335
lines changed

30 files changed

+249
-335
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: b02f5c2090340a9007989b3eb384facb0f0286f2
9+
refs/heads/incoming: 3792eb2a3847f7891a7d3a1941aa7833626baa5c
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/core.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ pub const debug : u32 = 4_u32;
225225
// The runtime interface used by the compiler
226226
#[cfg(notest)] pub mod rt;
227227
// The runtime and compiler interface to fmt!
228+
#[cfg(stage0)]
229+
#[path = "private/extfmt.rs"]
228230
pub mod extfmt;
229231
// Private APIs
230232
pub mod private;

branches/incoming/src/libcore/prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ pub use char;
5252
pub use cmp;
5353
pub use dvec;
5454
pub use either;
55-
pub use extfmt;
5655
pub use f32;
5756
pub use f64;
5857
pub use float;

branches/incoming/src/libcore/private.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub mod weak_task;
3434
pub mod exchange_alloc;
3535
#[path = "private/intrinsics.rs"]
3636
pub mod intrinsics;
37+
#[path = "private/extfmt.rs"]
38+
pub mod extfmt;
3739

3840
extern mod rustrt {
3941
pub unsafe fn rust_create_little_lock() -> rust_little_lock;

branches/incoming/src/libfuzzer/fuzzer.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ pub fn parse_and_print(code: @~str) -> ~str {
466466
sess.cm,
467467
// Assuming there are no token_trees
468468
syntax::parse::token::mk_fake_ident_interner(),
469-
copy sess.span_diagnostic,
469+
sess.span_diagnostic,
470470
crate,
471471
filename.to_str(),
472472
rdr, a,
@@ -622,7 +622,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
622622
sess.cm,
623623
// Assuming no token_trees
624624
syntax::parse::token::mk_fake_ident_interner(),
625-
copy sess.span_diagnostic,
625+
sess.span_diagnostic,
626626
crate,
627627
file_str,
628628
rdr, a,

branches/incoming/src/librustc/driver/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use syntax::ast::node_id;
2525
use syntax::ast::{int_ty, uint_ty, float_ty};
2626
use syntax::codemap::span;
2727
use syntax::diagnostic;
28-
use syntax::parse::ParseSess;
28+
use syntax::parse::parse_sess;
2929
use syntax::{ast, codemap};
3030
use syntax;
3131

@@ -151,7 +151,7 @@ pub struct Session_ {
151151
targ_cfg: @config,
152152
opts: @options,
153153
cstore: @mut metadata::cstore::CStore,
154-
parse_sess: @mut ParseSess,
154+
parse_sess: parse_sess,
155155
codemap: @codemap::CodeMap,
156156
// For a library crate, this is always none
157157
main_fn: @mut Option<(node_id, codemap::span)>,

branches/incoming/src/librustc/front/test.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
// Code that generates a test runner to run all the tests in a crate
1212

13+
// XXX - Need to finish off libsyntax first
14+
#[legacy_records];
15+
#[allow(structural_records)];
16+
1317
use core::prelude::*;
1418

1519
use driver::session;
@@ -21,7 +25,7 @@ use core::option;
2125
use core::vec;
2226
use syntax::ast_util::*;
2327
use syntax::attr;
24-
use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
28+
use syntax::codemap::{dummy_sp, span, ExpandedFrom};
2529
use syntax::codemap;
2630
use syntax::fold;
2731
use syntax::print::pprust;
@@ -77,13 +81,11 @@ fn generate_test_harness(sess: session::Session,
7781
testfns: ~[]
7882
};
7983

80-
cx.ext_cx.bt_push(ExpandedFrom(CallInfo {
81-
call_site: dummy_sp(),
82-
callee: NameAndSpan {
83-
name: ~"test",
84-
span: None
85-
}
86-
}));
84+
cx.ext_cx.bt_push(ExpandedFrom({
85+
call_site: dummy_sp(),
86+
callie: {
87+
name: ~"test",
88+
span: None}}));
8789

8890
let precursor = @fold::AstFoldFns {
8991
fold_crate: fold::wrap(|a,b| fold_crate(cx, a, b) ),

branches/incoming/src/librustc/middle/astencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,18 +1193,18 @@ fn decode_item_ast(par_doc: ebml::Doc) -> @ast::item {
11931193
#[cfg(test)]
11941194
trait fake_ext_ctxt {
11951195
fn cfg() -> ast::crate_cfg;
1196-
fn parse_sess() -> @mut parse::ParseSess;
1196+
fn parse_sess() -> parse::parse_sess;
11971197
fn call_site() -> span;
11981198
fn ident_of(+st: ~str) -> ast::ident;
11991199
}
12001200
12011201
#[cfg(test)]
1202-
type fake_session = @mut parse::ParseSess;
1202+
type fake_session = parse::parse_sess;
12031203
12041204
#[cfg(test)]
12051205
impl fake_ext_ctxt for fake_session {
12061206
fn cfg() -> ast::crate_cfg { ~[] }
1207-
fn parse_sess() -> @mut parse::ParseSess { self }
1207+
fn parse_sess() -> parse::parse_sess { self }
12081208
fn call_site() -> span {
12091209
codemap::span {
12101210
lo: codemap::BytePos(0),

branches/incoming/src/libsyntax/codemap.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,11 @@ pub struct LocWithOpt {
196196
// used to be structural records. Better names, anyone?
197197
pub struct FileMapAndLine {fm: @FileMap, line: uint}
198198
pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos}
199-
pub struct NameAndSpan {name: ~str, span: Option<span>}
200-
201-
pub struct CallInfo {
202-
call_site: span,
203-
callee: NameAndSpan
204-
}
205199

206200
/// Extra information for tracking macro expansion of spans
207201
pub enum ExpnInfo {
208-
ExpandedFrom(CallInfo)
202+
ExpandedFrom({call_site: span,
203+
callie: {name: ~str, span: Option<span>}})
209204
}
210205

211206
pub type FileName = ~str;

branches/incoming/src/libsyntax/diagnostic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ fn highlight_lines(cm: @codemap::CodeMap,
290290

291291
fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) {
292292
do option::iter(&sp.expn_info) |ei| {
293-
let ss = option::map_default(&ei.callee.span, @~"",
293+
let ss = option::map_default(&ei.callie.span, @~"",
294294
|span| @cm.span_to_str(*span));
295295
print_diagnostic(*ss, note,
296-
fmt!("in expansion of %s!", ei.callee.name));
296+
fmt!("in expansion of %s!", ei.callie.name));
297297
let ss = cm.span_to_str(ei.call_site);
298298
print_diagnostic(ss, note, ~"expansion site");
299299
print_macro_backtrace(cm, ei.call_site);

branches/incoming/src/libsyntax/ext/base.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use core::prelude::*;
1313
use ast;
1414
use codemap;
1515
use codemap::{CodeMap, span, ExpnInfo, ExpandedFrom, dummy_sp};
16-
use codemap::{CallInfo, NameAndSpan};
1716
use diagnostic::span_handler;
1817
use ext;
1918
use parse;
@@ -167,7 +166,7 @@ pub fn syntax_expander_table() -> SyntaxExtensions {
167166
// -> expn_info of their expansion context stored into their span.
168167
pub trait ext_ctxt {
169168
fn codemap(@mut self) -> @CodeMap;
170-
fn parse_sess(@mut self) -> @mut parse::ParseSess;
169+
fn parse_sess(@mut self) -> parse::parse_sess;
171170
fn cfg(@mut self) -> ast::crate_cfg;
172171
fn call_site(@mut self) -> span;
173172
fn print_backtrace(@mut self);
@@ -191,22 +190,22 @@ pub trait ext_ctxt {
191190
fn ident_of(@mut self, st: ~str) -> ast::ident;
192191
}
193192

194-
pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
193+
pub fn mk_ctxt(parse_sess: parse::parse_sess,
195194
cfg: ast::crate_cfg) -> ext_ctxt {
196195
struct CtxtRepr {
197-
parse_sess: @mut parse::ParseSess,
196+
parse_sess: parse::parse_sess,
198197
cfg: ast::crate_cfg,
199198
backtrace: Option<@ExpnInfo>,
200199
mod_path: ~[ast::ident],
201200
trace_mac: bool
202201
}
203202
impl ext_ctxt for CtxtRepr {
204203
fn codemap(@mut self) -> @CodeMap { self.parse_sess.cm }
205-
fn parse_sess(@mut self) -> @mut parse::ParseSess { self.parse_sess }
204+
fn parse_sess(@mut self) -> parse::parse_sess { self.parse_sess }
206205
fn cfg(@mut self) -> ast::crate_cfg { self.cfg }
207206
fn call_site(@mut self) -> span {
208207
match self.backtrace {
209-
Some(@ExpandedFrom(CallInfo {call_site: cs, _})) => cs,
208+
Some(@ExpandedFrom({call_site: cs, _})) => cs,
210209
None => self.bug(~"missing top span")
211210
}
212211
}
@@ -217,18 +216,18 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
217216
fn mod_path(@mut self) -> ~[ast::ident] { return self.mod_path; }
218217
fn bt_push(@mut self, ei: codemap::ExpnInfo) {
219218
match ei {
220-
ExpandedFrom(CallInfo {call_site: cs, callee: ref callee}) => {
219+
ExpandedFrom({call_site: cs, callie: ref callie}) => {
221220
self.backtrace =
222-
Some(@ExpandedFrom(CallInfo {
221+
Some(@ExpandedFrom({
223222
call_site: span {lo: cs.lo, hi: cs.hi,
224223
expn_info: self.backtrace},
225-
callee: (*callee)}));
224+
callie: (*callie)}));
226225
}
227226
}
228227
}
229228
fn bt_pop(@mut self) {
230229
match self.backtrace {
231-
Some(@ExpandedFrom(CallInfo {
230+
Some(@ExpandedFrom({
232231
call_site: span {expn_info: prev, _}, _
233232
})) => {
234233
self.backtrace = prev

branches/incoming/src/libsyntax/ext/build.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ use ext::build;
1919
use core::dvec;
2020
use core::option;
2121

22-
pub struct Field {
23-
ident: ast::ident,
24-
ex: @ast::expr
25-
}
26-
2722
pub fn mk_expr(cx: ext_ctxt,
2823
sp: codemap::span,
2924
expr: ast::expr_)
@@ -152,37 +147,47 @@ pub fn mk_base_str(cx: ext_ctxt, sp: span, s: ~str) -> @ast::expr {
152147
pub fn mk_uniq_str(cx: ext_ctxt, sp: span, s: ~str) -> @ast::expr {
153148
mk_vstore_e(cx, sp, mk_base_str(cx, sp, s), ast::expr_vstore_uniq)
154149
}
155-
pub fn mk_field(sp: span, f: &Field) -> ast::field {
150+
pub fn mk_field(sp: span, f: &{ident: ast::ident, ex: @ast::expr})
151+
-> ast::field {
156152
codemap::spanned {
157153
node: ast::field_ { mutbl: ast::m_imm, ident: f.ident, expr: f.ex },
158154
span: sp,
159155
}
160156
}
161-
pub fn mk_fields(sp: span, fields: ~[Field]) -> ~[ast::field] {
157+
pub fn mk_fields(sp: span, fields: ~[{ident: ast::ident, ex: @ast::expr}])
158+
-> ~[ast::field] {
162159
fields.map(|f| mk_field(sp, f))
163160
}
164-
pub fn mk_rec_e(cx: ext_ctxt, sp: span, fields: ~[Field]) -> @ast::expr {
161+
pub fn mk_rec_e(cx: ext_ctxt,
162+
sp: span,
163+
fields: ~[{ident: ast::ident, ex: @ast::expr}])
164+
-> @ast::expr {
165165
mk_expr(cx, sp, ast::expr_rec(mk_fields(sp, fields),
166166
option::None::<@ast::expr>))
167167
}
168-
pub fn mk_struct_e(cx: ext_ctxt, sp: span, ctor_path: ~[ast::ident],
169-
fields: ~[Field]) -> @ast::expr {
168+
pub fn mk_struct_e(cx: ext_ctxt,
169+
sp: span,
170+
ctor_path: ~[ast::ident],
171+
fields: ~[{ident: ast::ident, ex: @ast::expr}])
172+
-> @ast::expr {
170173
mk_expr(cx, sp,
171174
ast::expr_struct(mk_raw_path(sp, ctor_path),
172175
mk_fields(sp, fields),
173176
option::None::<@ast::expr>))
174177
}
175-
pub fn mk_global_struct_e(cx: ext_ctxt, sp: span,
178+
pub fn mk_global_struct_e(cx: ext_ctxt,
179+
sp: span,
176180
ctor_path: ~[ast::ident],
177-
fields: ~[Field])
181+
fields: ~[{ident: ast::ident, ex: @ast::expr}])
178182
-> @ast::expr {
179183
mk_expr(cx, sp,
180184
ast::expr_struct(mk_raw_path_global(sp, ctor_path),
181185
mk_fields(sp, fields),
182186
option::None::<@ast::expr>))
183187
}
184-
pub fn mk_glob_use(cx: ext_ctxt, sp: span, path: ~[ast::ident])
185-
-> @ast::view_item {
188+
pub fn mk_glob_use(cx: ext_ctxt,
189+
sp: span,
190+
path: ~[ast::ident]) -> @ast::view_item {
186191
let glob = @codemap::spanned {
187192
node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()),
188193
span: sp,

branches/incoming/src/libsyntax/ext/expand.rs

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ast::{crate, expr_, expr_mac, mac_invoc_tt};
1414
use ast::{tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
1515
use ast;
1616
use attr;
17-
use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan};
17+
use codemap::{span, ExpandedFrom};
1818
use ext::base::*;
1919
use fold::*;
2020
use parse::{parser, parse_expr_from_source_str, new_parser_from_tts};
@@ -48,12 +48,8 @@ pub fn expand_expr(exts: SyntaxExtensions, cx: ext_ctxt,
4848
}
4949
Some(NormalTT(SyntaxExpanderTT{expander: exp,
5050
span: exp_sp})) => {
51-
cx.bt_push(ExpandedFrom(CallInfo{
52-
call_site: s,
53-
callee: NameAndSpan {
54-
name: *extname, span: exp_sp
55-
}
56-
}));
51+
cx.bt_push(ExpandedFrom({call_site: s,
52+
callie: {name: *extname, span: exp_sp}}));
5753

5854
let expanded = match exp(cx, (*mac).span, (*tts)) {
5955
MRExpr(e) => e,
@@ -109,13 +105,9 @@ pub fn expand_mod_items(exts: SyntaxExtensions, cx: ext_ctxt,
109105
match exts.find(&mname) {
110106
None | Some(NormalTT(_)) | Some(ItemTT(*)) => items,
111107
Some(ItemDecorator(dec_fn)) => {
112-
cx.bt_push(ExpandedFrom(CallInfo {
113-
call_site: attr.span,
114-
callee: NameAndSpan {
115-
name: /*bad*/ copy *mname,
116-
span: None
117-
}
118-
}));
108+
cx.bt_push(ExpandedFrom({call_site: attr.span,
109+
callie: {name: /*bad*/ copy *mname,
110+
span: None}}));
119111
let r = dec_fn(cx, attr.span, attr.node.value, items);
120112
cx.bt_pop();
121113
r
@@ -178,13 +170,9 @@ pub fn expand_item_mac(exts: SyntaxExtensions,
178170
given '%s'", *extname,
179171
*cx.parse_sess().interner.get(it.ident)));
180172
}
181-
cx.bt_push(ExpandedFrom(CallInfo {
182-
call_site: it.span,
183-
callee: NameAndSpan {
184-
name: *extname,
185-
span: (*expand).span
186-
}
187-
}));
173+
cx.bt_push(ExpandedFrom({call_site: it.span,
174+
callie: {name: *extname,
175+
span: (*expand).span}}));
188176
((*expand).expander)(cx, it.span, tts)
189177
}
190178
Some(ItemTT(ref expand)) => {
@@ -193,13 +181,9 @@ pub fn expand_item_mac(exts: SyntaxExtensions,
193181
fmt!("macro %s! expects an ident argument",
194182
*extname));
195183
}
196-
cx.bt_push(ExpandedFrom(CallInfo {
197-
call_site: it.span,
198-
callee: NameAndSpan {
199-
name: *extname,
200-
span: (*expand).span
201-
}
202-
}));
184+
cx.bt_push(ExpandedFrom({call_site: it.span,
185+
callie: {name: *extname,
186+
span: (*expand).span}}));
203187
((*expand).expander)(cx, it.span, it.ident, tts)
204188
}
205189
_ => cx.span_fatal(
@@ -244,10 +228,8 @@ pub fn expand_stmt(exts: SyntaxExtensions, cx: ext_ctxt,
244228

245229
Some(NormalTT(
246230
SyntaxExpanderTT{expander: exp, span: exp_sp})) => {
247-
cx.bt_push(ExpandedFrom(CallInfo {
248-
call_site: sp,
249-
callee: NameAndSpan { name: *extname, span: exp_sp }
250-
}));
231+
cx.bt_push(ExpandedFrom(
232+
{call_site: sp, callie: {name: *extname, span: exp_sp}}));
251233
let expanded = match exp(cx, mac.span, tts) {
252234
MRExpr(e) =>
253235
@codemap::spanned { node: stmt_expr(e, cx.next_id()),
@@ -339,7 +321,7 @@ pub fn core_macros() -> ~str {
339321
}";
340322
}
341323

342-
pub fn expand_crate(parse_sess: @mut parse::ParseSess,
324+
pub fn expand_crate(parse_sess: parse::parse_sess,
343325
cfg: ast::crate_cfg, c: @crate) -> @crate {
344326
let exts = syntax_expander_table();
345327
let afp = default_ast_fold();

0 commit comments

Comments
 (0)