Stream: t-compiler/wg-diagnostics

Topic: how best to override "Trait not implemented for ..."

pnkfelix (Oct 04 2019 at 15:31, on Zulip):

I'm working on #63438, and currently my problem is that I get errors that say "the trait std::marker::Structural is not implemented for std::cell::Cell<&u32>"

pnkfelix (Oct 04 2019 at 15:31, on Zulip):

when what I would want to say is "to use a constant of type std::cell::Cell in a pattern, std::cell::Cell must be annotated with `#[derive(PartialEq, Eq)]"

pnkfelix (Oct 04 2019 at 15:32, on Zulip):

is there a standard way to achieve this sort of mis-direction in the compiler, in terms of saying "when this trait is not implemented, use this message instead" ?

pnkfelix (Oct 04 2019 at 15:33, on Zulip):

hmm, actually ... maybe I could just do the check in question without signalling an error ...

pnkfelix (Oct 04 2019 at 15:35, on Zulip):

yeah never mind me, I'm the one who put in a call to infcx.report_fulfillment_error; I can just not do that, I think

oli (Oct 07 2019 at 07:11, on Zulip):

we have rustc_on_unimplemented

oli (Oct 07 2019 at 07:12, on Zulip):

which I think is exactly for this case

pnkfelix (Oct 07 2019 at 08:05, on Zulip):

oh yeah, true

Last update: Mar 31 2020 at 02:55UTC