Skip to content

useless errors with macro in a separate crate #39413

Closed
@durka

Description

@durka

TL;DR: I'm annoyed about note: this error originates in a macro outside of the current crate and want a way to turn it off and get back the error backtrace that tells me where the problem is.

I separated some of my utility code and macros into a utils crate for faster compile times. In this error, I have a macro in there rpc!, which invokes another macro, guilty!. This requires the crate that invokes rpc! to also import the crate that defines guilty!, but I forgot to do that. However, the error message gives me no way to find that out because it doesn't show where the error actually occurs within the rpc! macro:

error: macro undefined: 'guilty!'
   --> crates/back/flow/src/lib.rs:374:17
    |
374 |                 assert!(rpc!(tx, CmdFrom::Start, service.clone(), data.clone()).unwrap());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro outside of the current crate

In this case I wrote all the crates in question. But even if I didn't, and I were going to submit a bug to the author of rpc!, there's no useful information in this error message. Can there be a way to get back the error information, either by a compiler switch or using cargo's workspace feature or something?

cc @jonathandturner

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions