rust-lang / rust-lang/rust

register_tool is silently overridden by actual modules

Open
#137,743 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-tool-attributes F-register_tool T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(register_tool)]
#![register_tool(tokio)]
use tokio;

#[tokio::tool_attr]
fn main() {}
Current output
error[E0433]: failed to resolve: could not find `tool_attr` in `tokio`
 --> src/main.rs:5:10
  |
5 | #[tokio::tool_attr]
  |          ^^^^^^^^^ could not find `tool_attr` in `tokio`

For more information about this error, try `rustc --explain E0433`.
Desired output
error[E0433]: failed to resolve: could not find `tool_attr` in `tokio`
 --> src/main.rs:5:10
  |
5 | #[tokio::tool_attr]
  |          ^^^^^^^^^ could not find `tool_attr` in `tokio`
 note: tool namespace overridden by actual module

For more information about this error, try `rustc --explain E0433`.
Rationale and extra context

No response

Other cases

Rust Version
1.87.0-nightly

(2025-02-26 00f245915b0c7839d42c)
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided register_tool and tokio module example on the stated nightly Rust version. Trace the compiler's tool-namespace resolution and diagnostic path; done means the unresolved tool attribute still reports E0433 and adds the requested note that the tool namespace was overridden by an actual module.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.