E3049

E3049 — Two impls of the same trait for the same type: impl Describe for Point written twice, in one module or in two. A type has one impl of a trait, so a call could not choose between them. Remove one.

What the compiler reports

Error[E3049]: `impl Describe for Point` is written in '{{.*}}describe_{{left|right}}' and in '{{.*}}describe_{{left|right}}'

The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.

A program that triggers it

//
// Part of the Vx Project, under the Apache License v2.0 with LLVM Exceptions.
// See LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
// Two imported modules each implement `Describe` for `Point`. The error names both modules,
// and comes even though the program calls neither impl.
//
import tests::modules::describe_shape;
import tests::modules::describe_left;
import tests::modules::describe_right;

fn main() -> i32 {
  let p = make();
  return p.x;
}

From tests/frontend/fail/two_impls_of_a_trait_for_one_type_in_two_modules.vx, which asserts this diagnostic on every commit.

Related