Skip to content

Fix to #62194 broke the coherence tests and made error messages more mysterious #63145

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

Closed
arielb1 opened this issue Jul 30, 2019 · 2 comments · Fixed by #63264
Closed

Fix to #62194 broke the coherence tests and made error messages more mysterious #63145

arielb1 opened this issue Jul 30, 2019 · 2 comments · Fixed by #63264
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arielb1
Copy link
Contributor

arielb1 commented Jul 30, 2019

PR #62696 had removed the notes from the tests for the upstream/downstream printing logic, so now that logic is not tested:

2ced474

Plus, the new error messages are worse: an upstream impl can indeed be added, even if the crate is private.

I think that even in the OP case, some sort of note should be added, unless we change coherence. Again, the test case:

trait Private {
}

impl<T: Private> Send for T {
//~^ ERROR conflicting implementations
}

There, the error message is a coherence conflict for &_: Send, where this impl conflicts with the libcore impl, because the compiler can't prove that ! &_: Private.

Now, the error message says that the reason that the compiler can't prove ! &_ : Private is because of a possible downstream impl. Of course, no downstream impl can exist as the trait is private, however, I don't think we want to change coherence to account for that, especially not without an RFC.

Maybe a wording change is in order?

I don't think the "upstream" message needs to change any (see the test diff), it's still good in the private case. Maybe it should try to mention a non-private trait, but that would be some work.

Say, for non-exported trait, change the note to say:

note: unable to assume the type `&_` does not implement the trait `Private`

I'm not even sure the note is a problem, I personally like the state before the PR the best.

cc @estebank @nagisa

@arielb1 arielb1 added A-trait-system Area: Trait system A-diagnostics Area: Messages for errors, warnings, and lints labels Jul 30, 2019
@arielb1
Copy link
Contributor Author

arielb1 commented Jul 30, 2019

Actually, I think the version of the note I came up with is even more confusing than the "downstream crate" note, and the current version is worse than both.

@arielb1
Copy link
Contributor Author

arielb1 commented Jul 30, 2019

That PR was also submitted with no "positive" test to see that it fixes the error message it is purported to fix. That feels clearly wrong to me.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 30, 2019
arielb1 added a commit to arielb1/rust that referenced this issue Aug 3, 2019
I think that PR is a problem (rust-lang#63145), but this makes the tests green for now.
Centril added a commit to Centril/rust that referenced this issue Aug 5, 2019
…rors, r=estebank

Revert "Rollup merge of rust-lang#62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f (rust-lang#62696), reversing
changes made to cc16d04.

That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome!

Fixes rust-lang#63145.

r? @estebank
Centril added a commit to Centril/rust that referenced this issue Aug 6, 2019
…rors, r=estebank

Revert "Rollup merge of rust-lang#62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f (rust-lang#62696), reversing
changes made to cc16d04.

That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome!

Fixes rust-lang#63145.

r? @estebank
Centril added a commit to Centril/rust that referenced this issue Aug 6, 2019
…rors, r=estebank

Revert "Rollup merge of rust-lang#62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f (rust-lang#62696), reversing
changes made to cc16d04.

That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome!

Fixes rust-lang#63145.

r? @estebank
Centril added a commit to Centril/rust that referenced this issue Aug 6, 2019
…rors, r=estebank

Revert "Rollup merge of rust-lang#62696 - chocol4te:fix_#62194, r=estebank"

This reverts commit df21a6f (rust-lang#62696), reversing
changes made to cc16d04.

That PR makes error messages worse than before, and we couldn't come up with a way of actually making them better, so revert it for now. Any idea for making this error message better is welcome!

Fixes rust-lang#63145.

r? @estebank
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 A-trait-system Area: Trait system C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants