Skip to content
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
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ dependencies = [

[[package]]
name = "gccjit"
version = "5.0.0"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d4c19a75fd8c674bbcd459fc8235ff38f8e5219c07fc3b022556fd28d16c909"
checksum = "5bb358d2563af5e32af92620915e6b05839ae60645343473735619441f45eb04"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "3.0.0"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54c3a46c818a4b7d6c8d572ed0f3513a091dcf8e8dbafbb58381c6062eaef942"
checksum = "2389fb01673e9cc63684d996a58079edccc5de89008274f3be59f1b16ac1f017"
dependencies = [
"libc",
]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default = ["master"]
[dependencies]
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
tempfile = "3.20"
gccjit = { version = "5.0.0", features = ["dlopen"] }
gccjit = { version = "6.0.0", features = ["dlopen"] }
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs", branch = "error-dlopen", features = ["dlopen"] }

# Local copy.
Expand Down
2 changes: 1 addition & 1 deletion libgccjit.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3498409672c805d51b46faaa4a14f8682de8e1bf
201ca90ac810d1c6509c252cc9c87d3ace0661d7
9 changes: 5 additions & 4 deletions src/gcc_util.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::collections::HashSet;
use std::env;

Expand Down Expand Up @@ -119,22 +120,22 @@ fn arch_to_gcc(name: &str) -> &str {
}
}

fn handle_native(name: &str) -> &str {
fn handle_native(name: &str) -> Cow<'_, str> {
if name != NATIVE_CPU {
return arch_to_gcc(name);
return arch_to_gcc(name).into();
}

#[cfg(feature = "master")]
{
// Get the native arch.
let context = Context::default();
context.get_target_info().arch().unwrap().to_str().unwrap()
Cow::Owned(context.get_target_info().arch().to_str().unwrap().to_string())
}
#[cfg(not(feature = "master"))]
unimplemented!();
}

pub fn target_cpu(sess: &Session) -> &str {
pub fn target_cpu(sess: &Session) -> Cow<'_, str> {
match sess.opts.cg.target_cpu {
Some(ref name) => handle_native(name),
None => handle_native(sess.target.cpu.as_ref()),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl CodegenBackend for GccCodegenBackend {
}

fn target_cpu(&self, sess: &Session) -> String {
target_cpu(sess).to_owned()
target_cpu(sess).into_owned()
}

fn codegen_crate(&self, tcx: TyCtxt<'_>) -> Box<dyn Any> {
Expand Down
Loading