Skip to content

Fix for Rustpkg Opt Settings #10526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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