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

duplicated errors for invalid derives #34229

Closed
durka opened this issue Jun 11, 2016 · 3 comments
Closed

duplicated errors for invalid derives #34229

durka opened this issue Jun 11, 2016 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@durka
Copy link
Contributor

durka commented Jun 11, 2016

This code attempts to derive PartialOrd in an invalid situation, and is rewarded with a barrage of duplicate errors:

#[derive(PartialEq)] struct Comparable;
#[derive(PartialEq, PartialOrd)] struct Nope(Comparable);

The error the trait core::cmp::PartialOrd is not implemented for the type Comparable only appears once. However, the error binary operation < cannot be applied to type Comparable (along with note an implementation of std::cmp::PartialOrd might be missing for Comparable... gee, really?) appears eight times, four for < and four for >.

I assume this is because an error is generated at several points within the (invisible) generated PartialOrd implementation. But since they are all assigned the same span, maybe we can deduplicate.

@Mark-Simulacrum Mark-Simulacrum added the A-diagnostics Area: Messages for errors, warnings, and lints label Jun 23, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 25, 2017
@oli-obk
Copy link
Contributor

oli-obk commented Aug 21, 2017

Would the following be possible?:

  1. encounter T: Trait bound failure
  2. report error
  3. make T: Trait true for the further compilation

It doesn't address all cases, but it would significantly improve this one.

@arielb1 arielb1 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 25, 2017
@durka
Copy link
Contributor Author

durka commented Nov 1, 2017

Should this be a UI or compile-fail test? I think cfail is out of favor these days, but a UI test will have to include a bug: #45519 (comment)

@michaelwoerister
Copy link
Member

It should be a UI test, I'd say and we should fix that bug :)

estebank added a commit to estebank/rust that referenced this issue Oct 15, 2018
kennytm added a commit to kennytm/rust that referenced this issue Oct 18, 2018
bors added a commit that referenced this issue Oct 18, 2018
Rollup of 18 pull requests

Successful merges:

 - #54646 (improve documentation on std::thread::sleep)
 - #54933 (Cleanup the rest of codegen_llvm)
 - #54964 (Run both lldb and gdb tests)
 - #55016 (Deduplicate some code and compile-time values around vtables)
 - #55031 (Improve verify_llvm_ir config option)
 - #55050 (doc std::fmt: the Python inspiration is already mentioned in precedin…)
 - #55077 (rustdoc: Use dyn keyword when rendering dynamic traits)
 - #55080 (Detect if access to localStorage is forbidden by the user's browser)
 - #55090 (regression test for move out of borrow via pattern)
 - #55102 (resolve: Do not skip extern prelude during speculative resolution)
 - #55104 (Add test for #34229)
 - #55111 ([Rustc Book] Explain --cfg's arguments)
 - #55122 (Cleanup mir/borrowck)
 - #55127 (Remove HybridBitSet::dummy)
 - #55128 (Fix LLVMRustInlineAsmVerify return type mismatch)
 - #55142 (miri: layout should not affect CTFE checks (outside of validation))
 - #55151 (Cleanup nll)
 - #55161 ([librustdoc] Disable spellcheck for search field)
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 C-enhancement Category: An issue proposing an enhancement or a PR with one. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

5 participants