ronantakizawa/codereview-bench huggingface dataset:
Repository: rust-lang/rust
File: compiler/rustc_macros/src/diagnostics/mod.rs (Rust)

Code before:
mod diagnostic;
mod diagnostic_builder;
mod error;
mod message;
mod subdiagnostic;
mod utils;

use diagnostic::{DiagnosticDerive, LintDiagnosticDerive};
use proc_macro2::TokenStream;
use subdiagnostic::SubdiagnosticDerive;
use synstructure::Structure;

/// Implements `#[derive(Diagnostic)]`, which allows for errors to be specified as a struct,
/// independent from the actual diagnostics emitting code.
///
/// ```ignore (rust)
/// # extern crate rustc_errors;
/// # use rustc_errors::Applicability;
/// # extern crate rustc_span;
/// # use rustc_span::{Ident, Span};
/// # extern crate rust_middle;
/// # use rustc_middle::ty::Ty;
/// #[derive(Diagnostic)]
/// #[diag("this is an example message", code = E0123)]
/// struct MoveOutOfBorrowError<'tcx> {
///     name: Ident,
///     ty: Ty<'tcx>,
///     #[primary_span]
///     #[label("with a label")]
///     span: Span,
///     #[label("with a label")]
///     other_span: Span,
///     #[suggestion("with a suggestion", code = "{name}.clone()")]
///     opt_sugg: Option<(Span, Applicability)>,
/// }
/// ```
///
/// Then, later, to emit the error:
///
/// ```ignore (rust)
/// sess.emit_err(MoveOutOfBorrowError {
///     expected,
///     actual,
///     span,
///     first_borrow_span,
///     clone_sugg: Some(suggestion, Applicability::MachineApplicable),
/// });
/// ```
///
/// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`:

Review comment (suggestion):
maybe
```suggestion
/// struct ExampleError<'tcx> {
```

Code after:
mod diagnostic;
mod diagnostic_builder;
mod error;
mod message;
mod subdiagnostic;
mod utils;

use diagnostic::{DiagnosticDerive, LintDiagnosticDerive};
use proc_macro2::TokenStream;
use subdiagnostic::SubdiagnosticDerive;
use synstructure::Structure;

/// Implements `#[derive(Diagnostic)]`, which allows for errors to be specified as a struct,
/// independent from the actual diagnostics emitting code.
///
/// ```ignore (rust)
/// # extern crate rustc_errors;
/// # use rustc_errors::Applicability;
/// # extern crate rustc_span;
/// # use rustc_span::{Ident, Span};
/// # extern crate rust_middle;
/// # use rustc_middle::ty::Ty;
/// #[derive(Diagnostic)]
/// #[diag("this is an example message", code = E0123)]
/// pub(crate) struct ExampleError<'tcx> {
///     pub name: Ident,
///     pub ty: Ty<'tcx>,
///     #[primary_span]
///     #[label("with a label")]
///     pub span: Span,
///     #[label("with a label")]
///     pub other_span: Span,
///     #[suggestion("with a suggestion", code = "{name}.clone()")]
///     pub opt_sugg: Option<(Span, Applicability)>,
/// }
/// ```
///
/// Then, later, to emit the error:
///
/// ```ignore (rust)
/// sess.emit_err(ExampleError {
///     name, ty, span, other_span, opt_sugg
/// });
/// ```
///
/// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`:
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html>
pub(super) fn diagnostic_derive(s: Structure<'_>) -> TokenStream {
    DiagnosticDerive::new(s).into_tokens()
}
Repository: rust-lang/rust
File: tests/ui/const-generics/mgca/type-const-associated-default.rs (Rust)

Code before:
#![feature(min_generic_const_args)]
//~^ WARN the feature `min_generic_const_args` is incomplete
trait Trait {
    type const N: usize = 10;
    //~^ ERROR associated type defaults are unstable
}

fn main(){
}


Review comment (suggestion):
```suggestion
#![expect(incomplete_features)]
```

followed by reblessing the test expectations with `--bless`. This is just to safely suppress the unnecessary warning which makes the diff smaller, too.

Code after:
#![feature(min_generic_const_args)]
#![expect(incomplete_features)]
trait Trait {
    type const N: usize = 10;
    //~^ ERROR associated type defaults are unstable
}

fn main(){
}
Repository: rust-lang/rust
File: tests/ui/const-generics/mgca/struct-ctor-in-array-len.rs (Rust)

Code before:
// Regression test for https://github.com/rust-lang/rust/issues/141738
//
// Using a struct constructor as an array repeat count with
// `min_generic_const_args` used to ICE with "unexpected `DefKind`
// for const alias to resolve to: Ctor(Struct, Const)".
// It should now produce a proper type error.

#![feature(min_generic_const_args)]
//~^ WARN the feature `min_generic_const_args` is incomplete

struct S
where
    (): ;

fn main() {
    let _b = [0; S];
    //~^ ERROR the constant `S` is not of type `usize`
}


Review comment (suggestion):
I expect this where clause was unnecessary to reproduce the ICE
```suggestion
struct S;
```

Code after:
// Regression test for https://github.com/rust-lang/rust/issues/141738
//
// Using a struct constructor as an array repeat count with
// `min_generic_const_args` used to ICE with "unexpected `DefKind`
// for const alias to resolve to: Ctor(Struct, Const)".
// It should now produce a proper type error.

#![feature(min_generic_const_args)]
//~^ WARN the feature `min_generic_const_args` is incomplete

struct S;

fn main() {
    let _b = [0; S];
    //~^ ERROR the constant `S` is not of type `usize`
}
Repository: rust-lang/rust
File: compiler/rustc_macros/src/query.rs (Rust)

Code before:
        Ok(Query { doc_comments, modifiers, name, key, arg, result })
    }
}

/// A type used to greedily parse another type until the input is empty.
struct List<T>(Vec<T>);

impl<T: Parse> Parse for List<T> {
    fn parse(input: ParseStream<'_>) -> Result<Self> {
        let mut list = Vec::new();
        while !input.is_empty() {
            list.push(input.parse()?);
        }
        Ok(List(list))
    }
}

struct QueryModifiers {
    /// The description of the query.
    desc: (Ident, Option<Ident>, Punctuated<Expr, Token![,]>),

    /// Use this type for the in-memory cache.
    arena_cache: Option<Ident>,

    /// Cache the query to disk if the `Block` returns true.
    cache: Option<(Ident, Option<Pat>, Block)>,

    /// A cycle error for this query aborting the compilation with a fatal error.
    cycle_fatal: Option<Ident>,

    /// A cycle error results in a delay_bug call
    cycle_delay_bug: Option<Ident>,

    /// A cycle error results in a stashed cycle error that can be unstashed and canceled later
    cycle_stash: Option<Ident>,

    /// Don't hash the result, instead just mark a query red if it runs
    no_hash: Option<Ident>,

    /// Generate a dep node based on the dependencies of the query
    anon: Option<Ident>,

    /// Always evaluate the query, ignoring its dependencies
    eval_always: Option<Ident>,

    /// Whether the query has a call depth limit
    depth_limit: Option<Ident>,

    /// Use a separate query provider for local and extern crates
    separate_provide_extern: Option<Ident>,


Review comment (suggestion):
This will need a rebase on top of https://github.com/rust-lang/rust/pull/151943.

Also I'd use a struct here, as with `desc`.

Code after:
        Ok(Query { doc_comments, modifiers, name, key, arg, result })
    }
}

/// A type used to greedily parse another type until the input is empty.
struct List<T>(Vec<T>);

impl<T: Parse> Parse for List<T> {
    fn parse(input: ParseStream<'_>) -> Result<Self> {
        let mut list = Vec::new();
        while !input.is_empty() {
            list.push(input.parse()?);
        }
        Ok(List(list))
    }
}

struct Desc {
    modifier: Ident,
    tcx_binding: Option<Ident>,
    expr_list: Punctuated<Expr, Token![,]>,
}

struct CacheOnDiskIf {
    modifier: Ident,
    tcx_binding: Option<Pat>,
    block: Block,
}

struct QueryModifiers {
    /// The description of the query.
    desc: Desc,

    /// Use this type for the in-memory cache.
    arena_cache: Option<Ident>,

    /// Cache the query to disk if the `Block` returns true.
    cache_on_disk_if: Option<CacheOnDiskIf>,

    /// A cycle error for this query aborting the compilation with a fatal error.
    cycle_fatal: Option<Ident>,

    /// A cycle error results in a delay_bug call
    cycle_delay_bug: Option<Ident>,

    /// A cycle error results in a stashed cycle error that can be unstashed and canceled later
    cycle_stash: Option<Ident>,

    /// Don't hash the result, instead just mark a query red if it runs
    no_hash: Option<Ident>,
Repository: rust-lang/rust
File: compiler/rustc_middle/src/query/modifiers.rs (Rust)

Code before:
//! This contains documentation which is linked from query modifiers used in the `rustc_queries!` proc macro.
#![allow(unused, non_camel_case_types)]

/// # `desc` query modifier
///
/// The description of the query. This modifier is required on every query.
pub struct desc;

/// # `arena_cache` query modifier
///
/// Use this type for the in-memory cache.
pub struct arena_cache;

/// # `cache_on_disk_if` query modifier
///
/// Cache the query to disk if the `Block` returns true.
pub struct cache_on_disk_if;

/// # `cycle_fatal` query modifier
///
/// A cycle error for this query aborting the compilation with a fatal error.
pub struct cycle_fatal;

/// # `cycle_delay_bug` query modifier
///
/// A cycle error results in a delay_bug call

Review comment (suggestion):
Since the PR needs a rebase, could you please also add a short FIXME here noting that some of the modifier descriptions might be unclear or outdated.

Code after:
//! This contains documentation which is linked from query modifiers used in the `rustc_queries!` proc macro.
#![allow(unused, non_camel_case_types)]
// FIXME: Update and clarify documentation for these modifiers.

/// # `desc` query modifier
///
/// The description of the query. This modifier is required on every query.
pub struct desc;

/// # `arena_cache` query modifier
///
/// Use this type for the in-memory cache.
pub struct arena_cache;

/// # `cache_on_disk_if` query modifier
///
/// Cache the query to disk if the `Block` returns true.
pub struct cache_on_disk_if;

/// # `cycle_fatal` query modifier
///
/// A cycle error for this query aborting the compilation with a fatal error.
pub struct cycle_fatal;

/// # `cycle_delay_bug` query modifier
///
Repository: rust-lang/rust
File: tests/ui/test-attrs/test-passed.rs (Rust)

Code before:
//@ no-prefer-dynamic
//@ compile-flags: --test
//@ run-flags: --test-threads=1
//@ run-pass
//@ check-run-results
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ reference: attributes.testing.test.intro

// Tests the output of the test harness with only passed tests.

#![cfg(test)]

#[test]
fn it_works() {
    assert_eq!(1 + 1, 2);
}

#[test]
fn it_works_too() {
    assert_eq!(1 * 0, 0);
}


Review comment (suggestion):
I think this rule might be more specific here, since this is testing the reporting of the success behavior.

```suggestion
//@ reference: attributes.testing.test.success
```

Code after:
//@ no-prefer-dynamic
//@ compile-flags: --test
//@ run-flags: --test-threads=1
//@ run-pass
//@ check-run-results
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ reference: attributes.testing.test.success

// Tests the output of the test harness with only passed tests.

#![cfg(test)]

#[test]
fn it_works() {
    assert_eq!(1 + 1, 2);
}

#[test]
fn it_works_too() {
    assert_eq!(1 * 0, 0);
}
Repository: rust-lang/rust
File: compiler/rustc_query_impl/src/job.rs (Rust)

Code before:
use rustc_span::{DUMMY_SP, Span};

use crate::QueryCtxt;
use crate::dep_graph::DepContext;

/// Map from query job IDs to job information collected by
/// `collect_active_jobs_from_all_queries`.
#[derive(Debug, Default)]
pub struct QueryJobMap<'tcx> {
    map: FxHashMap<QueryJobId, QueryJobInfo<'tcx>>,
}

impl<'tcx> QueryJobMap<'tcx> {
    /// Adds information about a job ID to the job map.
    ///
    /// Should only be called by `gather_active_jobs_inner`.
    pub(crate) fn insert(&mut self, id: QueryJobId, info: QueryJobInfo<'tcx>) {
        self.map.insert(id, info);
    }

    fn get(&self, id: QueryJobId) -> Option<&QueryJobInfo<'tcx>> {
        self.map.get(&id)
    }

    fn frame_of(&self, id: QueryJobId) -> &QueryStackFrame<QueryStackDeferred<'tcx>> {
        &self.map.get(&id).unwrap().frame
    }

    fn span_of(&self, id: QueryJobId) -> Span {
        self.map.get(&id).unwrap().job.span
    }

    fn parent_of(&self, id: QueryJobId) -> Option<QueryJobId> {
        self.map.get(&id).unwrap().job.parent
    }

    fn latch_of(&self, id: QueryJobId) -> Option<&QueryLatch<'tcx>> {
        self.map.get(&id).unwrap().job.latch.as_ref()
    }
}

#[derive(Clone, Debug)]
pub(crate) struct QueryJobInfo<'tcx> {
    pub(crate) frame: QueryStackFrame<QueryStackDeferred<'tcx>>,
    pub(crate) job: QueryJob<'tcx>,
}

pub(crate) fn find_cycle_in_stack<'tcx>(
    id: QueryJobId,
    job_map: QueryJobMap<'tcx>,
    current_job: &Option<QueryJobId>,

Review comment (suggestion):
```suggestion
        &self.map[&id].frame
```
?

And in other cases too.

Code after:
use rustc_span::{DUMMY_SP, Span};

use crate::QueryCtxt;
use crate::dep_graph::DepContext;

/// Map from query job IDs to job information collected by
/// `collect_active_jobs_from_all_queries`.
#[derive(Debug, Default)]
pub struct QueryJobMap<'tcx> {
    map: FxHashMap<QueryJobId, QueryJobInfo<'tcx>>,
}

impl<'tcx> QueryJobMap<'tcx> {
    /// Adds information about a job ID to the job map.
    ///
    /// Should only be called by `gather_active_jobs_inner`.
    pub(crate) fn insert(&mut self, id: QueryJobId, info: QueryJobInfo<'tcx>) {
        self.map.insert(id, info);
    }

    fn frame_of(&self, id: QueryJobId) -> &QueryStackFrame<QueryStackDeferred<'tcx>> {
        &self.map[&id].frame
    }

    fn span_of(&self, id: QueryJobId) -> Span {
        self.map[&id].job.span
    }

    fn parent_of(&self, id: QueryJobId) -> Option<QueryJobId> {
        self.map[&id].job.parent
    }

    fn latch_of(&self, id: QueryJobId) -> Option<&QueryLatch<'tcx>> {
        self.map[&id].job.latch.as_ref()
    }
}

#[derive(Clone, Debug)]
pub(crate) struct QueryJobInfo<'tcx> {
    pub(crate) frame: QueryStackFrame<QueryStackDeferred<'tcx>>,
    pub(crate) job: QueryJob<'tcx>,
}

pub(crate) fn find_cycle_in_stack<'tcx>(
    id: QueryJobId,
    job_map: QueryJobMap<'tcx>,
    current_job: &Option<QueryJobId>,
    span: Span,
) -> CycleError<QueryStackDeferred<'tcx>> {
    // Find the waitee amongst `current_job` parents
    let mut cycle = Vec::new();
Repository: rust-lang/rust
File: compiler/rustc_expand/src/errors.rs (Rust)

Code before:
    "there's a macro argument with a similar name",
    applicability = "maybe-incorrect",
    style = "verbose"
)]
pub(crate) struct VarTypoSuggestionRepeatable {
    #[suggestion_part(code = "{name}")]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Subdiagnostic)]
#[label("argument not found")]
pub(crate) struct VarTypoSuggestionUnrepeatable {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("this similarly named macro argument is unrepeatable")]
pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("expected one of repeatable variables arguments: {$msg}")]
pub(crate) struct VarNoTypo {
    #[primary_span]
    pub span: Span,
    pub msg: String,
}

#[derive(Subdiagnostic)]
#[label("variable is not repeatable and there are no repeatable variable arguments")]
pub(crate) struct NoRepeatableVar {
    #[primary_span]
    pub span: Span,
}

#[derive(Diagnostic)]
#[diag("this must repeat at least once")]
pub(crate) struct MustRepeatOnce {
    #[primary_span]
    pub span: Span,
}

#[derive(Diagnostic)]
#[diag("`count` can not be placed inside the innermost repetition")]
pub(crate) struct CountRepetitionMisplaced {
    #[primary_span]
    pub span: Span,

Review comment (suggestion):
Looking at the reference, it seems we refer to these as "metavariables": https://doc.rust-lang.org/reference/macros-by-example.html#metavariables
```suggestion
#[label("expected a repeatable metavariable: {$msg}")]
```

Code after:
    "there's a macro metavariable with a similar name",
    applicability = "maybe-incorrect",
    style = "verbose"
)]
pub(crate) struct VarTypoSuggestionRepeatable {
    #[suggestion_part(code = "{name}")]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Subdiagnostic)]
#[label("argument not found")]
pub(crate) struct VarTypoSuggestionUnrepeatable {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("this similarly named macro metavariable is unrepeatable")]
pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("expected a repeatable metavariable: {$msg}")]
pub(crate) struct VarNoTypo {
    #[primary_span]
    pub span: Span,
    pub msg: String,
}

#[derive(Subdiagnostic)]
#[label(
    "this macro metavariable is not repeatable and there are no other repeatable metavariables"
)]
pub(crate) struct NoRepeatableVar {
    #[primary_span]
    pub span: Span,
}

#[derive(Diagnostic)]
#[diag("this must repeat at least once")]
pub(crate) struct MustRepeatOnce {
    #[primary_span]
    pub span: Span,
}

#[derive(Diagnostic)]
#[diag("`count` can not be placed inside the innermost repetition")]
pub(crate) struct CountRepetitionMisplaced {
Repository: rust-lang/rust
File: compiler/rustc_expand/src/errors.rs (Rust)

Code before:
#[derive(LintDiagnostic)]
#[diag("`#[cfg_attr]` does not expand to any attributes")]
pub(crate) struct CfgAttrNoAttributes;

#[derive(Diagnostic)]
#[diag(
    "attempted to repeat an expression containing no syntax variables matched as repeating at this depth"
)]
pub(crate) struct NoSyntaxVarsExprRepeat {
    #[primary_span]
    pub span: Span,
    #[subdiagnostic]
    pub typo_repeatable: Option<VarTypoSuggestionRepeatable>,
    #[subdiagnostic]
    pub typo_unrepeatable: Option<VarTypoSuggestionUnrepeatable>,
    #[subdiagnostic]
    pub typo_unrepeatable_label: Option<VarTypoSuggestionUnrepeatableLabel>,
    #[subdiagnostic]
    pub var_no_typo: Option<VarNoTypo>,
    #[subdiagnostic]
    pub no_repeatable_var: Option<NoRepeatableVar>,
}

#[derive(Subdiagnostic)]
#[multipart_suggestion(
    "there's a macro argument with a similar name",
    applicability = "maybe-incorrect",
    style = "verbose"
)]
pub(crate) struct VarTypoSuggestionRepeatable {
    #[suggestion_part(code = "{name}")]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Subdiagnostic)]
#[label("argument not found")]
pub(crate) struct VarTypoSuggestionUnrepeatable {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("this similarly named macro argument is unrepeatable")]
pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("expected one of repeatable variables arguments: {$msg}")]

Review comment (suggestion):
```suggestion
    "there's a macro metavariable with a similar name",
```

Code after:
#[derive(LintDiagnostic)]
#[diag("`#[cfg_attr]` does not expand to any attributes")]
pub(crate) struct CfgAttrNoAttributes;

#[derive(Diagnostic)]
#[diag(
    "attempted to repeat an expression containing no syntax variables matched as repeating at this depth"
)]
pub(crate) struct NoSyntaxVarsExprRepeat {
    #[primary_span]
    pub span: Span,
    #[subdiagnostic]
    pub typo_repeatable: Option<VarTypoSuggestionRepeatable>,
    #[subdiagnostic]
    pub typo_unrepeatable: Option<VarTypoSuggestionUnrepeatable>,
    #[subdiagnostic]
    pub typo_unrepeatable_label: Option<VarTypoSuggestionUnrepeatableLabel>,
    #[subdiagnostic]
    pub var_no_typo: Option<VarNoTypo>,
    #[subdiagnostic]
    pub no_repeatable_var: Option<NoRepeatableVar>,
}

#[derive(Subdiagnostic)]
#[multipart_suggestion(
    "there's a macro metavariable with a similar name",
    applicability = "maybe-incorrect",
    style = "verbose"
)]
pub(crate) struct VarTypoSuggestionRepeatable {
    #[suggestion_part(code = "{name}")]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Subdiagnostic)]
#[label("argument not found")]
pub(crate) struct VarTypoSuggestionUnrepeatable {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("this similarly named macro metavariable is unrepeatable")]
pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("expected a repeatable metavariable: {$msg}")]
Repository: rust-lang/rust
File: compiler/rustc_expand/src/errors.rs (Rust)

Code before:
    pub var_no_typo: Option<VarNoTypo>,
    #[subdiagnostic]
    pub no_repeatable_var: Option<NoRepeatableVar>,
}

#[derive(Subdiagnostic)]
#[multipart_suggestion(
    "there's a macro argument with a similar name",
    applicability = "maybe-incorrect",
    style = "verbose"
)]
pub(crate) struct VarTypoSuggestionRepeatable {
    #[suggestion_part(code = "{name}")]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Subdiagnostic)]
#[label("argument not found")]
pub(crate) struct VarTypoSuggestionUnrepeatable {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("this similarly named macro argument is unrepeatable")]
pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("expected one of repeatable variables arguments: {$msg}")]
pub(crate) struct VarNoTypo {
    #[primary_span]
    pub span: Span,
    pub msg: String,
}

#[derive(Subdiagnostic)]
#[label("variable is not repeatable and there are no repeatable variable arguments")]
pub(crate) struct NoRepeatableVar {
    #[primary_span]
    pub span: Span,
}

#[derive(Diagnostic)]
#[diag("this must repeat at least once")]
pub(crate) struct MustRepeatOnce {
    #[primary_span]
    pub span: Span,

Review comment (suggestion):
```suggestion
#[label("this similarly named macro metavariable is unrepeatable")]
```

Code after:
    pub var_no_typo: Option<VarNoTypo>,
    #[subdiagnostic]
    pub no_repeatable_var: Option<NoRepeatableVar>,
}

#[derive(Subdiagnostic)]
#[multipart_suggestion(
    "there's a macro metavariable with a similar name",
    applicability = "maybe-incorrect",
    style = "verbose"
)]
pub(crate) struct VarTypoSuggestionRepeatable {
    #[suggestion_part(code = "{name}")]
    pub span: Span,
    pub name: Symbol,
}

#[derive(Subdiagnostic)]
#[label("argument not found")]
pub(crate) struct VarTypoSuggestionUnrepeatable {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("this similarly named macro metavariable is unrepeatable")]
pub(crate) struct VarTypoSuggestionUnrepeatableLabel {
    #[primary_span]
    pub span: Span,
}

#[derive(Subdiagnostic)]
#[label("expected a repeatable metavariable: {$msg}")]
pub(crate) struct VarNoTypo {
    #[primary_span]
    pub span: Span,
    pub msg: String,
}

#[derive(Subdiagnostic)]
#[label(
    "this macro metavariable is not repeatable and there are no other repeatable metavariables"
)]
pub(crate) struct NoRepeatableVar {
    #[primary_span]
    pub span: Span,
}

#[derive(Diagnostic)]
#[diag("this must repeat at least once")]
pub(crate) struct MustRepeatOnce {