From 60c230b94a8c1dcff1b72ceb0531aac457abc7d9 Mon Sep 17 00:00:00 2001 From: Jynn Nelson Date: Fri, 31 Oct 2025 14:14:05 -0400 Subject: [PATCH] compiler: Fix a couple issues around cargo feature unification The first was a warning: ``` Testing stage2 {rustc_parse_format} (aarch64-apple-darwin) Compiling rustc_index v0.0.0 (/Users/ci/project/compiler/rustc_index) error: extern crate `smallvec` is unused in crate `rustc_index` --> compiler/rustc_index/src/lib.rs:2:1 | 2 | #![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))] | ^ | = help: remove the dependency or add `use smallvec as _;` to the crate root = note: `-D unused-crate-dependencies` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unused_crate_dependencies)]` error: could not compile `rustc_index` (lib) due to 1 previous error ``` The second was that `type_ir_macros` didn't fully specify its dependencies: ``` Testing stage1 {rustc_type_ir_macros} (aarch64-apple-darwin) Compiling rustc_type_ir_macros v0.0.0 (/Users/jyn/src/ferrocene3/compiler/rustc_type_ir_macros) error[E0432]: unresolved import `syn::visit_mut` --> compiler/rustc_type_ir_macros/src/lib.rs:2:10 | 2 | use syn::visit_mut::VisitMut; | ^^^^^^^^^ could not find `visit_mut` in `syn` | note: found an item that was configured out --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/syn-2.0.106/src/lib.rs:880:21 | 878 | #[cfg(feature = "visit-mut")] | --------------------- the item is gated behind the `visit-mut` feature 879 | #[cfg_attr(docsrs, doc(cfg(feature = "visit-mut")))] 880 | pub use crate::gen::visit_mut; | ^^^^^^^^^ error[E0433]: failed to resolve: could not find `visit_mut` in `syn` --> compiler/rustc_type_ir_macros/src/lib.rs:206:18 | 206 | syn::visit_mut::visit_type_path_mut(self, i); | ^^^^^^^^^ could not find `visit_mut` in `syn` | note: found an item that was configured out --> /Users/jyn/.local/lib/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/syn-2.0.106/src/lib.rs:880:21 | 878 | #[cfg(feature = "visit-mut")] | --------------------- the item is gated behind the `visit-mut` feature 879 | #[cfg_attr(docsrs, doc(cfg(feature = "visit-mut")))] 880 | pub use crate::gen::visit_mut; | ^^^^^^^^^ ``` --- compiler/rustc_index/Cargo.toml | 3 ++- compiler/rustc_type_ir_macros/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_index/Cargo.toml b/compiler/rustc_index/Cargo.toml index e46a1a7f7606f..edcd7816a60e0 100644 --- a/compiler/rustc_index/Cargo.toml +++ b/compiler/rustc_index/Cargo.toml @@ -8,7 +8,7 @@ edition = "2024" rustc_index_macros = { path = "../rustc_index_macros" } rustc_macros = { path = "../rustc_macros", optional = true } rustc_serialize = { path = "../rustc_serialize", optional = true } -smallvec = "1.8.1" +smallvec = { version = "1.8.1", optional = true } # tidy-alphabetical-end [features] @@ -17,6 +17,7 @@ default = ["nightly"] nightly = [ "dep:rustc_macros", "dep:rustc_serialize", + "dep:smallvec", "rustc_index_macros/nightly", ] rustc_randomized_layouts = [] diff --git a/compiler/rustc_type_ir_macros/Cargo.toml b/compiler/rustc_type_ir_macros/Cargo.toml index 15a5557509929..14bffa403a867 100644 --- a/compiler/rustc_type_ir_macros/Cargo.toml +++ b/compiler/rustc_type_ir_macros/Cargo.toml @@ -10,6 +10,6 @@ proc-macro = true # tidy-alphabetical-start proc-macro2 = "1" quote = "1" -syn = { version = "2.0.9", features = ["full"] } +syn = { version = "2.0.9", features = ["full", "visit-mut"] } synstructure = "0.13.0" # tidy-alphabetical-end