Skip to content

Rollup of 8 pull requests #122778

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5fd4a84
std: simplify key-based thread locals
joboet Mar 14, 2024
3dfd0fd
Report arm intersections
Nadrieril Mar 17, 2024
e4487ad
Improve the `WitnessPat: Debug` impl
Nadrieril Mar 4, 2024
d697dd4
Add a crate-custom test harness
Nadrieril Mar 4, 2024
45cb9d8
Add regression test for #107495
bjorn3 Mar 19, 2024
2a805f5
Use the default file permissions when writing
bjorn3 Mar 19, 2024
a2c74b8
SeqCst->Relaxed in doc examples.
m-ou-se Mar 19, 2024
5e4cc6f
SeqCst->Relaxed in panic_unwind/emcc.
m-ou-se Mar 19, 2024
bf3debe
SeqCst->Relaxed for proc_macro bridge counter.
m-ou-se Mar 19, 2024
904fef0
SeqCst->{Release,Acquire} for alloc error hook.
m-ou-se Mar 19, 2024
9f25a04
SeqCst->Relaxed for FIRST_PANIC.
m-ou-se Mar 19, 2024
eb96698
SeqCst->{Release,Acquire} in xous mutex.
m-ou-se Mar 19, 2024
516684c
Use less restricted memory ordering in thread_parking::pthread.
m-ou-se Mar 19, 2024
e43aef0
SeqCst->{Release,Acquire} in sys_common::thread_local_key.
m-ou-se Mar 19, 2024
46bb073
SeqCst->{Release,Acquire} for wasm DropLock.
m-ou-se Mar 19, 2024
60ad490
SeqCst->Relaxed in pal::windows::pipe.
m-ou-se Mar 19, 2024
69a4d77
SeqCst->{Release,Acquire} for xous DropLock.
m-ou-se Mar 19, 2024
5a594f7
SeqCst->Relaxed for xous set_nonblocking.
m-ou-se Mar 19, 2024
75a5196
use more accurate terminology
tshepang Mar 19, 2024
70206f0
coverage: Regression test for ICE triggered by self-loops
Zalathar Mar 20, 2024
85bec7a
coverage: Remove incorrect assertions from counter allocation
Zalathar Mar 20, 2024
2f21e4f
coverage: Tidy imports in `rustc_mir_transform::coverage::counters`
Zalathar Mar 20, 2024
92f668c
Add usize::MAX arg tests for Vec
workingjubilee Mar 20, 2024
8b519f9
Use less restricted memory ordering in xous::thread_local_key.
m-ou-se Mar 19, 2024
b45a725
SeqCst->Relaxed in std::net::test.
m-ou-se Mar 19, 2024
acddc55
SeqCst->Relaxed in thread local test.
m-ou-se Mar 19, 2024
3462175
SeqCst->Relaxed in condvar test.
m-ou-se Mar 19, 2024
98e6655
Rename `hir::Let` into `hir::LetExpr`
GuillaumeGomez Mar 20, 2024
e4037f1
Rollup merge of #122494 - joboet:simplify_key_tls, r=m-ou-se
GuillaumeGomez Mar 20, 2024
fd0feaa
Rollup merge of #122644 - Nadrieril:complexity-tests, r=compiler-errors
GuillaumeGomez Mar 20, 2024
04fae8c
Rollup merge of #122723 - bjorn3:archive_writer_fixes, r=nnethercote
GuillaumeGomez Mar 20, 2024
87aac9d
Rollup merge of #122729 - m-ou-se:relax, r=Amanieu
GuillaumeGomez Mar 20, 2024
319c33f
Rollup merge of #122740 - tshepang:patch-1, r=clubby789
GuillaumeGomez Mar 20, 2024
de64fd9
Rollup merge of #122764 - Zalathar:loopy, r=oli-obk
GuillaumeGomez Mar 20, 2024
b2d78a9
Rollup merge of #122765 - workingjubilee:test-for-vec-handling-usize-…
GuillaumeGomez Mar 20, 2024
dd0d8cd
Rollup merge of #122776 - GuillaumeGomez:rename-hir-let, r=oli-obk
GuillaumeGomez Mar 20, 2024
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
37 changes: 21 additions & 16 deletions compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use object::read::macho::FatArch;
use tempfile::Builder as TempFileBuilder;

use std::error::Error;
use std::fs::File;
use std::fs::{self, File};
use std::io::{self, Write};
use std::path::{Path, PathBuf};

Expand Down Expand Up @@ -276,29 +276,34 @@ impl<'a> ArArchiveBuilder<'a> {
// This prevents programs (including rustc) from attempting to read a partial archive.
// It also enables writing an archive with the same filename as a dependency on Windows as
// required by a test.
let mut archive_tmpfile = TempFileBuilder::new()
// The tempfile crate currently uses 0o600 as mode for the temporary files and directories
// it creates. We need it to be the default mode for back compat reasons however. (See
// #107495) To handle this we are telling tempfile to create a temporary directory instead
// and then inside this directory create a file using File::create.
let archive_tmpdir = TempFileBuilder::new()
.suffix(".temp-archive")
.tempfile_in(output.parent().unwrap_or_else(|| Path::new("")))
.map_err(|err| io_error_context("couldn't create a temp file", err))?;

write_archive_to_stream(
archive_tmpfile.as_file_mut(),
&entries,
true,
archive_kind,
true,
false,
)?;
.tempdir_in(output.parent().unwrap_or_else(|| Path::new("")))
.map_err(|err| {
io_error_context("couldn't create a directory for the temp file", err)
})?;
let archive_tmpfile_path = archive_tmpdir.path().join("tmp.a");
let mut archive_tmpfile = File::create_new(&archive_tmpfile_path)
.map_err(|err| io_error_context("couldn't create the temp file", err))?;

write_archive_to_stream(&mut archive_tmpfile, &entries, true, archive_kind, true, false)?;
drop(archive_tmpfile);

let any_entries = !entries.is_empty();
drop(entries);
// Drop src_archives to unmap all input archives, which is necessary if we want to write the
// output archive to the same location as an input archive on Windows.
drop(self.src_archives);

archive_tmpfile
.persist(output)
.map_err(|err| io_error_context("failed to rename archive file", err.error))?;
fs::rename(archive_tmpfile_path, output)
.map_err(|err| io_error_context("failed to rename archive file", err))?;
archive_tmpdir
.close()
.map_err(|err| io_error_context("failed to remove temporary directory", err))?;

Ok(any_entries)
}
Expand Down
1 change: 1 addition & 0 deletions tests/run-make/issue-107495-archive-permissions/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty
22 changes: 22 additions & 0 deletions tests/run-make/issue-107495-archive-permissions/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extern crate run_make_support;

use run_make_support::{aux_build, out_dir};
use std::fs;
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
use std::path::Path;

fn main() {
aux_build().arg("foo.rs").run();
verify(&out_dir().join("libfoo.rlib"));
}

fn verify(path: &Path) {
let perm = fs::metadata(path).unwrap().permissions();

assert!(!perm.readonly());

// Check that the file is readable for everyone
#[cfg(unix)]
assert_eq!(perm.mode(), 0o100664);
}