Skip to content

t27c check is silent on a spec that declares the same top-level name twice #3438

Description

@gHashTag

What

specs/ml/optimizer/adamw.t27 does not declare AdamWConfig:

$ grep -c 'struct AdamWConfig' specs/ml/optimizer/adamw.t27
0

but the generated Rust declares it twice:

$ t27c gen-rust specs/ml/optimizer/adamw.t27 | grep -c 'pub struct AdamWConfig'
2

so the module cannot compile:

error[E0119]: conflicting implementations of trait `Debug` for type `AdamWConfig`
   --> :119:10
    |
 25 | #[derive(Debug, Clone, Copy)]
    |          ----- first implementation here
...
119 | #[derive(Debug, Clone, Copy)]

The type arrives through the spec's use list:

use base::types;
use math::constants;
use numeric::gf16;

Three structs are affected in this file -- AdamWConfig, AdamWState,
OptimizerStepResult -- one E0119 per derived trait per duplicate.

Why it is worth a separate issue

The error count moves with unrelated work. Adding a third derived trait to
these structs raised E0119 from 6 to 7 while fixing #3436, which looked like
a regression in that change and is not one -- the file fails to compile either
way. A duplicate emission that inflates counts on someone else's diff is worth
removing on its own.

Where to look

bootstrap/src/use_resolve.rs. by_origin groups candidates and the emitter
takes distinct[0]; #3411 made that choice deterministic but did not ask
whether a name can reach the output through two paths at once.

Not yet measured

How many specs carry a duplicate declaration. E0119 appears in 1 file today,
but that only counts duplicates whose derives conflict -- a duplicated fn
would surface as E0428 instead, and that has not been separated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions