Skip to content

Commit 53e56f9

Browse files
committed
add lang item
1 parent 76430f1 commit 53e56f9

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

compiler/rustc_hir/src/lang_items.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ language_item_table! {
417417

418418
String, sym::String, string, Target::Struct, GenericRequirement::None;
419419
CStr, sym::CStr, c_str, Target::Struct, GenericRequirement::None;
420+
421+
// FIXME(xacrimon): Used for lowering of match/if let statements. will made obsolete by const PartialEq.
422+
MatchLoweredCmp, sym::MatchLoweredCmp, match_lowered_cmp, Target::Trait, GenericRequirement::None;
420423
}
421424

422425
pub enum GenericRequirement {

compiler/rustc_mir_build/src/builder/matches/util.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,8 @@ pub(crate) fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
229229
Mutability::Not => BorrowKind::Shared,
230230
}
231231
}
232+
233+
#[lang = "MatchLoweredCmp"]
234+
pub trait MatchLoweredCmp {
235+
fn same_as(&self, other: &Self) -> bool;
236+
}

compiler/rustc_mir_build/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
// tidy-alphabetical-start
44
#![allow(rustc::diagnostic_outside_of_impl)]
55
#![allow(rustc::untranslatable_diagnostic)]
6+
#![allow(internal_features)]
67
#![feature(assert_matches)]
78
#![feature(box_patterns)]
89
#![feature(if_let_guard)]
910
#![feature(let_chains)]
1011
#![feature(try_blocks)]
12+
#![feature(lang_items)]
1113
#![warn(unreachable_pub)]
1214
// tidy-alphabetical-end
1315

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ symbols! {
267267
LintDiagnostic,
268268
LintPass,
269269
LocalKey,
270+
MatchLoweredCmp,
270271
Mutex,
271272
MutexGuard,
272273
N,

0 commit comments

Comments
 (0)