Skip to content

Commit

Permalink
Account for rust-lang/rust#122450
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Apr 7, 2024
1 parent 96bfbc6 commit 9add993
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
13 changes: 12 additions & 1 deletion cargo-dylint/tests/boundary_toolchains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion utils/linting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,20 @@ fn local_crate_source_file(sess: &rustc_session::Session) -> Option<PathBuf> {
// 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<PathBuf> {
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<PathBuf> {
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(
Expand Down

0 comments on commit 9add993

Please sign in to comment.