Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco · rust-lang/rust@8188f6c (original) (raw)

`@@ -21,10 +21,8 @@ use rustc_errors::{DiagCtxtHandle, Level};

`

21

21

`use rustc_fs_util::{link_or_copy, path_to_c_string};

`

22

22

`use rustc_middle::ty::TyCtxt;

`

23

23

`use rustc_session::Session;

`

24

``

`-

use rustc_session::config::{

`

25

``

`-

self, Lto, OutputType, Passes, RemapPathScopeComponents, SplitDwarfKind, SwitchWithOptPath,

`

26

``

`-

};

`

27

``

`-

use rustc_span::{BytePos, InnerSpan, Pos, SpanData, SyntaxContext, sym};

`

``

24

`+

use rustc_session::config::{self, Lto, OutputType, Passes, SplitDwarfKind, SwitchWithOptPath};

`

``

25

`+

use rustc_span::{BytePos, InnerSpan, Pos, RemapPathScopeComponents, SpanData, SyntaxContext, sym};

`

28

26

`use rustc_target::spec::{

`

29

27

`Arch, CodeModel, FloatAbi, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel,

`

30

28

`};

`

`@@ -248,6 +246,7 @@ pub(crate) fn target_machine_factory(

`

248

246

` !sess.opts.unstable_opts.use_ctors_section.unwrap_or(sess.target.use_ctors_section);

`

249

247

``

250

248

`let path_mapping = sess.source_map().path_mapping().clone();

`

``

249

`+

let working_dir = sess.source_map().working_dir().clone();

`

251

250

``

252

251

`let use_emulated_tls = matches!(sess.tls_model(), TlsModel::Emulated);

`

253

252

``

`@@ -271,9 +270,6 @@ pub(crate) fn target_machine_factory(

`

271

270

`}

`

272

271

`};

`

273

272

``

274

``

`-

let file_name_display_preference =

`

275

``

`-

sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO);

`

276

``

-

277

273

`let use_wasm_eh = wants_wasm_eh(sess);

`

278

274

``

279

275

`let prof = SelfProfilerRef::clone(&sess.prof);

`

`@@ -284,8 +280,9 @@ pub(crate) fn target_machine_factory(

`

284

280

`let path_to_cstring_helper = |path: Option| -> CString {

`

285

281

`let path = path.unwrap_or_default();

`

286

282

`let path = path_mapping

`

287

``

`-

.to_real_filename(path)

`

288

``

`-

.to_string_lossy(file_name_display_preference)

`

``

283

`+

.to_real_filename(&working_dir, path)

`

``

284

`+

.path(RemapPathScopeComponents::DEBUGINFO)

`

``

285

`+

.to_string_lossy()

`

289

286

`.into_owned();

`

290

287

`CString::new(path).unwrap()

`

291

288

`};

`