Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to pull labels from a collection using proc macros? #315

Closed
KAAtheWiseGit opened this issue Nov 4, 2023 · 1 comment
Closed
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@KAAtheWiseGit
Copy link

Good day!

I have an enum with #[derive(Diagnostic)]. I am trying to add an error type, which can have several spans sourced from a collection:

pub enum ShellError {
    ...
    #[error("{0}")]
    #[diagnostic()]
    GenericError(
        String,
        #[label("{1}")]
        Vec<SourceSpan>,  // a vector with several spans
    ),

Is there a way to achieve this with proc macros?

@zkat zkat added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 4, 2024
@zkat
Copy link
Owner

zkat commented Feb 4, 2024

Not right now, but being able to do this sounds great! :)

Nahor added a commit to Nahor/miette that referenced this issue Feb 16, 2024
Nahor added a commit to Nahor/miette that referenced this issue Feb 16, 2024
Allow errors to have a number of labels determined at runtime.
An example of this is when the rust compiler labels all the arms of
a `match` expression when one of them has an incompatible type
@zkat zkat closed this as completed in 0306024 Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants