@@ -16,7 +16,13 @@ use cargo_metadata::{Metadata, MetadataCommand};
1616use dylint_internal:: env;
1717use rustc_session:: Session ;
1818use 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+ } ;
2026use thiserror:: Error ;
2127
2228pub const DYLINT_VERSION : & str = "0.1.0" ;
@@ -72,8 +78,8 @@ macro_rules! __make_late_closure {
7278}
7379
7480// 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
7783#[ rustversion:: since( 2022 -09 -08 ) ]
7884#[ doc( hidden) ]
7985#[ macro_export]
@@ -310,8 +316,7 @@ pub fn try_init_config(sess: &Session) -> ConfigResult<()> {
310316 Some ( Symbol :: intern ( & value) ) ,
311317 ) ) ;
312318 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)
315320 . as_deref ( )
316321 . map ( Path :: canonicalize)
317322 . transpose ( ) ?
@@ -363,3 +368,16 @@ pub fn try_init_config(sess: &Session) -> ConfigResult<()> {
363368
364369 Ok ( ( ) )
365370}
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