Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cargo-dylint/tests/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ fn markdown_link_check() {
}
}

#[ignore = "disabled until `dylint` package switches to edition 2024"]
#[test]
fn msrv() {
for package in &METADATA.packages {
Expand Down
8 changes: 4 additions & 4 deletions cargo-dylint/tests/integration/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use std::{
};
use tempfile::tempdir;

const CHANNEL_A: &str = "nightly-2025-01-09";
const CHANNEL_B: &str = "nightly-2025-02-20";
const CHANNEL_A: &str = "nightly-2025-04-22";
const CHANNEL_B: &str = "nightly-2025-05-14";

const CLIPPY_UTILS_REV_A: &str = "19e305bb57a7595f2a8d81f521c0dd8bf854e739";
const CLIPPY_UTILS_REV_B: &str = "238edf273d195c8e472851ebd60571f77f978ac8";
const CLIPPY_UTILS_REV_A: &str = "ff428d91c2b690b8dbd8cc1e48274870c24fe1e2";
const CLIPPY_UTILS_REV_B: &str = "93bd4d893122417b9265563c037f11a158a8e37c";

#[test]
fn one_name_multiple_toolchains() {
Expand Down
2 changes: 1 addition & 1 deletion cargo-dylint/tests/integration/package_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tempfile::tempdir;
// smoelius: `[email protected]` (2024-12-16) requires rustc 1.81.
// smoelius: `[email protected]` and several other packages require rustc 1.82.
// smoelius: Edition 2024 was stabilized with Rust 1.85.
const RUST_VERSION: &str = "1.86.0";
const RUST_VERSION: &str = "1.88.0";

#[test]
fn new_package() {
Expand Down
4 changes: 2 additions & 2 deletions driver/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build = "build/main.rs"
[dependencies]
anyhow = "1.0"
libc = "0.2"
libloading = "0.8"
libloading = "0.9"
log = "0.4"
rustversion = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion dylint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "A tool for running Rust lints from dynamic libraries"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/trailofbits/dylint"
rust-version = "1.81"
rust-version = "1.88"

[dependencies]
anstyle = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions dylint/src/driver_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::{error::warn, opts};
use anyhow::{Context, Result, anyhow, ensure};
use cargo_metadata::MetadataCommand;
use dylint_internal::{
CommandExt, driver as dylint_driver, env, home,
CommandExt, driver as dylint_driver, env,
rustup::{SanitizeEnvironment, toolchain_path},
};
use semver::Version;
use std::{
env::consts,
env::{consts, home_dir},
fs::{copy, create_dir_all, rename, write},
path::{Path, PathBuf},
};
Expand Down Expand Up @@ -97,7 +97,7 @@ fn dylint_drivers() -> Result<PathBuf> {
ensure!(dylint_drivers.is_dir());
Ok(dylint_drivers.to_path_buf())
} else {
let home = home::home_dir().ok_or_else(|| anyhow!("Could not find HOME directory"))?;
let home = home_dir().ok_or_else(|| anyhow!("Could not find HOME directory"))?;
let dylint_drivers = Path::new(&home).join(".dylint_drivers");
if !dylint_drivers.is_dir() {
create_dir_all(&dylint_drivers).with_context(|| {
Expand Down
12 changes: 7 additions & 5 deletions examples/general/abs_home_path/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::{diagnostics::span_lint, is_in_test};
use dylint_internal::home;
use once_cell::unsync::OnceCell;
use rustc_ast::ast::LitKind;
use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_span::Span;
use std::path::{Path, PathBuf};
use std::{
env::home_dir,
path::{Path, PathBuf},
};

dylint_linting::impl_late_lint! {
/// ### What it does
Expand Down Expand Up @@ -84,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for AbsHomePath {
&& path.is_absolute()
&& self
.home
.get_or_init(home::home_dir)
.get_or_init(home_dir)
.as_ref()
.is_some_and(|dir| path.starts_with(dir))
{
Expand Down Expand Up @@ -114,7 +116,7 @@ fn ui() {

// smoelius: On GitHub, `dylint` is stored on the D drive, not in the user's home directory on
// the C drive.
if let Some(home) = home::home_dir()
if let Some(home) = home_dir()
&& !Path::new(env!("CARGO_MANIFEST_DIR")).starts_with(home)
{
#[expect(clippy::explicit_write)]
Expand Down Expand Up @@ -189,7 +191,7 @@ fn context_allowance() {
];

// Skip tests if repository is not stored in the user's home directory
if let Some(home) = home::home_dir()
if let Some(home) = home_dir()
&& !Path::new(env!("CARGO_MANIFEST_DIR")).starts_with(home)
{
#[expect(clippy::explicit_write)]
Expand Down
3 changes: 2 additions & 1 deletion expensive/tests/boundary_toolchains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ const BOUNDARIES: &[(&str, &str)] = &[
// https://github.com/rust-lang/rust/commit/0abc6c6e9859bc6915ddc76d484117ff626481c6
// smoelius: 2025-05-15 is skipped because there is no release for that date.
("nightly-2025-05-14", "nightly-2025-05-16"),
// smoelius: `libloading-0.9.0` rustc 1.88.
// https://github.com/rust-lang/rust/pull/135880
// https://github.com/rust-lang/rust/commit/7d31ae7f351b4aa0fcb47d1d22e04c275bef0653
("nightly-2025-01-24", "nightly-2025-01-25"),
// ("nightly-2025-01-24", "nightly-2025-01-25"),
// smoelius: `[email protected]` and `[email protected]` require rustc 1.86.
// nightly-2024-03-17 is Rust 1.85.
// https://github.com/rust-lang/rust/pull/133567
Expand Down
3 changes: 1 addition & 2 deletions internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ env_logger = { workspace = true, optional = true }
git2 = { workspace = true, optional = true }
home = { workspace = true, optional = true }
if_chain = { workspace = true, optional = true }
rustversion = { workspace = true, optional = true }
semver = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
tar = { workspace = true, optional = true }
Expand All @@ -44,7 +43,7 @@ clippy_utils = ["git", "semver", "tempfile", "toml", "toml_edit"]
config = ["cargo_metadata", "serde", "thiserror", "toml"]
examples = ["cargo", "cargo-util", "rustup", "walkdir"]
git = ["git2", "if_chain"]
home = ["dep:home", "rustversion"]
home = ["dep:home"]
match_def_path = []
packaging = ["cargo", "tar"]
rustup = ["cargo_metadata"]
Expand Down
22 changes: 3 additions & 19 deletions internal/src/home.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
use crate::env;
use std::path::PathBuf;
use std::{env, path::PathBuf};

#[must_use]
pub fn cargo_home() -> Option<PathBuf> {
if let Ok(cargo_home) = env::var(env::CARGO_HOME) {
if let Ok(cargo_home) = env::var(crate::env::CARGO_HOME) {
Some(PathBuf::from(cargo_home))
} else {
home_dir().map(|path| path.join(".cargo"))
env::home_dir().map(|path| path.join(".cargo"))
}
}

// smoelius: https://github.com/rust-lang/cargo/commit/014378f8c07bec557b6c6608e5baf0761a12d504
#[rustversion::before(1.86)]
pub use home::home_dir;

#[rustversion::since(1.86)]
#[must_use]
pub fn home_dir() -> Option<PathBuf> {
// smoelius: The `deprecated` attribute hasn't been removed yet:
// https://github.com/rust-lang/rust/pull/132515#discussion_r1829715262
// smoelius: The attribute is removed in Rust's master branch:
// https://github.com/rust-lang/rust/commit/2c752bcf559975995eb8086a7fa6a7f9b5ba0de8
#[allow(deprecated)]
std::env::home_dir()
}