Skip to content

Commit

Permalink
test: remove the use of CARGO_RUSTC_CURRENT_DIR
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weihanglo committed Nov 29, 2024
1 parent 81e0670 commit 1e9bce1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 0 additions & 5 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
5 changes: 3 additions & 2 deletions src/cargo/util/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1e9bce1

Please sign in to comment.