1
Fork 0

Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #98211 (Implement `fs::get_path` for FreeBSD.)
 - #99353 (Slightly improve mismatched GAT where clause error)
 - #99593 (Suggest removing the tuple struct field for the unwrapped value)
 - #99615 (Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`)
 - #99711 (Remove reachable coverage without counters)
 - #99718 (Avoid `&str`/`Symbol` to `String` conversions)
 - #99720 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-07-26 04:28:41 +00:00
commit b629c85bd7
74 changed files with 843 additions and 550 deletions

View file

@ -86,7 +86,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
let mut entries = Vec::new();
for (entry_name, entry) in self.entries {
for (mut entry_name, entry) in self.entries {
// FIXME only read the symbol table of the object files to avoid having to keep all
// object files in memory at once, or read them twice.
let data = match entry {
@ -109,6 +109,23 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
};
if !self.no_builtin_ranlib {
if symbol_table.contains_key(&entry_name) {
// The ar crate can't handle creating a symbol table in case of multiple archive
// members with the same name. Work around this by prepending a number until we
// get a unique name.
for i in 1.. {
let new_name = format!("{}_", i)
.into_bytes()
.into_iter()
.chain(entry_name.iter().copied())
.collect::<Vec<_>>();
if !symbol_table.contains_key(&new_name) {
entry_name = new_name;
break;
}
}
}
match object::File::parse(&*data) {
Ok(object) => {
symbol_table.insert(