Skip to content

Commit

Permalink
Suppress an unnecessary warning and fix an incorrect warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Mar 15, 2021
1 parent afc529d commit 154668b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib.rs
Expand Up @@ -224,8 +224,10 @@ pub struct CraneliftCodegenBackend {

impl CodegenBackend for CraneliftCodegenBackend {
fn init(&self, sess: &Session) {
if sess.lto() != rustc_session::config::Lto::No && sess.opts.cg.embed_bitcode {
sess.warn("LTO is not supported. You may get a linker error.");
use rustc_session::config::Lto;
match sess.lto() {
Lto::No | Lto::ThinLocal => {}
Lto::Thin | Lto::Fat => sess.warn("LTO is not supported. You may get a linker error."),
}
}

Expand Down Expand Up @@ -320,12 +322,9 @@ fn build_isa(sess: &Session) -> Box<dyn isa::TargetIsa + 'static> {
flags_builder.set("opt_level", "none").unwrap();
}
OptLevel::Less | OptLevel::Default => {}
OptLevel::Aggressive => {
OptLevel::Size | OptLevel::SizeMin | OptLevel::Aggressive => {
flags_builder.set("opt_level", "speed_and_size").unwrap();
}
OptLevel::Size | OptLevel::SizeMin => {
sess.warn("Optimizing for size is not supported. Just ignoring the request");
}
}

let flags = settings::Flags::new(flags_builder);
Expand Down

0 comments on commit 154668b

Please sign in to comment.