-
Couldn't load subscription status.
- Fork 13.9k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
rust/src/librustc_codegen_ssa/mir/rvalue.rs
Lines 586 to 592 in c43d03a
| mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt | | |
| mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit { | |
| bx.cx().const_bool(match op { | |
| mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false, | |
| mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true, | |
| _ => unreachable!() | |
| }) |
libcore however doesn't use those for the implementations for PartialEq and PartialOrd for the unit type.
Lines 933 to 939 in c43d03a
| #[stable(feature = "rust1", since = "1.0.0")] | |
| impl PartialEq for () { | |
| #[inline] | |
| fn eq(&self, _other: &()) -> bool { true } | |
| #[inline] | |
| fn ne(&self, _other: &()) -> bool { false } | |
| } |
Lines 980 to 985 in c43d03a
| impl PartialOrd for () { | |
| #[inline] | |
| fn partial_cmp(&self, _: &()) -> Option<Ordering> { | |
| Some(Equal) | |
| } | |
| } |
This means that the special case in cg_ssa can be removed.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.