Stream: t-compiler/help

Topic: Why is `unsafe_derive_on_repr_packed` a query?


lcnr (May 17 2020 at 14:34, on Zulip):

https://github.com/rust-lang/rust/blob/7faeae0d385730e712634fb2af331ea0140771b4/src/librustc_middle/query/mod.rs#L390-L391

This is only called from check_unsafety in the same file it is declared, so this should not be necessary for the compile graph.
check_unsafety is only called during analysis https://github.com/rust-lang/rust/blob/7faeae0d385730e712634fb2af331ea0140771b4/src/librustc_interface/passes.rs#L839-L843

lcnr (May 17 2020 at 14:37, on Zulip):

THis means that check_unsafety should only be called exactly once for each body. As unsafe_derive_on_repr_packed is only called using this body id, it should both be faster and "cleaner" to use a boolean in check_unsafetyitself to prevent duplicates if I am not missing something

lcnr (May 17 2020 at 14:42, on Zulip):

Will just try and implement this myself :sparkles: Let's see if this breaks something

lcnr (May 17 2020 at 14:46, on Zulip):

if I am not missing something

Aaaa, we want to warn once for each impl, not once for each method. There are builtin impls containing multiple methods.

Last update: Sep 27 2020 at 13:30UTC