Skip to content

Commit bc786c9

Browse files
committed
---
yaml --- r: 147902 b: refs/heads/try2 c: 3aa19a6 h: refs/heads/master v: v3
1 parent 9c6a1f6 commit bc786c9

File tree

9 files changed

+49
-50
lines changed

9 files changed

+49
-50
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f553701da64dd70d1fa6b757208f012dbad118d7
8+
refs/heads/try2: 3aa19a6b86ef8317cd95fd517dcc24216d857eb1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ pub struct Session_ {
204204
targ_cfg: @config,
205205
opts: @options,
206206
cstore: @metadata::cstore::CStore,
207-
parse_sess: @mut ParseSess,
207+
parse_sess: @ParseSess,
208208
codemap: @codemap::CodeMap,
209209
// For a library crate, this is always none
210210
entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,18 +1429,18 @@ fn decode_item_ast(par_doc: ebml::Doc) -> @ast::item {
14291429
#[cfg(test)]
14301430
trait fake_ext_ctxt {
14311431
fn cfg(&self) -> ast::CrateConfig;
1432-
fn parse_sess(&self) -> @mut parse::ParseSess;
1432+
fn parse_sess(&self) -> @parse::ParseSess;
14331433
fn call_site(&self) -> Span;
14341434
fn ident_of(&self, st: &str) -> ast::Ident;
14351435
}
14361436

14371437
#[cfg(test)]
1438-
type fake_session = @mut parse::ParseSess;
1438+
type fake_session = @parse::ParseSess;
14391439

14401440
#[cfg(test)]
14411441
impl fake_ext_ctxt for fake_session {
14421442
fn cfg(&self) -> ast::CrateConfig { ~[] }
1443-
fn parse_sess(&self) -> @mut parse::ParseSess { *self }
1443+
fn parse_sess(&self) -> @parse::ParseSess { *self }
14441444
fn call_site(&self) -> Span {
14451445
codemap::Span {
14461446
lo: codemap::BytePos(0),

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub fn syntax_expander_table() -> SyntaxEnv {
284284
// when a macro expansion occurs, the resulting nodes have the backtrace()
285285
// -> expn_info of their expansion context stored into their span.
286286
pub struct ExtCtxt {
287-
parse_sess: @mut parse::ParseSess,
287+
parse_sess: @parse::ParseSess,
288288
cfg: ast::CrateConfig,
289289
backtrace: Option<@ExpnInfo>,
290290

@@ -293,7 +293,7 @@ pub struct ExtCtxt {
293293
}
294294

295295
impl ExtCtxt {
296-
pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::CrateConfig)
296+
pub fn new(parse_sess: @parse::ParseSess, cfg: ast::CrateConfig)
297297
-> ExtCtxt {
298298
ExtCtxt {
299299
parse_sess: parse_sess,
@@ -320,7 +320,7 @@ impl ExtCtxt {
320320
}
321321

322322
pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
323-
pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
323+
pub fn parse_sess(&self) -> @parse::ParseSess { self.parse_sess }
324324
pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() }
325325
pub fn call_site(&self) -> Span {
326326
match self.backtrace {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ impl ast_fold for Injector {
889889

890890
// add a bunch of macros as though they were placed at the head of the
891891
// program (ick). This should run before cfg stripping.
892-
pub fn inject_std_macros(parse_sess: @mut parse::ParseSess,
892+
pub fn inject_std_macros(parse_sess: @parse::ParseSess,
893893
cfg: ast::CrateConfig,
894894
c: Crate)
895895
-> Crate {
@@ -939,7 +939,7 @@ impl<'a> ast_fold for MacroExpander<'a> {
939939
}
940940
}
941941

942-
pub fn expand_crate(parse_sess: @mut parse::ParseSess,
942+
pub fn expand_crate(parse_sess: @parse::ParseSess,
943943
cfg: ast::CrateConfig,
944944
c: Crate) -> Crate {
945945
let mut cx = ExtCtxt::new(parse_sess, cfg.clone());

branches/try2/src/libsyntax/ext/tt/macro_parser.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ pub enum named_match {
188188

189189
pub type earley_item = ~MatcherPos;
190190

191-
pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match])
191+
pub fn nameize(p_s: @ParseSess, ms: &[matcher], res: &[@named_match])
192192
-> HashMap<Ident,@named_match> {
193-
fn n_rec(p_s: @mut ParseSess, m: &matcher, res: &[@named_match],
193+
fn n_rec(p_s: @ParseSess, m: &matcher, res: &[@named_match],
194194
ret_val: &mut HashMap<Ident, @named_match>) {
195195
match *m {
196196
codemap::Spanned {node: match_tok(_), .. } => (),
@@ -222,7 +222,7 @@ pub enum parse_result {
222222
}
223223
224224
pub fn parse_or_else(
225-
sess: @mut ParseSess,
225+
sess: @ParseSess,
226226
cfg: ast::CrateConfig,
227227
rdr: @mut reader,
228228
ms: ~[matcher]
@@ -243,12 +243,11 @@ pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool {
243243
}
244244
}
245245
246-
pub fn parse(
247-
sess: @mut ParseSess,
248-
cfg: ast::CrateConfig,
249-
rdr: @mut reader,
250-
ms: &[matcher]
251-
) -> parse_result {
246+
pub fn parse(sess: @ParseSess,
247+
cfg: ast::CrateConfig,
248+
rdr: @mut reader,
249+
ms: &[matcher])
250+
-> parse_result {
252251
let mut cur_eis = ~[];
253252
cur_eis.push(initial_matcher_pos(ms.to_owned(), None, rdr.peek().sp.lo));
254253

branches/try2/src/libsyntax/parse/mod.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ pub struct ParseSess {
4747
included_mod_stack: RefCell<~[Path]>,
4848
}
4949

50-
pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess {
50+
pub fn new_parse_sess(demitter: Option<@Emitter>) -> @ParseSess {
5151
let cm = @CodeMap::new();
52-
@mut ParseSess {
52+
@ParseSess {
5353
cm: cm,
5454
span_diagnostic: mk_span_handler(mk_handler(demitter), cm),
5555
included_mod_stack: RefCell::new(~[]),
@@ -58,8 +58,8 @@ pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess {
5858

5959
pub fn new_parse_sess_special_handler(sh: @mut SpanHandler,
6060
cm: @codemap::CodeMap)
61-
-> @mut ParseSess {
62-
@mut ParseSess {
61+
-> @ParseSess {
62+
@ParseSess {
6363
cm: cm,
6464
span_diagnostic: sh,
6565
included_mod_stack: RefCell::new(~[]),
@@ -74,7 +74,7 @@ pub fn new_parse_sess_special_handler(sh: @mut SpanHandler,
7474
pub fn parse_crate_from_file(
7575
input: &Path,
7676
cfg: ast::CrateConfig,
77-
sess: @mut ParseSess
77+
sess: @ParseSess
7878
) -> ast::Crate {
7979
new_parser_from_file(sess, /*bad*/ cfg.clone(), input).parse_crate_mod()
8080
// why is there no p.abort_if_errors here?
@@ -83,7 +83,7 @@ pub fn parse_crate_from_file(
8383
pub fn parse_crate_attrs_from_file(
8484
input: &Path,
8585
cfg: ast::CrateConfig,
86-
sess: @mut ParseSess
86+
sess: @ParseSess
8787
) -> ~[ast::Attribute] {
8888
let mut parser = new_parser_from_file(sess, cfg, input);
8989
let (inner, _) = parser.parse_inner_attrs_and_next();
@@ -94,7 +94,7 @@ pub fn parse_crate_from_source_str(
9494
name: @str,
9595
source: @str,
9696
cfg: ast::CrateConfig,
97-
sess: @mut ParseSess
97+
sess: @ParseSess
9898
) -> ast::Crate {
9999
let mut p = new_parser_from_source_str(sess,
100100
/*bad*/ cfg.clone(),
@@ -107,7 +107,7 @@ pub fn parse_crate_attrs_from_source_str(
107107
name: @str,
108108
source: @str,
109109
cfg: ast::CrateConfig,
110-
sess: @mut ParseSess
110+
sess: @ParseSess
111111
) -> ~[ast::Attribute] {
112112
let mut p = new_parser_from_source_str(sess,
113113
/*bad*/ cfg.clone(),
@@ -121,7 +121,7 @@ pub fn parse_expr_from_source_str(
121121
name: @str,
122122
source: @str,
123123
cfg: ast::CrateConfig,
124-
sess: @mut ParseSess
124+
sess: @ParseSess
125125
) -> @ast::Expr {
126126
let mut p = new_parser_from_source_str(sess, cfg, name, source);
127127
maybe_aborted(p.parse_expr(), p)
@@ -132,7 +132,7 @@ pub fn parse_item_from_source_str(
132132
source: @str,
133133
cfg: ast::CrateConfig,
134134
attrs: ~[ast::Attribute],
135-
sess: @mut ParseSess
135+
sess: @ParseSess
136136
) -> Option<@ast::item> {
137137
let mut p = new_parser_from_source_str(sess, cfg, name, source);
138138
maybe_aborted(p.parse_item(attrs),p)
@@ -142,7 +142,7 @@ pub fn parse_meta_from_source_str(
142142
name: @str,
143143
source: @str,
144144
cfg: ast::CrateConfig,
145-
sess: @mut ParseSess
145+
sess: @ParseSess
146146
) -> @ast::MetaItem {
147147
let mut p = new_parser_from_source_str(sess, cfg, name, source);
148148
maybe_aborted(p.parse_meta_item(),p)
@@ -153,7 +153,7 @@ pub fn parse_stmt_from_source_str(
153153
source: @str,
154154
cfg: ast::CrateConfig,
155155
attrs: ~[ast::Attribute],
156-
sess: @mut ParseSess
156+
sess: @ParseSess
157157
) -> @ast::Stmt {
158158
let mut p = new_parser_from_source_str(
159159
sess,
@@ -168,7 +168,7 @@ pub fn parse_tts_from_source_str(
168168
name: @str,
169169
source: @str,
170170
cfg: ast::CrateConfig,
171-
sess: @mut ParseSess
171+
sess: @ParseSess
172172
) -> ~[ast::token_tree] {
173173
let mut p = new_parser_from_source_str(
174174
sess,
@@ -192,7 +192,7 @@ pub fn parse_from_source_str<T>(
192192
ss: codemap::FileSubstr,
193193
source: @str,
194194
cfg: ast::CrateConfig,
195-
sess: @mut ParseSess)
195+
sess: @ParseSess)
196196
-> T {
197197
let mut p = new_parser_from_source_substr(sess, cfg, name, ss, source);
198198
let r = f(&mut p);
@@ -203,7 +203,7 @@ pub fn parse_from_source_str<T>(
203203
}
204204

205205
// Create a new parser from a source string
206-
pub fn new_parser_from_source_str(sess: @mut ParseSess,
206+
pub fn new_parser_from_source_str(sess: @ParseSess,
207207
cfg: ast::CrateConfig,
208208
name: @str,
209209
source: @str)
@@ -213,7 +213,7 @@ pub fn new_parser_from_source_str(sess: @mut ParseSess,
213213

214214
// Create a new parser from a source string where the origin
215215
// is specified as a substring of another file.
216-
pub fn new_parser_from_source_substr(sess: @mut ParseSess,
216+
pub fn new_parser_from_source_substr(sess: @ParseSess,
217217
cfg: ast::CrateConfig,
218218
name: @str,
219219
ss: codemap::FileSubstr,
@@ -225,7 +225,7 @@ pub fn new_parser_from_source_substr(sess: @mut ParseSess,
225225
/// Create a new parser, handling errors as appropriate
226226
/// if the file doesn't exist
227227
pub fn new_parser_from_file(
228-
sess: @mut ParseSess,
228+
sess: @ParseSess,
229229
cfg: ast::CrateConfig,
230230
path: &Path
231231
) -> Parser {
@@ -236,7 +236,7 @@ pub fn new_parser_from_file(
236236
/// the file at the given path to the codemap, and return a parser.
237237
/// On an error, use the given span as the source of the problem.
238238
pub fn new_sub_parser_from_file(
239-
sess: @mut ParseSess,
239+
sess: @ParseSess,
240240
cfg: ast::CrateConfig,
241241
path: &Path,
242242
sp: Span
@@ -245,15 +245,15 @@ pub fn new_sub_parser_from_file(
245245
}
246246

247247
/// Given a filemap and config, return a parser
248-
pub fn filemap_to_parser(sess: @mut ParseSess,
248+
pub fn filemap_to_parser(sess: @ParseSess,
249249
filemap: @FileMap,
250250
cfg: ast::CrateConfig) -> Parser {
251251
tts_to_parser(sess,filemap_to_tts(sess,filemap),cfg)
252252
}
253253

254254
// must preserve old name for now, because quote! from the *existing*
255255
// compiler expands into it
256-
pub fn new_parser_from_tts(sess: @mut ParseSess,
256+
pub fn new_parser_from_tts(sess: @ParseSess,
257257
cfg: ast::CrateConfig,
258258
tts: ~[ast::token_tree]) -> Parser {
259259
tts_to_parser(sess,tts,cfg)
@@ -264,7 +264,7 @@ pub fn new_parser_from_tts(sess: @mut ParseSess,
264264

265265
/// Given a session and a path and an optional span (for error reporting),
266266
/// add the path to the session's codemap and return the new filemap.
267-
pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>)
267+
pub fn file_to_filemap(sess: @ParseSess, path: &Path, spanopt: Option<Span>)
268268
-> @FileMap {
269269
let err = |msg: &str| {
270270
match spanopt {
@@ -293,20 +293,20 @@ pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>)
293293

294294
// given a session and a string, add the string to
295295
// the session's codemap and return the new filemap
296-
pub fn string_to_filemap(sess: @mut ParseSess, source: @str, path: @str)
296+
pub fn string_to_filemap(sess: @ParseSess, source: @str, path: @str)
297297
-> @FileMap {
298298
sess.cm.new_filemap(path, source)
299299
}
300300

301301
// given a session and a string and a path and a FileSubStr, add
302302
// the string to the CodeMap and return the new FileMap
303-
pub fn substring_to_filemap(sess: @mut ParseSess, source: @str, path: @str,
303+
pub fn substring_to_filemap(sess: @ParseSess, source: @str, path: @str,
304304
filesubstr: FileSubstr) -> @FileMap {
305305
sess.cm.new_filemap_w_substr(path,filesubstr,source)
306306
}
307307

308308
// given a filemap, produce a sequence of token-trees
309-
pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
309+
pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap)
310310
-> ~[ast::token_tree] {
311311
// it appears to me that the cfg doesn't matter here... indeed,
312312
// parsing tt's probably shouldn't require a parser at all.
@@ -317,7 +317,7 @@ pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
317317
}
318318

319319
// given tts and cfg, produce a parser
320-
pub fn tts_to_parser(sess: @mut ParseSess,
320+
pub fn tts_to_parser(sess: @ParseSess,
321321
tts: ~[ast::token_tree],
322322
cfg: ast::CrateConfig) -> Parser {
323323
let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts);

branches/try2/src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ struct ParsedItemsAndViewItems {
286286

287287
/* ident is handled by common.rs */
288288

289-
pub fn Parser(sess: @mut ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
290-
-> Parser {
289+
pub fn Parser(sess: @ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
290+
-> Parser {
291291
let tok0 = rdr.next_token();
292292
let interner = get_ident_interner();
293293
let span = tok0.sp;
@@ -324,7 +324,7 @@ pub fn Parser(sess: @mut ParseSess, cfg: ast::CrateConfig, rdr: @mut reader)
324324
}
325325

326326
pub struct Parser {
327-
sess: @mut ParseSess,
327+
sess: @ParseSess,
328328
cfg: CrateConfig,
329329
// the current token:
330330
token: token::Token,

branches/try2/src/libsyntax/util/parser_testing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use parse::token;
1717

1818
// map a string to tts, using a made-up filename: return both the token_trees
1919
// and the ParseSess
20-
pub fn string_to_tts_and_sess (source_str : @str) -> (~[ast::token_tree],@mut ParseSess) {
20+
pub fn string_to_tts_and_sess (source_str : @str) -> (~[ast::token_tree],@ParseSess) {
2121
let ps = new_parse_sess(None);
2222
(filemap_to_tts(ps,string_to_filemap(ps,source_str,@"bogofile")),ps)
2323
}
@@ -28,7 +28,7 @@ pub fn string_to_tts(source_str : @str) -> ~[ast::token_tree] {
2828
tts
2929
}
3030

31-
pub fn string_to_parser_and_sess(source_str: @str) -> (Parser,@mut ParseSess) {
31+
pub fn string_to_parser_and_sess(source_str: @str) -> (Parser,@ParseSess) {
3232
let ps = new_parse_sess(None);
3333
(new_parser_from_source_str(ps,~[],@"bogofile",source_str),ps)
3434
}
@@ -54,7 +54,7 @@ pub fn string_to_crate (source_str : @str) -> ast::Crate {
5454
}
5555

5656
// parse a string, return a crate and the ParseSess
57-
pub fn string_to_crate_and_sess (source_str : @str) -> (ast::Crate,@mut ParseSess) {
57+
pub fn string_to_crate_and_sess (source_str : @str) -> (ast::Crate,@ParseSess) {
5858
let (mut p,ps) = string_to_parser_and_sess(source_str);
5959
(p.parse_crate_mod(),ps)
6060
}

0 commit comments

Comments
 (0)