@@ -902,52 +902,45 @@ impl<'a> Linker for MsvcLinker<'a> {
902902 }
903903 }
904904
905- fn debuginfo ( & mut self , strip : Strip , natvis_debugger_visualizers : & [ PathBuf ] ) {
906- match strip {
907- Strip :: None => {
908- // This will cause the Microsoft linker to generate a PDB file
909- // from the CodeView line tables in the object files.
910- self . cmd . arg ( "/DEBUG" ) ;
911-
912- // Default to emitting only the file name of the PDB file into
913- // the binary instead of the full path. Emitting the full path
914- // may leak private information (such as user names).
915- // See https://github.com/rust-lang/rust/issues/87825.
916- //
917- // This default behavior can be overridden by explicitly passing
918- // `-Clink-arg=/PDBALTPATH:...` to rustc.
919- self . cmd . arg ( "/PDBALTPATH:%_PDB%" ) ;
920-
921- // This will cause the Microsoft linker to embed .natvis info into the PDB file
922- let natvis_dir_path = self . sess . sysroot . join ( "lib\\ rustlib\\ etc" ) ;
923- if let Ok ( natvis_dir) = fs:: read_dir ( & natvis_dir_path) {
924- for entry in natvis_dir {
925- match entry {
926- Ok ( entry) => {
927- let path = entry. path ( ) ;
928- if path. extension ( ) == Some ( "natvis" . as_ref ( ) ) {
929- let mut arg = OsString :: from ( "/NATVIS:" ) ;
930- arg. push ( path) ;
931- self . cmd . arg ( arg) ;
932- }
933- }
934- Err ( error) => {
935- self . sess . dcx ( ) . emit_warn ( errors:: NoNatvisDirectory { error } ) ;
936- }
905+ fn debuginfo ( & mut self , _strip : Strip , natvis_debugger_visualizers : & [ PathBuf ] ) {
906+ // This will cause the Microsoft linker to generate a PDB file
907+ // from the CodeView line tables in the object files.
908+ self . cmd . arg ( "/DEBUG" ) ;
909+
910+ // Default to emitting only the file name of the PDB file into
911+ // the binary instead of the full path. Emitting the full path
912+ // may leak private information (such as user names).
913+ // See https://github.com/rust-lang/rust/issues/87825.
914+ //
915+ // This default behavior can be overridden by explicitly passing
916+ // `-Clink-arg=/PDBALTPATH:...` to rustc.
917+ self . cmd . arg ( "/PDBALTPATH:%_PDB%" ) ;
918+
919+ // This will cause the Microsoft linker to embed .natvis info into the PDB file
920+ let natvis_dir_path = self . sess . sysroot . join ( "lib\\ rustlib\\ etc" ) ;
921+ if let Ok ( natvis_dir) = fs:: read_dir ( & natvis_dir_path) {
922+ for entry in natvis_dir {
923+ match entry {
924+ Ok ( entry) => {
925+ let path = entry. path ( ) ;
926+ if path. extension ( ) == Some ( "natvis" . as_ref ( ) ) {
927+ let mut arg = OsString :: from ( "/NATVIS:" ) ;
928+ arg. push ( path) ;
929+ self . cmd . arg ( arg) ;
937930 }
938931 }
939- }
940-
941- // This will cause the Microsoft linker to embed .natvis info for all crates into the PDB file
942- for path in natvis_debugger_visualizers {
943- let mut arg = OsString :: from ( "/NATVIS:" ) ;
944- arg. push ( path) ;
945- self . cmd . arg ( arg) ;
932+ Err ( error) => {
933+ self . sess . dcx ( ) . emit_warn ( errors:: NoNatvisDirectory { error } ) ;
934+ }
946935 }
947936 }
948- Strip :: Debuginfo | Strip :: Symbols => {
949- self . cmd . arg ( "/DEBUG:NONE" ) ;
950- }
937+ }
938+
939+ // This will cause the Microsoft linker to embed .natvis info for all crates into the PDB file
940+ for path in natvis_debugger_visualizers {
941+ let mut arg = OsString :: from ( "/NATVIS:" ) ;
942+ arg. push ( path) ;
943+ self . cmd . arg ( arg) ;
951944 }
952945 }
953946
0 commit comments