@@ -16,7 +16,13 @@ use cargo_metadata::{Metadata, MetadataCommand};
16
16
use dylint_internal:: env;
17
17
use rustc_session:: Session ;
18
18
use rustc_span:: Symbol ;
19
- use std:: { any:: type_name, cell:: RefCell , fs:: read_to_string, path:: Path , sync:: Mutex } ;
19
+ use std:: {
20
+ any:: type_name,
21
+ cell:: RefCell ,
22
+ fs:: read_to_string,
23
+ path:: { Path , PathBuf } ,
24
+ sync:: Mutex ,
25
+ } ;
20
26
use thiserror:: Error ;
21
27
22
28
pub const DYLINT_VERSION : & str = "0.1.0" ;
@@ -72,8 +78,8 @@ macro_rules! __make_late_closure {
72
78
}
73
79
74
80
// smoelius: Relevant PR and merge commit:
75
- // * https://github.com/rust-lang/rust/pull/101501
76
- // * https://github.com/rust-lang/rust/commit/87788097b776f8e3662f76627944230684b671bd
81
+ // - https://github.com/rust-lang/rust/pull/101501
82
+ // - https://github.com/rust-lang/rust/commit/87788097b776f8e3662f76627944230684b671bd
77
83
#[ rustversion:: since( 2022 -09 -08 ) ]
78
84
#[ doc( hidden) ]
79
85
#[ macro_export]
@@ -310,8 +316,7 @@ pub fn try_init_config(sess: &Session) -> ConfigResult<()> {
310
316
Some ( Symbol :: intern ( & value) ) ,
311
317
) ) ;
312
318
Some ( value)
313
- } else if let Some ( local_crate_source_file) = sess
314
- . local_crate_source_file
319
+ } else if let Some ( local_crate_source_file) = local_crate_source_file ( sess)
315
320
. as_deref ( )
316
321
. map ( Path :: canonicalize)
317
322
. transpose ( ) ?
@@ -363,3 +368,16 @@ pub fn try_init_config(sess: &Session) -> ConfigResult<()> {
363
368
364
369
Ok ( ( ) )
365
370
}
371
+
372
+ #[ rustversion:: before( 2023 -01 -19 ) ]
373
+ fn local_crate_source_file ( sess : & Session ) -> Option < PathBuf > {
374
+ sess. local_crate_source_file . clone ( )
375
+ }
376
+
377
+ // smoelius: Relevant PR and merge commit:
378
+ // - https://github.com/rust-lang/rust/pull/106810
379
+ // - https://github.com/rust-lang/rust/commit/65d2f2a5f9c323c88d1068e8e90d0b47a20d491c
380
+ #[ rustversion:: since( 2023 -01 -19 ) ]
381
+ fn local_crate_source_file ( sess : & Session ) -> Option < PathBuf > {
382
+ sess. local_crate_source_file ( )
383
+ }
0 commit comments