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

Report same/similar errors only once #28098

Closed
tyoc213 opened this issue Aug 30, 2015 · 1 comment
Closed

Report same/similar errors only once #28098

tyoc213 opened this issue Aug 30, 2015 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@tyoc213
Copy link
Contributor

tyoc213 commented Aug 30, 2015

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).

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Sep 3, 2015
@eddyb
Copy link
Member

eddyb commented Sep 24, 2015

Minimal examples:

fn main() {
    Iterator::next(&mut false); // 2 errors
}
fn main() {
    for _ in false {} // 3 errors
}

Interestingly enough, when put in the same program, the total number of errors is 4, not 5 (due to some global cache?).
cc @arielb1

brson pushed a commit to brson/rust that referenced this issue Oct 16, 2015
Because of type inference, duplicate obligations exist and cause duplicate
errors. To avoid this, only display the first error for each (predicate,span).

The inclusion of the span is somewhat bikesheddy, but *is* the more
conservative option (it does not remove some instability, as duplicate
obligations are ignored by `duplicate_set` under some inference conditions).

Fixes rust-lang#28098
cc rust-lang#21528 (is it a dupe?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants