Skip to content

Commit

Permalink
fix 10468, propagate optimization level as rustc::driver::session::Op…
Browse files Browse the repository at this point in the history
…tLevel
  • Loading branch information
itdaniher committed Nov 17, 2013
1 parent 90754ae commit b60b411
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/librustpkg/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Context data structure used by rustpkg

use extra::workcache;
use rustc::driver::session::{OptLevel, No};
use rustc::driver::session;

use std::hashmap::HashSet;

Expand Down Expand Up @@ -88,7 +88,7 @@ pub struct RustcFlags {
// Extra arguments to pass to rustc with the --link-args flag
link_args: Option<~str>,
// Optimization level. 0 = default. -O = 2.
optimization_level: OptLevel,
optimization_level: session::OptLevel,
// True if the user passed in --save-temps
save_temps: bool,
// Target (defaults to rustc's default target)
Expand Down Expand Up @@ -224,7 +224,7 @@ impl RustcFlags {
linker: None,
link_args: None,
compile_upto: Nothing,
optimization_level: No,
optimization_level: session::Default,
save_temps: false,
target: None,
target_cpu: None,
Expand Down
5 changes: 4 additions & 1 deletion src/librustpkg/package_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ use workcache_support::{digest_only_date, digest_file_with_date, crate_tag};
use extra::workcache;
use extra::treemap::TreeMap;

use rustc::driver::session;

// An enumeration of the unpacked source of a package workspace.
// This contains a list of files found in the source workspace.
#[deriving(Clone)]
Expand Down Expand Up @@ -425,6 +427,7 @@ impl PkgSrc {
}
debug!("Compiling crate {}; its output will be in {}",
subpath.display(), sub_dir.display());
let opt: session::OptLevel = subcx.context.rustc_flags.optimization_level;
let result = compile_crate(&subcx,
exec,
&id,
Expand All @@ -433,7 +436,7 @@ impl PkgSrc {
&mut (sub_deps.clone()),
sub_flags,
subcfgs,
false,
opt,
what);
// XXX: result is an Option<Path>. The following code did not take that
// into account. I'm not sure if the workcache really likes seeing the
Expand Down
6 changes: 3 additions & 3 deletions src/librustpkg/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub fn compile_input(context: &BuildContext,
deps: &mut DepMap,
flags: &[~str],
cfgs: &[~str],
opt: bool,
opt: session::OptLevel,
what: OutputType) -> Option<Path> {
assert!(in_file.component_iter().nth(1).is_some());
let input = driver::file_input(in_file.clone());
Expand Down Expand Up @@ -241,7 +241,7 @@ pub fn compile_input(context: &BuildContext,

let options = @session::options {
crate_type: crate_type,
optimize: if opt { session::Aggressive } else { session::No },
optimize: opt,
test: what == Test || what == Bench,
maybe_sysroot: Some(sysroot_to_use),
addl_lib_search_paths: @mut context.additional_library_paths(),
Expand Down Expand Up @@ -408,7 +408,7 @@ pub fn compile_crate(ctxt: &BuildContext,
deps: &mut DepMap,
flags: &[~str],
cfgs: &[~str],
opt: bool,
opt: session::OptLevel,
what: OutputType) -> Option<Path> {
debug!("compile_crate: crate={}, workspace={}", crate.display(), workspace.display());
debug!("compile_crate: short_name = {}, flags =...", pkg_id.to_str());
Expand Down

5 comments on commit b60b411

@bors
Copy link
Contributor

@bors bors commented on b60b411 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on b60b411 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging itdaniher/rust/master = b60b411 into auto

@bors
Copy link
Contributor

@bors bors commented on b60b411 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itdaniher/rust/master = b60b411 merged ok, testing candidate = 727b70d

@bors
Copy link
Contributor

@bors bors commented on b60b411 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on b60b411 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 727b70d

Please sign in to comment.