Skip to content

Commit 3a894de

Browse files
committed
---
yaml --- r: 81831 b: refs/heads/master c: 0269850 h: refs/heads/master i: 81829: 67999d4 81827: f43651d 81823: f92bd6d v: v3
1 parent eba6917 commit 3a894de

File tree

8 files changed

+85
-44
lines changed

8 files changed

+85
-44
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5867bbd794785c4ea51becbc5d008549b03dcf16
2+
refs/heads/master: 0269850cc22a9b09f08584d312001afd8887e89b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729

trunk/src/librust/rust.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ extern mod rustc;
2828
use std::io;
2929
use std::os;
3030
use std::run;
31+
use std::libc::exit;
3132

3233
enum ValidUsage {
3334
Valid(int), Invalid
@@ -234,7 +235,7 @@ pub fn main() {
234235

235236
if (os_args.len() > 1 && (os_args[1] == ~"-v" || os_args[1] == ~"--version")) {
236237
rustc::version(os_args[0]);
237-
return;
238+
unsafe { exit(0); }
238239
}
239240

240241
let args = os_args.tail();
@@ -244,11 +245,8 @@ pub fn main() {
244245
for command in r.iter() {
245246
let result = do_command(command, args.tail());
246247
match result {
247-
Valid(exit_code) => {
248-
os::set_exit_status(exit_code);
249-
return;
250-
}
251-
_ => loop
248+
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
249+
_ => loop
252250
}
253251
}
254252
}

trunk/src/librustc/middle/trans/base.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,23 +2321,6 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
23212321
}
23222322
}
23232323

2324-
fn finish_register_fn(ccx: @mut CrateContext, sp: Span, sym: ~str, node_id: ast::NodeId,
2325-
llfn: ValueRef) {
2326-
ccx.item_symbols.insert(node_id, sym);
2327-
2328-
if !*ccx.sess.building_library {
2329-
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
2330-
}
2331-
2332-
// FIXME #4404 android JNI hacks
2333-
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2334-
(*ccx.sess.building_library &&
2335-
ccx.sess.targ_cfg.os == session::OsAndroid));
2336-
if is_entry {
2337-
create_entry_wrapper(ccx, sp, llfn);
2338-
}
2339-
}
2340-
23412324
pub fn register_fn(ccx: @mut CrateContext,
23422325
sp: Span,
23432326
sym: ~str,
@@ -2353,7 +2336,15 @@ pub fn register_fn(ccx: @mut CrateContext,
23532336
};
23542337

23552338
let llfn = decl_rust_fn(ccx, f.sig.inputs, f.sig.output, sym);
2356-
finish_register_fn(ccx, sp, sym, node_id, llfn);
2339+
ccx.item_symbols.insert(node_id, sym);
2340+
2341+
// FIXME #4404 android JNI hacks
2342+
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2343+
(*ccx.sess.building_library &&
2344+
ccx.sess.targ_cfg.os == session::OsAndroid));
2345+
if is_entry {
2346+
create_entry_wrapper(ccx, sp, llfn);
2347+
}
23572348
llfn
23582349
}
23592350

@@ -2370,7 +2361,15 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext,
23702361
ast_map::path_to_str(item_path(ccx, &node_id), token::get_ident_interner()));
23712362

23722363
let llfn = decl_fn(ccx.llmod, sym, cc, fn_ty);
2373-
finish_register_fn(ccx, sp, sym, node_id, llfn);
2364+
ccx.item_symbols.insert(node_id, sym);
2365+
2366+
// FIXME #4404 android JNI hacks
2367+
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2368+
(*ccx.sess.building_library &&
2369+
ccx.sess.targ_cfg.os == session::OsAndroid));
2370+
if is_entry {
2371+
create_entry_wrapper(ccx, sp, llfn);
2372+
}
23742373
llfn
23752374
}
23762375

trunk/src/libsyntax/ast_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ pub fn new_mark(m:Mrk, tail:SyntaxContext) -> SyntaxContext {
740740
}
741741

742742
// Extend a syntax context with a given mark and table
743-
// FIXME #4536 : currently pub to allow testing
743+
// FIXME #8215 : currently pub to allow testing
744744
pub fn new_mark_internal(m:Mrk, tail:SyntaxContext,table:&mut SCTable)
745745
-> SyntaxContext {
746746
let key = (tail,m);
@@ -769,7 +769,7 @@ pub fn new_rename(id:Ident, to:Name, tail:SyntaxContext) -> SyntaxContext {
769769
}
770770
771771
// Extend a syntax context with a given rename and sctable
772-
// FIXME #4536 : currently pub to allow testing
772+
// FIXME #8215 : currently pub to allow testing
773773
pub fn new_rename_internal(id:Ident, to:Name, tail:SyntaxContext, table: &mut SCTable)
774774
-> SyntaxContext {
775775
let key = (tail,id,to);
@@ -792,7 +792,7 @@ pub fn new_rename_internal(id:Ident, to:Name, tail:SyntaxContext, table: &mut SC
792792
793793
/// Make a fresh syntax context table with EmptyCtxt in slot zero
794794
/// and IllegalCtxt in slot one.
795-
// FIXME #4536 : currently pub to allow testing
795+
// FIXME #8215 : currently pub to allow testing
796796
pub fn new_sctable_internal() -> SCTable {
797797
SCTable {
798798
table: ~[EmptyCtxt,IllegalCtxt],
@@ -834,7 +834,7 @@ pub fn mtwt_resolve(id : Ident) -> Name {
834834
resolve_internal(id, get_sctable(), get_resolve_table())
835835
}
836836
837-
// FIXME #4536: must be pub for testing
837+
// FIXME #8215: must be pub for testing
838838
pub type ResolveTable = HashMap<(Name,SyntaxContext),Name>;
839839
840840
// okay, I admit, putting this in TLS is not so nice:
@@ -853,7 +853,7 @@ pub fn get_resolve_table() -> @mut ResolveTable {
853853
854854
// Resolve a syntax object to a name, per MTWT.
855855
// adding memoization to possibly resolve 500+ seconds in resolve for librustc (!)
856-
// FIXME #4536 : currently pub to allow testing
856+
// FIXME #8215 : currently pub to allow testing
857857
pub fn resolve_internal(id : Ident,
858858
table : &mut SCTable,
859859
resolve_table : &mut ResolveTable) -> Name {

trunk/src/libsyntax/ext/expand.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,9 +1640,10 @@ mod test {
16401640
macro_rules! user(($x:ident) => ({letty!($x); $x}))
16411641
fn main() -> int {user!(z)}",
16421642
~[~[0]], false),
1643-
// FIXME #8062: this test exposes a *potential* bug; our system does
1644-
// not behave exactly like MTWT, but I haven't thought of a way that
1645-
// this could cause a bug in Rust, yet.
1643+
// no longer a fixme #8062: this test exposes a *potential* bug; our system does
1644+
// not behave exactly like MTWT, but a conversation with Matthew Flatt
1645+
// suggests that this can only occur in the presence of local-expand, which
1646+
// we have no plans to support.
16461647
// ("fn main() {let hrcoo = 19; macro_rules! getx(()=>(hrcoo)); getx!();}",
16471648
// ~[~[0]], true)
16481649
// FIXME #6994: the next string exposes the bug referred to in issue 6994, so I'm
@@ -1655,6 +1656,7 @@ mod test {
16551656
// fn a(){g!(z)}"
16561657
// create a really evil test case where a $x appears inside a binding of $x
16571658
// but *shouldnt* bind because it was inserted by a different macro....
1659+
// can't write this test case until we have macro-generating macros.
16581660
];
16591661
for (idx,s) in tests.iter().enumerate() {
16601662
run_renaming_test(s,idx);

trunk/src/libsyntax/parse/lexer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,6 @@ fn consume_whitespace(rdr: @mut StringReader) {
868868
mod test {
869869
use super::*;
870870

871-
use ast;
872871
use codemap::{BytePos, CodeMap, Span};
873872
use diagnostic;
874873
use parse::token;

trunk/src/libsyntax/parse/mod.rs

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,10 @@ mod test {
324324
use abi;
325325
use parse::parser::Parser;
326326
use parse::token::{str_to_ident};
327-
use util::parser_testing::{string_to_tts_and_sess, string_to_parser};
327+
use util::parser_testing::{string_to_tts, string_to_parser};
328328
use util::parser_testing::{string_to_expr, string_to_item};
329329
use util::parser_testing::string_to_stmt;
330330

331-
// map a string to tts, return the tt without its parsesess
332-
fn string_to_tts_only(source_str : @str) -> ~[ast::token_tree] {
333-
let (tts,_ps) = string_to_tts_and_sess(source_str);
334-
tts
335-
}
336-
337-
338331
#[cfg(test)] fn to_json_str<E : Encodable<extra::json::Encoder>>(val: @E) -> ~str {
339332
do io::with_str_writer |writer| {
340333
let mut encoder = extra::json::Encoder(writer);
@@ -395,8 +388,53 @@ mod test {
395388
string_to_expr(@"::abc::def::return");
396389
}
397390

391+
// check the token-tree-ization of macros
392+
#[test] fn string_to_tts_macro () {
393+
let tts = string_to_tts(@"macro_rules! zip (($a)=>($a))");
394+
match tts {
395+
[ast::tt_tok(_,_),
396+
ast::tt_tok(_,token::NOT),
397+
ast::tt_tok(_,_),
398+
ast::tt_delim(delim_elts)] =>
399+
match *delim_elts {
400+
[ast::tt_tok(_,token::LPAREN),
401+
ast::tt_delim(first_set),
402+
ast::tt_tok(_,token::FAT_ARROW),
403+
ast::tt_delim(second_set),
404+
ast::tt_tok(_,token::RPAREN)] =>
405+
match *first_set {
406+
[ast::tt_tok(_,token::LPAREN),
407+
ast::tt_tok(_,token::DOLLAR),
408+
ast::tt_tok(_,_),
409+
ast::tt_tok(_,token::RPAREN)] =>
410+
match *second_set {
411+
[ast::tt_tok(_,token::LPAREN),
412+
ast::tt_tok(_,token::DOLLAR),
413+
ast::tt_tok(_,_),
414+
ast::tt_tok(_,token::RPAREN)] =>
415+
assert_eq!("correct","correct"),
416+
_ => assert_eq!("wrong 4","correct")
417+
},
418+
_ => {
419+
error!("failing value 3: %?",first_set);
420+
assert_eq!("wrong 3","correct")
421+
}
422+
},
423+
_ => {
424+
error!("failing value 2: %?",delim_elts);
425+
assert_eq!("wrong","correct");
426+
}
427+
428+
},
429+
_ => {
430+
error!("failing value: %?",tts);
431+
assert_eq!("wrong 1","correct");
432+
}
433+
}
434+
}
435+
398436
#[test] fn string_to_tts_1 () {
399-
let (tts,_ps) = string_to_tts_and_sess(@"fn a (b : int) { b; }");
437+
let tts = string_to_tts(@"fn a (b : int) { b; }");
400438
assert_eq!(to_json_str(@tts),
401439
~"[\
402440
{\

trunk/src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,6 +2035,11 @@ impl Parser {
20352035

20362036
// parse a single token tree from the input.
20372037
pub fn parse_token_tree(&self) -> token_tree {
2038+
// FIXME #6994: currently, this is too eager. It
2039+
// parses token trees but also identifies tt_seq's
2040+
// and tt_nonterminals; it's too early to know yet
2041+
// whether something will be a nonterminal or a seq
2042+
// yet.
20382043
maybe_whole!(deref self, nt_tt);
20392044

20402045
// this is the fall-through for the 'match' below.

0 commit comments

Comments
 (0)