@@ -922,52 +922,45 @@ impl<'a> Linker for MsvcLinker<'a> {
922922 }
923923 }
924924
925- fn debuginfo ( & mut self , strip : Strip , natvis_debugger_visualizers : & [ PathBuf ] ) {
926- match strip {
927- Strip :: None => {
928- // This will cause the Microsoft linker to generate a PDB file
929- // from the CodeView line tables in the object files.
930- self . cmd . arg ( "/DEBUG" ) ;
931-
932- // Default to emitting only the file name of the PDB file into
933- // the binary instead of the full path. Emitting the full path
934- // may leak private information (such as user names).
935- // See https://github.com/rust-lang/rust/issues/87825.
936- //
937- // This default behavior can be overridden by explicitly passing
938- // `-Clink-arg=/PDBALTPATH:...` to rustc.
939- self . cmd . arg ( "/PDBALTPATH:%_PDB%" ) ;
940-
941- // This will cause the Microsoft linker to embed .natvis info into the PDB file
942- let natvis_dir_path = self . sess . sysroot . join ( "lib\\ rustlib\\ etc" ) ;
943- if let Ok ( natvis_dir) = fs:: read_dir ( & natvis_dir_path) {
944- for entry in natvis_dir {
945- match entry {
946- Ok ( entry) => {
947- let path = entry. path ( ) ;
948- if path. extension ( ) == Some ( "natvis" . as_ref ( ) ) {
949- let mut arg = OsString :: from ( "/NATVIS:" ) ;
950- arg. push ( path) ;
951- self . cmd . arg ( arg) ;
952- }
953- }
954- Err ( error) => {
955- self . sess . dcx ( ) . emit_warn ( errors:: NoNatvisDirectory { error } ) ;
956- }
925+ fn debuginfo ( & mut self , _strip : Strip , natvis_debugger_visualizers : & [ PathBuf ] ) {
926+ // This will cause the Microsoft linker to generate a PDB file
927+ // from the CodeView line tables in the object files.
928+ self . cmd . arg ( "/DEBUG" ) ;
929+
930+ // Default to emitting only the file name of the PDB file into
931+ // the binary instead of the full path. Emitting the full path
932+ // may leak private information (such as user names).
933+ // See https://github.com/rust-lang/rust/issues/87825.
934+ //
935+ // This default behavior can be overridden by explicitly passing
936+ // `-Clink-arg=/PDBALTPATH:...` to rustc.
937+ self . cmd . arg ( "/PDBALTPATH:%_PDB%" ) ;
938+
939+ // This will cause the Microsoft linker to embed .natvis info into the PDB file
940+ let natvis_dir_path = self . sess . sysroot . join ( "lib\\ rustlib\\ etc" ) ;
941+ if let Ok ( natvis_dir) = fs:: read_dir ( & natvis_dir_path) {
942+ for entry in natvis_dir {
943+ match entry {
944+ Ok ( entry) => {
945+ let path = entry. path ( ) ;
946+ if path. extension ( ) == Some ( "natvis" . as_ref ( ) ) {
947+ let mut arg = OsString :: from ( "/NATVIS:" ) ;
948+ arg. push ( path) ;
949+ self . cmd . arg ( arg) ;
957950 }
958951 }
959- }
960-
961- // This will cause the Microsoft linker to embed .natvis info for all crates into the PDB file
962- for path in natvis_debugger_visualizers {
963- let mut arg = OsString :: from ( "/NATVIS:" ) ;
964- arg. push ( path) ;
965- self . cmd . arg ( arg) ;
952+ Err ( error) => {
953+ self . sess . dcx ( ) . emit_warn ( errors:: NoNatvisDirectory { error } ) ;
954+ }
966955 }
967956 }
968- Strip :: Debuginfo | Strip :: Symbols => {
969- self . cmd . arg ( "/DEBUG:NONE" ) ;
970- }
957+ }
958+
959+ // This will cause the Microsoft linker to embed .natvis info for all crates into the PDB file
960+ for path in natvis_debugger_visualizers {
961+ let mut arg = OsString :: from ( "/NATVIS:" ) ;
962+ arg. push ( path) ;
963+ self . cmd . arg ( arg) ;
971964 }
972965 }
973966
0 commit comments