diff --git a/cargo-dylint/tests/boundary_toolchains.rs b/cargo-dylint/tests/boundary_toolchains.rs index 93862500f..d8ce9a9db 100644 --- a/cargo-dylint/tests/boundary_toolchains.rs +++ b/cargo-dylint/tests/boundary_toolchains.rs @@ -6,10 +6,21 @@ use dylint_internal::{ }; use tempfile::tempdir; -// smoelius: The channel date is one day later than the `rustc --version` date. +// smoelius: The channel date is one day later than the `rustc --version` date. For example, suppose +// the code contains: +// ``` +// #[rustversion::since(2024-03-29)] ... +// ``` +// Then the boundary should be: +// ``` +// ("2024-03-29", "2024-03-30"), +// ``` // smoelius: Put recent boundaries first, since they're more likely to cause problems. // smoelius: The relevant PRs and merge commits appear before each boundary. const BOUNDARIES: &[(&str, &str)] = &[ + // https://github.com/rust-lang/rust/pull/122450 + // https://github.com/rust-lang/rust/commit/685927aae69657b46323cffbeb0062835bd7fa2b + ("2024-03-29", "2024-03-30"), // https://github.com/rust-lang/rust/pull/121780 // https://github.com/rust-lang/rust/commit/1547c076bfec8abb819d6a81e1e4095d267bd5b4 // https://github.com/rust-lang/rust/pull/121969 diff --git a/utils/linting/src/lib.rs b/utils/linting/src/lib.rs index cb0e9a636..70c61aef9 100644 --- a/utils/linting/src/lib.rs +++ b/utils/linting/src/lib.rs @@ -671,11 +671,20 @@ fn local_crate_source_file(sess: &rustc_session::Session) -> Option { // smoelius: Relevant PR and merge commit: // - https://github.com/rust-lang/rust/pull/106810 // - https://github.com/rust-lang/rust/commit/65d2f2a5f9c323c88d1068e8e90d0b47a20d491c -#[rustversion::since(2023-01-19)] +#[rustversion::all(since(2023-01-19), before(2024-03-29))] fn local_crate_source_file(sess: &rustc_session::Session) -> Option { sess.local_crate_source_file() } +// smoelius: Relevant PR and merge commit: +// - https://github.com/rust-lang/rust/pull/122450 +// - https://github.com/rust-lang/rust/commit/685927aae69657b46323cffbeb0062835bd7fa2b +#[rustversion::since(2024-03-29)] +fn local_crate_source_file(sess: &rustc_session::Session) -> Option { + sess.local_crate_source_file() + .and_then(rustc_span::RealFileName::into_local_path) +} + #[rustversion::before(2023-06-28)] fn early_error(msg: String) -> ! { rustc_session::early_error(