nox: hmm, where did you add the comments? I made a branch out of everything which doesn't have your comments in
nox
centril: In the hackmd thing.
centril: In the warnings section.
centril
nox: just there?
nox
Yes.
centril
aight, ill figure out the delta
nox
I’ll go back to my computer once I finish my coffee.
centril
=)
paulgdp has quit
nox: hmm, on "5. `#[field_bound]` is specified on a field which is less visible than the type which contains the field." -- if you do that, you will get a compiler error
things referenced in a where clause can't be less visible than the type for which they are implemented
drchaos has quit
nox
centril: You said the *field*.
centril: So I'm confused as to what that point means then.
centril: And you can't know if the field *types* (as opposed to the fields themselves) are less private or not than the type in which that field is.
centril
nox: if you have struct Bar<T>(..); pub struct Foo<T> { #[field_bound] field: Bar<T> } then you have a problem
nox
centril: Yes, and the derive can't know that.
centril: So you have a warning and an error for the same problem, and that's confusing.
centril
nox: no, but rustc can
nox
Hence why I think the attribute shouldn't emit any additional warning.
centril: And what you wrote doesn't correspond to '5.' IMO.
Your snippet is about the field *type* being less visible than the type Foo<T>.
Not the *field* being less visible than the type Foo<T>.
centril
note: these warnings are not issued by the derive macro, but by rustc
nox: oh, now I get it
ill rephrase
nox
centril: I understand they are not issued by the derive macro,
centril: but that will still generate 2 things for a single issue,
and that's not helpful, that's confusing, IMO.
struct Bar<T>(T); pub struct Foo<T> { field: Bar<T> } impl<T> Foo<T> where Bar<T>: Clone {} is already a compile error because Bar<T> isn't public,
point 5 seems to say we should emit an additional warning even though there is already an error.
centril
nox: hmm... perhaps then rustc should generate errors when one of 1-7 happens
so the user gets a *better* error message
nox
centril: You mean warning vs error?
centril: Seems fair.
centril
good good
nox
centril: What do you think of my other remark in that section?
centril
nox: not sure I understand it
nox
centril: #[proc_macro_derive(Foo, attributes(…))]
centril
ah, the macro declares that it uses field_bound in attributes
nox
centril: If field_bound isn't in attributes(...), #[field_bound(Foo)] used in a type for which there is #[derive(Foo)] should trigger a warning (or an error).
Aaronepower has quit
centril: Yeah. Just reusing existing stuff for better compilation diagnostics.
centril
nox: yeah that seems like it would reduce headaches of users