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

rustc --explain E0117 confusingly refers to Drop trait #69980

Closed
davepacheco opened this issue Mar 13, 2020 · 2 comments · Fixed by #69991
Closed

rustc --explain E0117 confusingly refers to Drop trait #69980

davepacheco opened this issue Mar 13, 2020 · 2 comments · Fixed by #69991

Comments

@davepacheco
Copy link

The detailed help for compiler error E0117 opens with this summary:

The Drop trait was implemented on a non-struct type.

The rest of the help output correctly (and clearly -- thank you!) explains what happened -- namely, that the user tried to violate the orphan rules for trait implementations. However that first line is confusing since it's apparently unrelated and wrong.

Here's a simple chunk of code that generates error E0117 (as expected):

impl From<String> for Result<String, String>
{
    fn from(s: String) -> Result<String, String>
    {
        Ok(s)
    }
}

Here it is on the playground:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=427d7c85706b598fa8232108769a8552

The error is expected. It's the help output that's confusing:

$ rustc +nightly --explain E0117 
The `Drop` trait was implemented on a non-struct type.

...

The content is also here: https://doc.rust-lang.org/error-index.html#E0117
and I think comes from here: https://github.com/rust-lang/rust/blob/master/src/librustc_error_codes/error_codes/E0117.md

@davepacheco davepacheco changed the title rustc --explain E0117" confusingly refers to Drop` trait rustc --explain E0117 confusingly refers to Drop trait Mar 13, 2020
@contrun
Copy link
Contributor

contrun commented Mar 14, 2020

I just checked the only place out of sync is the description in the markdown file. I created a pr for that. #69991

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 14, 2020
@bors bors closed this as completed in 191a796 Mar 15, 2020
@davepacheco
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants