I was always under the impression that rape was a cardinal sin in writing. I think it's because often rape portrayed as not a good thing but a justified thing. Or its fetishized; both portrayals, unfortunately, happen in a lot of media and is usually waved away.
Now murder is very interesting to me be in most societies it's seen as a bad thing, the worst thing a person can do. However in media, and sometimes in real life, it's entirely justified: An eye for an eye, The mutilated corpse of the main character's family member for the mutilated corpse of the main villain's family member. You know, as it goes. Usually people are alright with a murderer as long as the people their killing are somewhat bad and the murderer has some redeeming qualities i.e. Deadpool. I like him too, still a murderer. Am I okay with a character I like killing other people, not really.
Killing a main character or a well loved character without some repercussions is a horrible idea that should never be attempted. If the death does drive the plot, incite character development, or change the world/setting, then what was the death even for. An example of a poor choice in killing off a character was in the Divergent book series. Spoilers if you care, but the main character Tris dies at the end of the book series. I admit I didn't read the last book (I read the other two but stopped after the second), but big part of the themes of the series was bravery in the face of a dystopia, fighting for a better life for everyone, and doing so even though the resistance might be small. Plenty of people could have placed themselves in Tris' shoes the person at the center of a revolution, But them she dies in the most schmuck way possible. Not in a climactic fight or in generally heroic way. She gets offhandedly by the villain whom so does not face off with( at least from what I understand). This was a poor way to end the series given the themes and character development. Kill the main character, but at least make it mean something.
So I guess my bottom line is, fictional murder is cool, regardless of who gets killed, at long as it matters to the overall plot.