Skip to content

Commit

Permalink
Do not fail if --emit≠link and there’s no main fn
Browse files Browse the repository at this point in the history
Fixes #21813
  • Loading branch information
nagisa committed Feb 7, 2015
1 parent e62fec3 commit b510b90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/librustc/middle/entry.rs
Expand Up @@ -50,7 +50,10 @@ pub fn find_entry_point(session: &Session, ast_map: &ast_map::Map) {
let any_exe = session.crate_types.borrow().iter().any(|ty| {
*ty == config::CrateTypeExecutable
});
if !any_exe {
let emit_link = session.opts.output_types.iter().any(|ty| {
*ty == config::OutputTypeExe
});
if !any_exe || !emit_link {
// No need to find a main function
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/session/config.rs
Expand Up @@ -82,7 +82,7 @@ pub struct Options {
pub debuginfo: DebugInfoLevel,
pub lint_opts: Vec<(String, lint::Level)>,
pub describe_lints: bool,
pub output_types: Vec<OutputType> ,
pub output_types: Vec<OutputType>,
// This was mutable for rustpkg, which updates search paths based on the
// parsed code. It remains mutable in case its replacements wants to use
// this.
Expand Down

0 comments on commit b510b90

Please sign in to comment.