Skip to content

Report same/similar errors only once #28098

Closed
@tyoc213

Description

@tyoc213

It seems that #20692 is not only a case for duplicate error messages as shown by

fn main() {
    let array = [1, 2, 3];
    for a in array {
        println!( "{}", a);
    }
}

Which print the error 3 times.

It is the same as the other case about map

pub fn object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>,
trait_def_id: ast::DefId)
-> Vec<ObjectSafetyViolation<'tcx>>
{
traits::supertrait_def_ids(tcx, trait_def_id)
.flat_map(|def_id| object_safety_violations_for_trait(tcx, def_id).into_iter())
.collect()
}

originally spot at https://users.rust-lang.org/t/iterator-and-differences-between-array-and-array/2672


I think implementing distinctso that you can collect only the different items could be a good way to start solving this in the board way (all across scala error reporting).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions