Cancer - especially a curable one! - is different from mental illness. First of all, in our society as it is right now cancer patients are on the receiving end of a whole lot of empathy/sympathy/concern/encouragement/support ("we care about you, and you can do it!"), while there is still significant stigma against people with mental health issues, as if these are moral failings/defects of character ("why are you lying in bed all day, you lazy ass? Get it together!") (ha, well, I'm not talking about personality disorders here, but rather about something like depression). Second, unlike a cancer that was cured (knock on wood), most mental illnesses are likely to recur, especially under stress - and residency programs, understandably, don't want a resident who may need to take time off because of an illness. It sucks, but that's the way it is.
That said, some programs are more supportive than others. I know people who did residency at one of the evil ivory towers of psychiatry and had to take time off, whether because of depression, other medical illness or childbirth/child care leave, and their program was very supportive. Unfortunately, you can only find out about this kind of thing by talking to people from different programs. And even then, I wouldn't advertise a history of mental illness (even one episode) in my application.