-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Hi, i got this error message when using the rust-analyzer, but cargo build seems to be working fine.
My current project structure:
│ .env
│ .env.example
│ .gitignore
│ Cargo.lock
│ Cargo.toml
│ diesel.toml
│
├───.cargo
│ config.toml
│
├───.github
│ └───workflows
│ cargo-build-and-test.yaml
│
├───.vscode
│ settings.json
│
├───admin_api
│ │ Cargo.toml
│ │
│ └───src
│ │ lib.rs // Here is where the OpenApiDoc located, along with the utoipauto::utoipauto usage
│ │ main.rs
│ │ state.rs
│ │
│ └───users
│ │ mod.rs
│ │ user_dto.rs
│ │
│ ├───create
│ │ create_user.rs // this thing implements openapi::path
│ │ create_user_request.rs // this thing implements ToSchema
│ │ create_user_response.rs // this thing implements ToSchema
│ │ mod.rs
│ │
│ ├───get
│ │ get_user.rs // this thing implements openapi::path
│ │ get_user_request.rs // this thing implements ToSchema
│ │ get_user_response.rs // this thing implements ToSchema
│ │ mod.rs
│ │
│ └───list
│ list_user.rs // this thing implements openapi::path
│ list_user_request.rs // this thing implements ToSchema
│ list_user_response.rs // this thing implements ToSchema
│ mod.rs
│
├───domain
│ │ Cargo.toml
│ │
│ └───src
│ │ error.rs
│ │ lib.rs
│ │
│ ├───entities
│ │ auth_identity.rs
│ │ mod.rs
│ │ user.rs
│ │
│ ├───repositories
│ │ error.rs
│ │ mod.rs
│ │ user_repository.rs
│ │
│ └───types
│ mod.rs
│ pagination.rs
│
├───infrastructure
│ │ Cargo.toml
│ │
│ └───src
│ │ lib.rs
│ │
│ └───database
│ │ database_error.rs
│ │ database_pool.rs
│ │ mod.rs
│ │ schema.rs
│ │
│ ├───models
│ │ auth_identity.rs
│ │ mod.rs
│ │ user.rs
│ │
│ └───repositories
│ error_mapper.rs
│ mod.rs
│ user_repository_impl.rs
│
├───migrations
│ │ .keep
│ │
│ ├───00000000000000_diesel_initial_setup
│ │ down.sql
│ │ up.sql
│ │
│ ├───2025-08-19-144131_create_users_table
│ │ down.sql
│ │ up.sql
│ │
│ └───2025-08-19-144201_create_auth_identities_table
│ down.sql
│ up.sql
│
├───shared_kernel
│ │ Cargo.toml
│ │
│ └───src
│ │ lib.rs
│ │ logger.rs
│ │
│ ├───middlewares
│ │ logger_middleware.rs
│ │ mod.rs
│ │
│ └───validators
│ mod.rs
│ ulid_validator.rs
│
├───store_api
│ │ Cargo.toml
│ │
│ └───src
│ lib.rs
│ main.rs
│
├───tests
│ │ Cargo.toml
│ │
│ └───src
│ │ lib.rs
│ │
│ ├───end_to_end_tests
│ │ mod.rs
│ │
│ ├───functional_tests
│ │ mod.rs
│ │
│ ├───integration_tests
│ │ database_pool.rs
│ │ mod.rs
│ │ user_repository.rs
│ │
│ └───unit_tests
│ database_error.rs
│ mod.rs
│
└───use_cases
│ Cargo.toml
│
└───src
│ handler_traits.rs
│ lib.rs
│
└───admin_api
│ mod.rs
│
└───users
│ mod.rs
│ user_dto.rs
│
├───create
│ create_user_command.rs
│ create_user_handler.rs
│ mod.rs
│
├───get
│ get_user_handler.rs
│ get_user_query.rs
│ mod.rs
│
└───list
list_user_handler.rs
list_user_query.rs
mod.rs
Code for /admin_api/src/lib.rs
:
pub mod state;
pub mod users;
use utoipa::OpenApi;
use utoipauto::utoipauto;
#[utoipauto(
paths = "admin_api/src"
)]
#[derive(OpenApi)]
#[openapi(
tags(
(name = "Users", description = "API for managing users")
)
)]
pub struct GeneratedOpenAPIDoc;
but however, cargo check
seems to be working fine in this case:
❯ cargo check
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
and also cargo build
:
❯ cargo build
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.24s
Here's my current rust-analyzer settings:
{
"rust-analyzer.cargo.features": "all",
"rust-analyzer.check.features": "all",
"rust-analyzer.diagnostics.experimental.enable": true,
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.procMacro.attributes.enable": true,
"rust-analyzer.cargo.buildScripts.enable": true,
"rust-analyzer.cargo.buildScripts.rebuildOnSave": true,
"rust-analyzer.restartServerOnConfigChange": true,
"rust-analyzer.testExplorer": true
}
Fixes
However, i just figured out that by changing rust-analyzer.procMacro.attributes.enable
to false
actually fixed the problem, but it means that it ignored the procmacro attributes or it's turned off.
"rust-analyzer.procMacro.attributes.enable": false,
Is there a way to fix this while still having the rust-analyzer.procMacro.attributes.enable
enabled?
Additional Information:
OS: Windows 11 24H2
IDE: Windsurf (Visual Studio Code)
Metadata
Metadata
Assignees
Labels
No labels