Skip to content

Commit 5cea7db

Browse files
committed
auto merge of #10915 : alexcrichton/rust/fixes, r=ILyoan
Just a little cleanup.
2 parents f43402f + c11f290 commit 5cea7db

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

src/librustc/middle/entry.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use driver::session;
1313
use driver::session::Session;
14-
use syntax::abi;
1514
use syntax::ast::{Crate, NodeId, item, item_fn};
1615
use syntax::ast_map;
1716
use syntax::attr;
@@ -46,10 +45,7 @@ impl Visitor<()> for EntryContext {
4645
}
4746

4847
pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map) {
49-
50-
// FIXME #4404 android JNI hacks
51-
if *session.building_library &&
52-
session.targ_cfg.os != abi::OsAndroid {
48+
if *session.building_library {
5349
// No need to find a main function
5450
return;
5551
}
@@ -149,10 +145,6 @@ fn configure_main(this: &mut EntryContext) {
149145
}
150146
}
151147
this.session.abort_if_errors();
152-
} else {
153-
// If we *are* building a library, then we're on android where we still might
154-
// optionally want to translate main $4404
155-
assert_eq!(this.session.targ_cfg.os, abi::OsAndroid);
156148
}
157149
}
158150
}

src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ use syntax::parse::token::{special_idents};
8484
use syntax::print::pprust::stmt_to_str;
8585
use syntax::{ast, ast_util, codemap, ast_map};
8686
use syntax::attr::AttrMetaMethods;
87-
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32, OsAndroid};
87+
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
8888
use syntax::visit;
8989
use syntax::visit::Visitor;
9090

@@ -2289,11 +2289,7 @@ fn finish_register_fn(ccx: @mut CrateContext, sp: Span, sym: ~str, node_id: ast:
22892289
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
22902290
}
22912291

2292-
// FIXME #4404 android JNI hacks
2293-
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2294-
(*ccx.sess.building_library &&
2295-
ccx.sess.targ_cfg.os == OsAndroid));
2296-
if is_entry {
2292+
if is_entry_fn(&ccx.sess, node_id) && !*ccx.sess.building_library {
22972293
create_entry_wrapper(ccx, sp, llfn);
22982294
}
22992295
}
@@ -2361,13 +2357,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23612357
let llfty = Type::func([ccx.int_type, Type::i8().ptr_to().ptr_to()],
23622358
&ccx.int_type);
23632359

2364-
// FIXME #4404 android JNI hacks
2365-
let main_name = if *ccx.sess.building_library {
2366-
"amain"
2367-
} else {
2368-
"main"
2369-
};
2370-
let llfn = decl_cdecl_fn(ccx.llmod, main_name, llfty);
2360+
let llfn = decl_cdecl_fn(ccx.llmod, "main", llfty);
23712361
let llbb = "top".with_c_str(|buf| {
23722362
unsafe {
23732363
llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)
@@ -3199,14 +3189,13 @@ pub fn trans_crate(sess: session::Session,
31993189
}).to_owned_vec();
32003190

32013191
// Make sure that some other crucial symbols are not eliminated from the
3202-
// module. This includes the main function (main/amain elsewhere), the crate
3203-
// map (used for debug log settings and I/O), and finally the curious
3204-
// rust_stack_exhausted symbol. This symbol is required for use by the
3205-
// libmorestack library that we link in, so we must ensure that this symbol
3206-
// is not internalized (if defined in the crate).
3192+
// module. This includes the main function, the crate map (used for debug
3193+
// log settings and I/O), and finally the curious rust_stack_exhausted
3194+
// symbol. This symbol is required for use by the libmorestack library that
3195+
// we link in, so we must ensure that this symbol is not internalized (if
3196+
// defined in the crate).
32073197
reachable.push(ccx.crate_map_name.to_owned());
32083198
reachable.push(~"main");
3209-
reachable.push(~"amain");
32103199
reachable.push(~"rust_stack_exhausted");
32113200

32123201
return CrateTranslation {

src/libsyntax/parse/obsolete.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub enum ObsoleteSyntax {
4444
ObsoleteVecDotDotWildcard,
4545
ObsoleteBoxedClosure,
4646
ObsoleteClosureType,
47+
ObsoleteMultipleImport,
4748
}
4849

4950
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -140,6 +141,10 @@ impl ParserObsoleteMethods for Parser {
140141
"closures are now written `|A| -> B` rather than `&fn(A) -> \
141142
B`."
142143
),
144+
ObsoleteMultipleImport => (
145+
"multiple imports",
146+
"only one import is allowed per `use` statement"
147+
),
143148
};
144149

145150
self.report(sp, kind, kind_str, desc);

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4968,6 +4968,7 @@ impl Parser {
49684968
let mut vp = ~[self.parse_view_path()];
49694969
while *self.token == token::COMMA {
49704970
self.bump();
4971+
self.obsolete(*self.last_span, ObsoleteMultipleImport);
49714972
vp.push(self.parse_view_path());
49724973
}
49734974
return vp;

0 commit comments

Comments
 (0)