Skip to content

Commit 2ff89c5

Browse files
committed
Avoid a string comparison in MIR construction
1 parent 56237d7 commit 2ff89c5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/librustc_mir/build/expr/into.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
200200
ty::FnDef(def_id, _) => {
201201
let f = ty.fn_sig(this.hir.tcx());
202202
if f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic {
203-
Some(this.hir.tcx().item_name(def_id).as_str())
203+
Some(this.hir.tcx().item_name(def_id))
204204
} else {
205205
None
206206
}
207207
}
208208
_ => None,
209209
};
210-
let intrinsic = intrinsic.as_ref().map(|s| &s[..]);
211210
let fun = unpack!(block = this.as_local_operand(block, fun));
212-
if intrinsic == Some("move_val_init") {
211+
if let Some(sym::move_val_init) = intrinsic {
213212
// `move_val_init` has "magic" semantics - the second argument is
214213
// always evaluated "directly" into the first one.
215214

src/libsyntax_pos/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ symbols! {
432432
module,
433433
module_path,
434434
more_struct_aliases,
435+
move_val_init,
435436
movbe_target_feature,
436437
must_use,
437438
naked,

0 commit comments

Comments
 (0)