Skip to content
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

Bump to stable Rust (1.82) #1075

Merged
merged 4 commits into from
Oct 23, 2024
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
31 changes: 25 additions & 6 deletions mountpoint-s3-crt-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ fn compile_crt(output_dir: &Path) -> PathBuf {

// Statically link all the compiled CRT libraries
for lib in libraries.iter() {
println!("cargo:rustc-link-lib=static={}", lib.library_name);
println!(
"cargo:rustc-link-lib={}={}",
static_link_modifiers_for_lib(&lib.library_name),
lib.library_name
);
}

target_dir
Expand All @@ -301,6 +305,21 @@ fn compile_logging_shim(crt_include_dir: impl AsRef<Path>) {
println!("cargo:rerun-if-changed=src/logging_shim.c");
}

/// Returns kind and modifiers to use while statically linking the given library.
/// Should be used in `cargo:rustc-link-lib`.
fn static_link_modifiers_for_lib(library_name: &str) -> &'static str {
// Up until v1.82, Rust was passing `+whole-archive` linker flag while building the tests.
// That's no longer the case with v1.82 and our tests started to fail with undefined references from `aws-c-common`.
// To preserve this behaviour, we're passing `+whole-archive` explicitly for `aws-c-common`,
// unfortunately we're passing this flag for all builds as there is no way to detect if we're
// building the tests currently, see https://github.com/rust-lang/cargo/issues/1581.
if library_name == "aws-c-common" {
"static:+whole-archive"
} else {
"static"
}
}

/// Build or link to the CRT.
///
/// By default, we build and statically link the CRT libraries embedded in this crate as Git
Expand All @@ -324,13 +343,13 @@ fn main() {
let include_dir = if let Some(path) = get_env("MOUNTPOINT_CRT_LIB_DIR") {
println!("cargo:rustc-link-search=native={path}");

let link_type = match get_env("MOUNTPOINT_CRT_LIB_LINK_STATIC") {
Some(_) => "static",
None => "dylib",
};

let libraries = get_required_libraries(&target_os());
for lib in libraries {
let link_type = match get_env("MOUNTPOINT_CRT_LIB_LINK_STATIC") {
Some(_) => static_link_modifiers_for_lib(&lib.library_name),
None => "dylib",
};

println!("cargo:rustc-link-lib={}={}", link_type, lib.library_name);
}

Expand Down
4 changes: 2 additions & 2 deletions mountpoint-s3/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::backtrace::Backtrace;
use std::fs::{DirBuilder, OpenOptions};
use std::os::unix::fs::DirBuilderExt;
use std::os::unix::prelude::OpenOptionsExt;
use std::panic::{self, PanicInfo};
use std::panic::{self, PanicHookInfo};
use std::path::{Path, PathBuf};
use std::thread;

Expand Down Expand Up @@ -70,7 +70,7 @@ pub fn prepare_log_file_name(log_directory: &Path) -> PathBuf {
log_directory.join(file_name)
}

fn tracing_panic_hook(panic_info: &PanicInfo) {
fn tracing_panic_hook(panic_info: &PanicHookInfo) {
let location = panic_info
.location()
.map(|l| format!("{}", l))
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.81.0"
channel = "stable"
components = ["rust-src"]
Loading