Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid a string comparison in MIR construction
  • Loading branch information
matthewjasper committed Nov 11, 2019
1 parent 56237d7 commit 2ff89c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustc_mir/build/expr/into.rs
Expand Up @@ -200,16 +200,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
ty::FnDef(def_id, _) => {
let f = ty.fn_sig(this.hir.tcx());
if f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic {
Some(this.hir.tcx().item_name(def_id).as_str())
Some(this.hir.tcx().item_name(def_id))
} else {
None
}
}
_ => None,
};
let intrinsic = intrinsic.as_ref().map(|s| &s[..]);
let fun = unpack!(block = this.as_local_operand(block, fun));
if intrinsic == Some("move_val_init") {
if let Some(sym::move_val_init) = intrinsic {
// `move_val_init` has "magic" semantics - the second argument is
// always evaluated "directly" into the first one.

Expand Down
1 change: 1 addition & 0 deletions src/libsyntax_pos/symbol.rs
Expand Up @@ -432,6 +432,7 @@ symbols! {
module,
module_path,
more_struct_aliases,
move_val_init,
movbe_target_feature,
must_use,
naked,
Expand Down

0 comments on commit 2ff89c5

Please sign in to comment.