From 6c6a6b11ab953d52cffddaa69a36a8a9b7d35624 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Fri, 29 Nov 2024 09:42:52 -0500 Subject: [PATCH] test: remove the use of `CARGO_RUSTC_CURRENT_DIR` The environment variable has been removed in #14799 Switch to plain old `CARGO_MANIFEST_DIR` instead. See also build failures in rust-lang/rust#133533 --- .cargo/config.toml | 5 ----- src/cargo/util/lints.rs | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f1a26708418..960c1d4be41 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,8 +3,3 @@ build-man = "run --package xtask-build-man --" stale-label = "run --package xtask-stale-label --" bump-check = "run --package xtask-bump-check --" lint-docs = "run --package xtask-lint-docs --" - -[env] -# HACK: Until this is stabilized, `snapbox`s polyfill could get confused -# inside of the rust-lang/rust repo because it looks for the furthest-away `Cargo.toml` -CARGO_RUSTC_CURRENT_DIR = { value = "", relative = true } diff --git a/src/cargo/util/lints.rs b/src/cargo/util/lints.rs index 99531bfbd7b..0793c8928ba 100644 --- a/src/cargo/util/lints.rs +++ b/src/cargo/util/lints.rs @@ -610,6 +610,7 @@ mod tests { use itertools::Itertools; use snapbox::ToDebug; use std::collections::HashSet; + use std::path::Path; #[test] fn ensure_sorted_lints() { @@ -647,7 +648,7 @@ mod tests { #[test] fn ensure_updated_lints() { - let path = snapbox::utils::current_rs!(); + let path = Path::new(std::env!("CARGO_MANIFEST_DIR")).join(file!()); let expected = std::fs::read_to_string(&path).unwrap(); let expected = expected .lines() @@ -686,7 +687,7 @@ mod tests { #[test] fn ensure_updated_lint_groups() { - let path = snapbox::utils::current_rs!(); + let path = Path::new(std::env!("CARGO_MANIFEST_DIR")).join(file!()); let expected = std::fs::read_to_string(&path).unwrap(); let expected = expected .lines()