-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
How to handle reservation impls in rustdoc / error messages #64633
Comments
My take: We should not show reservation impls in rustdoc at all. They don't exist and they may never exist. I'm not convinced users want to see them. Moreover, they are only relevant if you're trying to rely on negative reasoning about |
The current error message is this:
I think this is pretty clearly not good enough. However, I also don't think we're going to do a lot better in the error message. I suggest opening an issue for each use of
|
Nominating for @rust-lang/lang discussion -- I'd love to get feedback on how to handle these errors, so that we can land this feature and unblock the |
@nikomatsakis That error text sounds good to me. |
I think diagnostics and rustdoc is squarely a T-compiler and T-rustdoc matter. I have no opinion other than to say that @nikomatsakis's suggestion seems reasonable but this is not my decision to make. |
I think there ought to be documentation of "you may not make any impl like this" somewhere. How about this: we lint on a |
I'm not 100% sure what you are suggesting. I think maybe you are suggesting we extend the documentation of the "Note that we intend to add We could do that, though it feels like a lot of work to extend rustdoc in that way. We could also of course just extend the docs for I guess I still sort of feel like it's better not to throw this at users until they need to know about it. (I could see documenting the special treatment in the rust reference or something, though.) |
I created #64715 as a first stab at a "user-readable" tracking issue. |
@nikomatsakis I think I'm just suggesting that we have a doc comment on the reservation impl, and put the contents of that doc comment (however we choose to explain it) in the documentation. That doesn't seem like it would be a huge amount of change to rustdoc to just add that one comment. |
First, we should definitely cc @QuietMisdreavus at minimum -- not sure what is the best alias for rustdoc folks? In any case, @joshtriplett, that seems pretty reasonable. In fact, I see rustdoc is already including doc comments, so I'll push a quick comment on the one existing impl. The main question then is whether to "badge" the impl or something (maybe just mark it as unstable). |
cc @rust-lang/rustdoc |
I think that the more polished version would basically have some "canned comment" that is added by rustdoc itself. The attribute has this form today: #[rustc_reservation_impl="permitting this impl would forbid us from adding \
`impl<T> From<!> for T` later; see rust-lang/rust#64715 for details"] so we could just include that text in rustdoc, perhaps creating a hyperlink for #64715. But it's not like we expect to add a lot of these impls, so a doc comment also seems ok for now. |
We tend to implement things when we're somewhat sure that they'll get merged. However, if you need it, we can always talk about it? |
I've opened this issue for discussion on how to handle reservation impls (see #64631) in rustdoc and how to handle their error messages.
The text was updated successfully, but these errors were encountered: