Skip to content

Commit 1e9bce1

Browse files
committed
test: remove the use of CARGO_RUSTC_CURRENT_DIR
The environment variable has been removed in rust-lang#14799. Switch to plain old `CARGO_MANIFEST_DIR` because snapbox's `current_rs` favors furthest Cargo.toml, blocking tests running in rust-lang/rust as a submodule. See also build failures in rust-lang/rust#133533
1 parent 81e0670 commit 1e9bce1

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

.cargo/config.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@ build-man = "run --package xtask-build-man --"
33
stale-label = "run --package xtask-stale-label --"
44
bump-check = "run --package xtask-bump-check --"
55
lint-docs = "run --package xtask-lint-docs --"
6-
7-
[env]
8-
# HACK: Until this is stabilized, `snapbox`s polyfill could get confused
9-
# inside of the rust-lang/rust repo because it looks for the furthest-away `Cargo.toml`
10-
CARGO_RUSTC_CURRENT_DIR = { value = "", relative = true }

src/cargo/util/lints.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ mod tests {
610610
use itertools::Itertools;
611611
use snapbox::ToDebug;
612612
use std::collections::HashSet;
613+
use std::path::Path;
613614

614615
#[test]
615616
fn ensure_sorted_lints() {
@@ -647,7 +648,7 @@ mod tests {
647648

648649
#[test]
649650
fn ensure_updated_lints() {
650-
let path = snapbox::utils::current_rs!();
651+
let path = Path::new(std::env!("CARGO_MANIFEST_DIR")).join(file!());
651652
let expected = std::fs::read_to_string(&path).unwrap();
652653
let expected = expected
653654
.lines()
@@ -686,7 +687,7 @@ mod tests {
686687

687688
#[test]
688689
fn ensure_updated_lint_groups() {
689-
let path = snapbox::utils::current_rs!();
690+
let path = Path::new(std::env!("CARGO_MANIFEST_DIR")).join(file!());
690691
let expected = std::fs::read_to_string(&path).unwrap();
691692
let expected = expected
692693
.lines()

0 commit comments

Comments
 (0)