diff --git a/.gitignore b/.gitignore index 858351c..ce203a6 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ mod *.generated.* CLAUDE.md .claude +.idea diff --git a/Cargo.lock b/Cargo.lock index 0412906..ccaeca4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,7 +138,7 @@ dependencies = [ [[package]] name = "cargo_pup" -version = "0.1.5" +version = "0.1.6" dependencies = [ "ansi_term", "anyhow", @@ -157,7 +157,7 @@ dependencies = [ [[package]] name = "cargo_pup_common" -version = "0.1.5" +version = "0.1.6" dependencies = [ "anyhow", "cargo_metadata", @@ -168,7 +168,7 @@ dependencies = [ [[package]] name = "cargo_pup_lint_config" -version = "0.1.5" +version = "0.1.6" dependencies = [ "anyhow", "cargo_pup_common", @@ -179,7 +179,7 @@ dependencies = [ [[package]] name = "cargo_pup_lint_impl" -version = "0.1.5" +version = "0.1.6" dependencies = [ "anyhow", "cargo_pup_common", diff --git a/Cargo.toml b/Cargo.toml index bf3f6d4..96df6a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ exclude = ["test_app"] [package] name = "cargo_pup" -version = "0.1.5" +version = "0.1.6" edition = "2024" description = "A Rust architectural linting tool that integrates with rustc to enforce architectural patterns and boundaries" license = "Apache-2.0" @@ -34,9 +34,9 @@ anyhow = { workspace = true } tempfile = { workspace = true } ron = { workspace = true } cargo_metadata = { workspace = true } -cargo_pup_common = { path = "cargo_pup_common", version = "=0.1.5" } -cargo_pup_lint_impl = { path = "cargo_pup_lint_impl", version = "=0.1.5" } -cargo_pup_lint_config = { path = "cargo_pup_lint_config", version = "=0.1.5" } +cargo_pup_common = { path = "cargo_pup_common", version = "=0.1.6" } +cargo_pup_lint_impl = { path = "cargo_pup_lint_impl", version = "=0.1.6" } +cargo_pup_lint_config = { path = "cargo_pup_lint_config", version = "=0.1.6" } # # These bits are just to keep rust rover happy. diff --git a/README.md b/README.md index f395f3a..632f2cf 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ First, add the following to your `Cargo.toml`: ```toml [dev-dependencies] -cargo_pup_lint_config = "0.1.5" +cargo_pup_lint_config = "0.1.6" ``` ## Examples diff --git a/cargo_pup_common/Cargo.toml b/cargo_pup_common/Cargo.toml index a04babf..1b7aa1d 100644 --- a/cargo_pup_common/Cargo.toml +++ b/cargo_pup_common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo_pup_common" -version = "0.1.5" +version = "0.1.6" edition = "2024" description = "Common utilities and shared components for cargo-pup architectural linting tool" license = "Apache-2.0" diff --git a/cargo_pup_lint_config/Cargo.toml b/cargo_pup_lint_config/Cargo.toml index 3a83b8e..613412d 100644 --- a/cargo_pup_lint_config/Cargo.toml +++ b/cargo_pup_lint_config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo_pup_lint_config" -version = "0.1.5" +version = "0.1.6" edition = "2024" description = "Configuration and rule builder utilities for cargo-pup architectural linting" license = "Apache-2.0" @@ -13,4 +13,4 @@ serde.workspace = true ron.workspace = true tempfile.workspace = true anyhow.workspace = true -cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.5" } +cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.6" } diff --git a/cargo_pup_lint_config/README.md b/cargo_pup_lint_config/README.md index 7ce11be..b6dc07a 100644 --- a/cargo_pup_lint_config/README.md +++ b/cargo_pup_lint_config/README.md @@ -24,7 +24,7 @@ Add this to your `Cargo.toml`: ```toml [dev-dependencies] -cargo_pup_lint_config = "0.1.5" +cargo_pup_lint_config = "0.1.6" ``` ## Example diff --git a/cargo_pup_lint_impl/Cargo.toml b/cargo_pup_lint_impl/Cargo.toml index 0be47c7..faf60fc 100644 --- a/cargo_pup_lint_impl/Cargo.toml +++ b/cargo_pup_lint_impl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo_pup_lint_impl" -version = "0.1.5" +version = "0.1.6" edition = "2024" description = "Core lint implementations and rustc integration for cargo-pup architectural linting" license = "Apache-2.0" @@ -9,8 +9,8 @@ homepage = "https://github.com/datadog/cargo-pup" readme = "README.md" [dependencies] -cargo_pup_lint_config = { path = "../cargo_pup_lint_config", version = "=0.1.5" } -cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.5" } +cargo_pup_lint_config = { path = "../cargo_pup_lint_config", version = "=0.1.6" } +cargo_pup_common = { path = "../cargo_pup_common", version = "=0.1.6" } anyhow.workspace = true regex.workspace = true serde_json.workspace = true diff --git a/cargo_pup_lint_impl/src/helpers/queries.rs b/cargo_pup_lint_impl/src/helpers/queries.rs index c353a45..a1f788c 100644 --- a/cargo_pup_lint_impl/src/helpers/queries.rs +++ b/cargo_pup_lint_impl/src/helpers/queries.rs @@ -46,6 +46,10 @@ pub fn implements_trait<'tcx>( || ty.walk().any(|t| { if let Some(ty) = t.as_type() { matches!(ty.kind(), ty::Alias(ty::Projection, _) | ty::Param(_)) + } else if let Some(ct) = t.as_const() { + // Const generic parameters (e.g., N in Index) also need + // Analysis mode — Coherence's orphan check panics on them. + matches!(ct.kind(), ty::ConstKind::Param(_)) } else { false } diff --git a/test_app/Cargo.lock b/test_app/Cargo.lock index d3873a2..8169b51 100644 --- a/test_app/Cargo.lock +++ b/test_app/Cargo.lock @@ -57,7 +57,7 @@ dependencies = [ [[package]] name = "cargo_pup_common" -version = "0.1.5" +version = "0.1.6" dependencies = [ "anyhow", "cargo_metadata", @@ -68,7 +68,7 @@ dependencies = [ [[package]] name = "cargo_pup_lint_config" -version = "0.1.5" +version = "0.1.6" dependencies = [ "anyhow", "cargo_pup_common",