@@ -5,7 +5,7 @@ use crate::{
5
5
use rspirv:: binary:: Assemble ;
6
6
use rustc_codegen_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule , ThinModule , ThinShared } ;
7
7
use rustc_codegen_ssa:: back:: write:: CodegenContext ;
8
- use rustc_codegen_ssa:: { CodegenResults , NativeLib } ;
8
+ use rustc_codegen_ssa:: { CodegenResults , NativeLib , METADATA_FILENAME } ;
9
9
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
10
10
use rustc_data_structures:: owning_ref:: OwningRef ;
11
11
use rustc_data_structures:: rustc_erase_owner;
@@ -443,13 +443,13 @@ fn create_archive(files: &[&Path], metadata: &[u8], out_filename: &Path) {
443
443
let mut builder = Builder :: new ( file) ;
444
444
{
445
445
let mut header = Header :: new_gnu ( ) ;
446
- header. set_path ( ".metadata" ) . unwrap ( ) ;
446
+ header. set_path ( METADATA_FILENAME ) . unwrap ( ) ;
447
447
header. set_size ( metadata. len ( ) as u64 ) ;
448
448
header. set_cksum ( ) ;
449
449
builder. append ( & header, metadata) . unwrap ( ) ;
450
450
}
451
451
let mut filenames = FxHashSet :: default ( ) ;
452
- filenames. insert ( OsStr :: new ( ".metadata" ) ) ;
452
+ filenames. insert ( OsStr :: new ( METADATA_FILENAME ) ) ;
453
453
for file in files {
454
454
assert ! (
455
455
filenames. insert( file. file_name( ) . unwrap( ) ) ,
@@ -467,7 +467,7 @@ pub fn read_metadata(rlib: &Path) -> Result<MetadataRef, String> {
467
467
fn read_metadata_internal ( rlib : & Path ) -> Result < Option < MetadataRef > , std:: io:: Error > {
468
468
for entry in Archive :: new ( File :: open ( rlib) ?) . entries ( ) ? {
469
469
let mut entry = entry?;
470
- if entry. path ( ) ? == Path :: new ( ".metadata" ) {
470
+ if entry. path ( ) ? == Path :: new ( METADATA_FILENAME ) {
471
471
let mut bytes = Vec :: new ( ) ;
472
472
entry. read_to_end ( & mut bytes) ?;
473
473
let buf: OwningRef < Vec < u8 > , [ u8 ] > = OwningRef :: new ( bytes) ;
@@ -509,7 +509,7 @@ fn do_link(
509
509
for rlib in rlibs {
510
510
for entry in Archive :: new ( File :: open ( rlib) . unwrap ( ) ) . entries ( ) . unwrap ( ) {
511
511
let mut entry = entry. unwrap ( ) ;
512
- if entry. path ( ) . unwrap ( ) != Path :: new ( ".metadata" ) {
512
+ if entry. path ( ) . unwrap ( ) != Path :: new ( METADATA_FILENAME ) {
513
513
// std::fs::read adds 1 to the size, so do the same here - see comment:
514
514
// https://github.com/rust-lang/rust/blob/72868e017bdade60603a25889e253f556305f996/library/std/src/fs.rs#L200-L202
515
515
let mut bytes = Vec :: with_capacity ( entry. size ( ) as usize + 1 ) ;
0 commit comments