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

#[derive] for custom traits is being depreciated #421

Closed
elliotekj opened this issue Jan 24, 2017 · 8 comments
Closed

#[derive] for custom traits is being depreciated #421

elliotekj opened this issue Jan 24, 2017 · 8 comments

Comments

@elliotekj
Copy link

elliotekj commented Jan 24, 2017

Firstly, to everyone who has contributed to this book, thank you. I'm thoroughly enjoying it so far.

As per an error when compiling with Rust 1.14.0 (e8a012324 2016-12-16), #[derive] for custom traits is not considered stable enough for use and is being removed in v1.15. It's actual removal still seems a little in flux an Rust nightly is in v1.16 and has yet to see it's removal. As things stand at the moment though, listing 5-6 in the structs chapter will fail to compile.

@steveklabnik
Copy link
Member

Glad to hear it!

This does compile for me though: https://is.gd/R1rnwF

Could you maybe share what you're seeing exactly?

@elliotekj
Copy link
Author

@steveklabnik I have to apologise. I thought I'd written it out correctly from the book, but coming back to it I see I forgot to capitalise the D of Debug. I saw the error and didn't investigate further. Below is what I was seeing though. Come to think of it, perhaps Debug isn't a custom trait? I'm not far enough along with the language to know. It goes without saying that if that is indeed the case, this issue can be closed as a rookie error.

screen shot 2017-01-24 at 21 30 21

@steveklabnik
Copy link
Member

Come to think of it, perhaps Debug isn't a custom trait?

Yup! It's built into the compiler. The lower case d would cause Rust to not recognize what it is; that'd be a trait with a totally different name.

@carols10cents do you think it's worth adding some kind of warning here? I could go either way.

@elliotekj
Copy link
Author

elliotekj commented Jan 25, 2017

That explains it then, thanks!

@carols10cents
Copy link
Member

Yeah, I think the warning should be from the compiler, not in the book. I'm not sure why you got rid of that part of your comment @elliotekj, but I saw it in my email and think it's good!

Mistyping anything anywhere from the book could result in unexpected errors, so I don't know if it's worth it to try and anticipate any typos :)

@elliotekj
Copy link
Author

@carols10cents I removed it because, after posting, I realized that @steveklabnik was talking about a warning in the book, not in the compiler. I didn't want the issue to get muddled :) If this is an appropriate place to recommend a warning going into the compiler then I stand by the suggestion though.

@carols10cents
Copy link
Member

@elliotekj it should go in https://github.com/rust-lang/rust/issues, really. Would you mind creating an issue over there, with something along the lines of what you originally had in that one comment of yours plus the context in which you encountered this? Here's your comment in case it's not in your email:

Regarding adding a warning, for what it's worth, in other compile errors I've come across in Rust, there are sometimes suggestions along the lines of "Did you mean X?". If custom traits are going to be depreciated and therefore a custom (lowercase) debug trait couldn't actually be created, a suggestion that the trait's name might be misspelled when the program fails to compile seems helpful to me personally.

I'm going to close this issue though :)

@elliotekj
Copy link
Author

@carols10cents No problem at all. Thanks for the help :)

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

No branches or pull requests

3 participants