-------------------------------------------------------------------------------- I1 cache: 65536 B, 64 B, 4-way associative D1 cache: 32768 B, 64 B, 8-way associative LL cache: 67108864 B, 64 B, 64-way associative Command: /usr/home/liquid/.rustup/toolchains/w-profiling/bin/rustc --crate-name log4rs --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg feature="all_components" --cfg feature="ansi_writer" --cfg feature="chrono" --cfg feature="compound_policy" --cfg feature="config_parsing" --cfg feature="console_appender" --cfg feature="console_writer" --cfg feature="default" --cfg feature="delete_roller" --cfg feature="file_appender" --cfg feature="fixed_window_roller" --cfg feature="humantime" --cfg feature="json_encoder" --cfg feature="libc" --cfg feature="log-mdc" --cfg feature="parking_lot" --cfg feature="pattern_encoder" --cfg feature="regex" --cfg feature="rolling_file_appender" --cfg feature="serde" --cfg feature="serde-value" --cfg feature="serde_json" --cfg feature="serde_yaml" --cfg feature="simple_writer" --cfg feature="size_trigger" --cfg feature="thread-id" --cfg feature="threshold_filter" --cfg feature="typemap" --cfg feature="winapi" --cfg feature="yaml_format" -C metadata=32df54b079dbd790 -C extra-filename=-32df54b079dbd790 --out-dir /usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps -L dependency=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps --extern anyhow=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libanyhow-6ceb60373badc2b9.rmeta --extern arc_swap=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libarc_swap-785940d151b6cc7d.rmeta --extern chrono=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libchrono-548304342f6c4e6c.rmeta --extern derivative=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libderivative-1c2b839af46deb7d.so --extern fnv=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libfnv-6511979a28d6c849.rmeta --extern humantime=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libhumantime-9c19a4460f0f65a0.rmeta --extern libc=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/liblibc-8abef7d19686acf1.rmeta --extern log=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/liblog-8ae1b92e6fb3017a.rmeta --extern log_mdc=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/liblog_mdc-2a91fefb04985740.rmeta --extern parking_lot=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libparking_lot-13fc41516e4e349c.rmeta --extern regex=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libregex-78ff58d90b2dc51b.rmeta --extern serde=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libserde-6091708c002b6cec.rmeta --extern serde_value=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libserde_value-2b498647fb4a88b3.rmeta --extern serde_json=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libserde_json-99ee44bf0803490b.rmeta --extern serde_yaml=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libserde_yaml-41be864de6d5e95a.rmeta --extern thiserror=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libthiserror-c7871756674d3020.rmeta --extern thread_id=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libthread_id-91d5e94ec5791112.rmeta --extern typemap=/usr/home/liquid/tmp/.tmpGRIsvH/target/debug/deps/libtypemap-071e929f82a3f2ee.rmeta -Adeprecated -Aunknown-lints -Zincremental-verify-ich Data file: results/cgout-w-profiling-log4rs-1.0.0-Debug-Full Events recorded: Ir Events shown: Ir Event sort order: Ir Thresholds: 0.1 Include dirs: User annotated: Auto-annotation: on -------------------------------------------------------------------------------- Ir -------------------------------------------------------------------------------- 21,888,073,036 (100.0%) PROGRAM TOTALS -------------------------------------------------------------------------------- Ir file:function -------------------------------------------------------------------------------- 1,270,749,181 ( 5.81%) ???:llvm::FPPassManager::runOnFunction(llvm::Function&) 714,214,958 ( 3.26%) ???:llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOpt::Level) 522,722,115 ( 2.39%) ./malloc/malloc.c:_int_malloc 521,037,058 ( 2.38%) ./malloc/malloc.c:_int_free 326,569,700 ( 1.49%) ???:llvm::AttributeList::addAttributes(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&) const 316,818,797 ( 1.45%) ./malloc/malloc.c:malloc 278,508,581 ( 1.27%) ???:(anonymous namespace)::Verifier::visitInstruction(llvm::Instruction&) 270,490,454 ( 1.24%) ???:llvm::PMDataManager::verifyPreservedAnalysis(llvm::Pass*) 248,559,768 ( 1.14%) ???:llvm::MachineInstr::addOperand(llvm::MachineFunction&, llvm::MachineOperand const&) 236,378,807 ( 1.08%) ???:llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) 232,102,036 ( 1.06%) ???:llvm::raw_svector_ostream::write_impl(char const*, unsigned long) 228,777,510 ( 1.05%) ???:(anonymous namespace)::RegAllocFast::allocateBasicBlock(llvm::MachineBasicBlock&) 217,549,920 ( 0.99%) ???:(anonymous namespace)::Verifier::visitMDNode(llvm::MDNode const&, (anonymous namespace)::Verifier::AreDebugLocsAllowed) 185,978,621 ( 0.85%) ???:llvm::MCExpr::evaluateAsRelocatableImpl(llvm::MCValue&, llvm::MCAssembler const*, llvm::MCAsmLayout const*, llvm::MCFixup const*, llvm::DenseMap, llvm::detail::DenseMapPair > const*, bool) const 152,441,644 ( 0.70%) ./malloc/malloc.c:free 148,578,025 ( 0.68%) ./string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:__memcpy_avx_unaligned_erms 147,399,364 ( 0.67%) ???:llvm::ScheduleDAGSDNodes::BuildSchedUnits() 146,913,403 ( 0.67%) ./string/../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:__memset_avx2_erms 128,333,902 ( 0.59%) ???:llvm::MCAsmLayout::getSymbolOffset(llvm::MCSymbol const&) const 127,114,013 ( 0.58%) ???:(anonymous namespace)::VarLocBasedLDV::process(llvm::MachineInstr&, (anonymous namespace)::VarLocBasedLDV::OpenRangesSet&, (anonymous namespace)::VarLocBasedLDV::VarLocMap&, llvm::SmallVector<(anonymous namespace)::VarLocBasedLDV::TransferDebugPair, 4u>&) 125,587,592 ( 0.57%) ???:llvm::TargetLoweringBase::getTypeConversion(llvm::LLVMContext&, llvm::EVT) const 120,525,368 ( 0.55%) ???:llvm::StringMapImpl::LookupBucketFor(llvm::StringRef) 113,853,368 ( 0.52%) ???:llvm::MCAsmLayout::getFragmentOffset(llvm::MCFragment const*) const 106,619,103 ( 0.49%) ???:llvm::coro::declaresIntrinsics(llvm::Module const&, std::initializer_list) 105,658,216 ( 0.48%) ???:llvm::TargetRegisterInfo::checkAllSuperRegsMarked(llvm::BitVector const&, llvm::ArrayRef) const 98,617,904 ( 0.45%) ???:llvm::TargetRegisterInfo::shouldRealignStack(llvm::MachineFunction const&) const 98,127,503 ( 0.45%) ???:(anonymous namespace)::Verifier::visitCallBase(llvm::CallBase&) 96,620,043 ( 0.44%) ???:llvm::SmallSet >::insert(llvm::Register const&) 95,778,205 ( 0.44%) ./string/../sysdeps/x86_64/multiarch/strcmp-avx2.S:__strncmp_avx2 93,908,433 ( 0.43%) ./string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S:__memcmp_avx2_movbe 92,048,177 ( 0.42%) ???:(anonymous namespace)::TwoAddressInstructionPass::runOnMachineFunction(llvm::MachineFunction&) 91,999,652 ( 0.42%) ???:llvm::SelectionDAG::MorphNodeTo(llvm::SDNode*, unsigned int, llvm::SDVTList, llvm::ArrayRef) 89,696,878 ( 0.41%) ???:llvm::InstrEmitter::EmitMachineNode(llvm::SDNode*, bool, bool, llvm::DenseMap, llvm::detail::DenseMapPair >&) 89,375,743 ( 0.41%) ???:llvm::DAGTypeLegalizer::run() 88,110,978 ( 0.40%) ???:(anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) [clone .llvm.8386621111310650999] 87,306,911 ( 0.40%) ???:llvm::MCObjectStreamer::emitBytes(llvm::StringRef) 87,227,424 ( 0.40%) ???:multikeySort(llvm::MutableArrayRef*>, int) 86,893,998 ( 0.40%) ./string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:__memcpy_sse2_unaligned_erms 84,863,539 ( 0.39%) ???:(anonymous namespace)::Verifier::verifyFunctionAttrs(llvm::FunctionType*, llvm::AttributeList, llvm::Value const*, bool) 83,557,710 ( 0.38%) ???:(anonymous namespace)::X86MCCodeEmitter::emitPrefixImpl(unsigned int&, llvm::MCInst const&, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) const 83,470,693 ( 0.38%) ???:(anonymous namespace)::Verifier::verify(llvm::Function const&) [clone .llvm.4153962086227604281] 76,508,380 ( 0.35%) ???:llvm::FoldingSetNodeID::AddInteger(unsigned int) 76,252,325 ( 0.35%) ???:llvm::SelectionDAG::getConstant(llvm::ConstantInt const&, llvm::SDLoc const&, llvm::EVT, bool, bool) 75,999,240 ( 0.35%) ???:llvm::MetadataTracking::track(void*, llvm::Metadata&, llvm::PointerUnion) 75,564,541 ( 0.35%) ???:llvm::SelectionDAG::Legalize() 75,033,969 ( 0.34%) ???:(anonymous namespace)::VarLocBasedLDV::ExtendRanges(llvm::MachineFunction&, llvm::TargetPassConfig*) [clone .llvm.4451506318407214204] 73,829,556 ( 0.34%) ???:llvm::FoldingSetBase::FindNodeOrInsertPos(llvm::FoldingSetNodeID const&, void*&, llvm::FoldingSetBase::FoldingSetInfo const&) 73,013,824 ( 0.33%) ???:llvm::DomTreeBuilder::SemiNCAInfo >::CalculateFromScratch(llvm::DominatorTreeBase&, llvm::DomTreeBuilder::SemiNCAInfo >::BatchUpdateInfo*) 71,789,298 ( 0.33%) ./malloc/malloc.c:malloc_consolidate 71,647,731 ( 0.33%) ???:llvm::calculateDbgEntityHistory(llvm::MachineFunction const*, llvm::TargetRegisterInfo const*, llvm::DbgValueHistoryMap&, llvm::DbgLabelInstrMap&) 70,204,436 ( 0.32%) ???:(anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) 69,968,695 ( 0.32%) ???:llvm::MCContext::getOrCreateSymbol(llvm::Twine const&) 63,985,238 ( 0.29%) ???:(anonymous namespace)::ScheduleDAGRRList::Schedule() [clone .llvm.6953762222372402862] 63,515,198 ( 0.29%) ???:(anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) 60,005,212 ( 0.27%) ./malloc/malloc.c:unlink_chunk.constprop.0 58,338,072 ( 0.27%) ???:(anonymous namespace)::ELFObjectWriter::recordRelocation(llvm::MCAssembler&, llvm::MCAsmLayout const&, llvm::MCFragment const*, llvm::MCFixup const&, llvm::MCValue, unsigned long&) [clone .llvm.14145361893594770252] 54,906,951 ( 0.25%) ./stdlib/msort.c:msort_with_tmp.part.0 54,252,564 ( 0.25%) ???:(anonymous namespace)::X86MCInstLower::Lower(llvm::MachineInstr const*, llvm::MCInst&) const 52,907,937 ( 0.24%) ???:llvm::PMDataManager::removeNotPreservedAnalysis(llvm::Pass*) 51,835,399 ( 0.24%) ???:llvm::FoldingSet::NodeEquals(llvm::FoldingSetBase const*, llvm::FoldingSetBase::Node*, llvm::FoldingSetNodeID const&, unsigned int, llvm::FoldingSetNodeID&) 51,787,902 ( 0.24%) ???:llvm::X86FrameLowering::hasFP(llvm::MachineFunction const&) const 49,363,149 ( 0.23%) ???:(anonymous namespace)::X86MCCodeEmitter::encodeInstruction(llvm::MCInst const&, llvm::raw_ostream&, llvm::SmallVectorImpl&, llvm::MCSubtargetInfo const&) const 49,003,267 ( 0.22%) ???:llvm::ScheduleDAGSDNodes::AddSchedEdges() 48,063,804 ( 0.22%) ???:llvm::MachineFunction::CreateMachineInstr(llvm::MCInstrDesc const&, llvm::DebugLoc const&, bool) 47,838,282 ( 0.22%) ???:(anonymous namespace)::Verifier::visitFunction(llvm::Function const&)::$_3::operator()(llvm::Instruction const&, llvm::MDNode const*) const 47,641,549 ( 0.22%) ???:llvm::DwarfDebug::beginInstruction(llvm::MachineInstr const*) 47,568,401 ( 0.22%) ???:llvm::FunctionLoweringInfo::set(llvm::Function const&, llvm::MachineFunction&, llvm::SelectionDAG*) 46,055,963 ( 0.21%) ???:llvm::SelectionDAG::AssignTopologicalOrder() 45,618,756 ( 0.21%) /usr/home/liquid/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.12.0/src/raw/mod.rs:, (), core::hash::BuildHasherDefault>>::from_hash::>::{closure#0}> 44,399,560 ( 0.20%) ???:llvm::AttributeSetNode::get(llvm::LLVMContext&, llvm::AttrBuilder const&) 43,964,904 ( 0.20%) ???:(anonymous namespace)::ELFWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) 42,360,879 ( 0.19%) ???:llvm::MCAssembler::layout(llvm::MCAsmLayout&) 42,038,447 ( 0.19%) ???:llvm::SelectionDAG::getRegister(unsigned int, llvm::EVT) 41,863,207 ( 0.19%) ???:llvm::DataLayout::getAlignment(llvm::Type*, bool) const 41,780,908 ( 0.19%) ???:llvm::MDNode::MDNode(llvm::LLVMContext&, unsigned int, llvm::Metadata::StorageType, llvm::ArrayRef, llvm::ArrayRef) 41,354,303 ( 0.19%) ???:llvm::Twine::printOneChild(llvm::raw_ostream&, llvm::Twine::Child, llvm::Twine::NodeKind) const 41,287,858 ( 0.19%) ???:llvm::raw_ostream::write(char const*, unsigned long) 41,271,966 ( 0.19%) ???:llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) 41,207,165 ( 0.19%) ???:(anonymous namespace)::RegAllocFast::markRegUsedInInstr(unsigned short) 41,181,874 ( 0.19%) ???:llvm::SmallPtrSetImplBase::insert_imp_big(void const*) 40,787,060 ( 0.19%) ???:llvm::X86TargetMachine::getTargetTransformInfo(llvm::Function const&) 39,780,513 ( 0.18%) ???:(anonymous namespace)::CFIInstrInserter::runOnMachineFunction(llvm::MachineFunction&) 39,701,018 ( 0.18%) ./string/../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:__memset_avx2_unaligned_erms 39,377,814 ( 0.18%) ???:llvm::MachineFunctionPass::runOnFunction(llvm::Function&) 38,827,591 ( 0.18%) /tmp/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/../../../../gcc-5.5.0/libstdc++-v3/libsupc++/new_op.cc:operator new(unsigned long) 38,586,312 ( 0.18%) ???:llvm::MCELFStreamer::emitLabel(llvm::MCSymbol*, llvm::SMLoc) 38,302,875 ( 0.17%) ???:llvm::MDString::get(llvm::LLVMContext&, llvm::StringRef) 36,912,223 ( 0.17%) ???:llvm::AsmPrinter::emitFunctionBody() 36,560,217 ( 0.17%) ???:(anonymous namespace)::VarLocBasedLDV::collectIDsForRegs(llvm::SmallSet >&, llvm::SmallSet > const&, llvm::CoalescingBitVector const&, (anonymous namespace)::VarLocBasedLDV::VarLocMap const&) 36,132,607 ( 0.17%) ???:llvm::FoldingSet::NodeEquals(llvm::FoldingSetBase const*, llvm::FoldingSetBase::Node*, llvm::FoldingSetNodeID const&, unsigned int, llvm::FoldingSetNodeID&) 35,897,025 ( 0.16%) ???:(anonymous namespace)::X86MCCodeEmitter::emitMemModRMByte(llvm::MCInst const&, unsigned int, unsigned int, unsigned long, bool, unsigned long, llvm::raw_ostream&, llvm::SmallVectorImpl&, llvm::MCSubtargetInfo const&, bool) const 35,792,232 ( 0.16%) ???:llvm::MCELFStreamer::emitInstToData(llvm::MCInst const&, llvm::MCSubtargetInfo const&) 35,746,976 ( 0.16%) /usr/home/liquid/rust/worktree-benchmarking/library/core/src/slice/mod.rs:::lookup_source_file_idx 34,549,968 ( 0.16%) ???:llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::SDVTList, llvm::ArrayRef) 33,955,813 ( 0.16%) ???:llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator&) 33,581,756 ( 0.15%) ???:??? 33,574,712 ( 0.15%) ???:llvm::X86RegisterInfo::eliminateFrameIndex(llvm::MachineInstrBundleIterator, int, unsigned int, llvm::RegScavenger*) const 33,177,926 ( 0.15%) ???:llvm::MCDwarfLineAddr::Encode(llvm::MCContext&, llvm::MCDwarfLineTableParams, long, unsigned long, llvm::raw_ostream&) 33,078,242 ( 0.15%) ???:llvm::MCObjectStreamer::emitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) 32,187,080 ( 0.15%) ???:llvm::LLVMContextImpl::~LLVMContextImpl() 31,748,497 ( 0.15%) ./string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:memcpy@GLIBC_2.2.5 31,552,756 ( 0.14%) ???:(anonymous namespace)::X86AsmBackend::applyFixup(llvm::MCAssembler const&, llvm::MCFixup const&, llvm::MCValue const&, llvm::MutableArrayRef, unsigned long, bool, llvm::MCSubtargetInfo const*) const 30,982,469 ( 0.14%) ./malloc/malloc.c:realloc 30,507,591 ( 0.14%) ???:llvm::CoalescingBitVector::find(unsigned long) const 29,664,698 ( 0.14%) /usr/home/liquid/rust/worktree-benchmarking/library/core/src/slice/mod.rs:::lookup_line 29,664,698 ( 0.14%) /usr/home/liquid/rust/worktree-benchmarking/library/core/src/slice/mod.rs:::line_begin_pos 29,519,590 ( 0.13%) ???:llvm::DomTreeBuilder::SemiNCAInfo >::runSemiNCA(llvm::DominatorTreeBase&, unsigned int) 29,405,416 ( 0.13%) ./elf/dl-lookup.c:_dl_lookup_symbol_x 29,313,363 ( 0.13%) ???:llvm::MCAssembler::layoutSectionOnce(llvm::MCAsmLayout&, llvm::MCSection&) 28,314,995 ( 0.13%) ???:(anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) [clone .llvm.3993696295502019106] 28,239,229 ( 0.13%) ???:llvm::TargetLowering::SimplifyDemandedBits(llvm::SDValue, llvm::APInt const&, llvm::APInt const&, llvm::KnownBits&, llvm::TargetLowering::TargetLoweringOpt&, unsigned int, bool) const 28,142,537 ( 0.13%) ???:llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDValue, llvm::SDNodeFlags) 28,068,291 ( 0.13%) ???:llvm::LazyCallGraph::Node::populateSlow() 28,009,744 ( 0.13%) ???:llvm::X86RegisterInfo::getReservedRegs(llvm::MachineFunction const&) const 27,868,017 ( 0.13%) ???:(anonymous namespace)::RegAllocFast::setPhysReg(llvm::MachineInstr&, llvm::MachineOperand&, unsigned short) 27,768,231 ( 0.13%) ???:llvm::SelectionDAG::clear() 26,793,264 ( 0.12%) ???:llvm::MCStreamer::emitULEB128IntValue(unsigned long, unsigned int) 26,679,249 ( 0.12%) ???:llvm::InstrEmitter::EmitCopyFromReg(llvm::SDNode*, unsigned int, bool, bool, llvm::Register, llvm::DenseMap, llvm::detail::DenseMapPair >&) 26,382,549 ( 0.12%) ???:llvm::DILocation::getImpl(llvm::LLVMContext&, unsigned int, unsigned int, llvm::Metadata*, llvm::Metadata*, bool, llvm::Metadata::StorageType, bool) 26,307,969 ( 0.12%) ???:llvm::BumpPtrAllocatorImpl::Allocate(unsigned long, llvm::Align) 26,011,231 ( 0.12%) ???:llvm::Function::dropAllReferences() 25,937,972 ( 0.12%) ???:llvm::TargetLoweringBase::ArgListEntry::setAttributes(llvm::CallBase const*, unsigned int) 25,870,041 ( 0.12%) ???:llvm::X86TargetMachine::getSubtargetImpl(llvm::Function const&) const 25,676,367 ( 0.12%) ???:llvm::X86FrameLowering::getFrameIndexReference(llvm::MachineFunction const&, int, llvm::Register&) const 25,555,993 ( 0.12%) ???:(anonymous namespace)::RegAllocFast::allocVirtReg(llvm::MachineInstr&, (anonymous namespace)::RegAllocFast::LiveReg&, llvm::Register, bool) 25,373,899 ( 0.12%) ./nptl/pthread_rwlock_common.c:pthread_rwlock_unlock 24,943,993 ( 0.11%) ???:llvm::SelectionDAG::computeKnownBits(llvm::SDValue, llvm::APInt const&, unsigned int) const 24,649,464 ( 0.11%) ???:llvm::MCObjectStreamer::emitValueImpl(llvm::MCExpr const*, unsigned int, llvm::SMLoc) 24,030,168 ( 0.11%) ???:(anonymous namespace)::X86AsmBackend::emitInstructionBegin(llvm::MCObjectStreamer&, llvm::MCInst const&) 23,982,409 ( 0.11%) ???:(anonymous namespace)::RegAllocFast::freePhysReg(unsigned short) 23,953,947 ( 0.11%) ???:(anonymous namespace)::RegAllocFast::isRegUsedInInstr(unsigned short, bool) const 23,840,727 ( 0.11%) ???:llvm::SelectionDAG::RemoveDeadNodes() 23,740,999 ( 0.11%) ???:(anonymous namespace)::RemoveRedundantDebugValues::runOnMachineFunction(llvm::MachineFunction&) 22,934,411 ( 0.10%) ./elf/dl-lookup.c:do_lookup_x 22,854,201 ( 0.10%) ???:llvm::Module::getOrInsertFunction(llvm::StringRef, llvm::FunctionType*) 22,819,575 ( 0.10%) ???:llvm::MCAssembler::writeSectionData(llvm::raw_ostream&, llvm::MCSection const*, llvm::MCAsmLayout const&) const 22,492,119 ( 0.10%) /usr/home/liquid/rust/worktree-benchmarking/compiler/rustc_middle/src/ty/sty.rs:::eq 22,196,016 ( 0.10%) ???:(anonymous namespace)::X86AsmBackend::emitInstructionEnd(llvm::MCObjectStreamer&, llvm::MCInst const&) 22,174,221 ( 0.10%) ???:llvm::SmallDenseMap, llvm::detail::DenseSetPair >::grow(unsigned int) 22,132,349 ( 0.10%) ???:llvm::SelectionDAGISel::DoInstructionSelection() 22,111,896 ( 0.10%) ???:(anonymous namespace)::X86AsmBackend::getFixupKindInfo(llvm::MCFixupKind) const 22,087,069 ( 0.10%) ???:llvm::hashing::detail::hash_combine_recursive_helper::combine(unsigned long, char*, char*) 22,081,909 ( 0.10%) ???:llvm::LexicalScopes::extractLexicalScopes(llvm::SmallVectorImpl >&, llvm::DenseMap, llvm::detail::DenseMapPair >&) 21,970,954 ( 0.10%) ???:char* llvm::hashing::detail::hash_combine_recursive_helper::combine_data(unsigned long&, char*, char*, llvm::Metadata*) 21,946,114 ( 0.10%) ???:llvm::DIEAbbrev::Profile(llvm::FoldingSetNodeID&) const -------------------------------------------------------------------------------- -- Auto-annotated source: /usr/home/liquid/rust/worktree-benchmarking/library/core/src/slice/mod.rs -------------------------------------------------------------------------------- Ir -- line 118 ---------------------------------------- . /// let a = [1, 2, 3]; . /// assert_eq!(a.len(), 3); . /// ``` . #[lang = "slice_len_fn"] . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_len", since = "1.39.0")] . #[inline] . // SAFETY: const sound because we transmute out the length field as a usize (which it must be) 19,026 ( 0.00%) pub const fn len(&self) -> usize { . // FIXME: Replace with `crate::ptr::metadata(self)` when that is const-stable. . // As of this writing this causes a "Const-stable functions can only call other . // const-stable functions" error. . . // SAFETY: Accessing the value from the `PtrRepr` union is safe since *const T . // and PtrComponents have the same memory layouts. Only std can make this . // guarantee. 19,026 ( 0.00%) unsafe { crate::ptr::PtrRepr { const_ptr: self }.components.metadata } 12,684 ( 0.00%) } . . /// Returns `true` if the slice has a length of 0. . /// . /// # Examples . /// . /// ``` . /// let a = [1, 2, 3]; . /// assert!(!a.is_empty()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_is_empty", since = "1.39.0")] . #[inline] 6 ( 0.00%) pub const fn is_empty(&self) -> bool { 1,924,289 ( 0.01%) self.len() == 0 8 ( 0.00%) } . . /// Returns the first element of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let v = [10, 40, 30]; . /// assert_eq!(Some(&10), v.first()); -- line 158 ---------------------------------------- -- line 159 ---------------------------------------- . /// . /// let w: &[i32] = &[]; . /// assert_eq!(None, w.first()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] . pub const fn first(&self) -> Option<&T> { 13,447 ( 0.00%) if let [first, ..] = self { Some(first) } else { None } . } . . /// Returns a mutable pointer to the first element of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; -- line 175 ---------------------------------------- -- line 178 ---------------------------------------- . /// *first = 5; . /// } . /// assert_eq!(x, &[5, 1, 2]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")] . #[inline] . pub const fn first_mut(&mut self) -> Option<&mut T> { 5,044 ( 0.00%) if let [first, ..] = self { Some(first) } else { None } . } . . /// Returns the first and all the rest of the elements of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &[0, 1, 2]; -- line 194 ---------------------------------------- -- line 197 ---------------------------------------- . /// assert_eq!(first, &0); . /// assert_eq!(elements, &[1, 2]); . /// } . /// ``` . #[stable(feature = "slice_splits", since = "1.5.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] . pub const fn split_first(&self) -> Option<(&T, &[T])> { 984 ( 0.00%) if let [first, tail @ ..] = self { Some((first, tail)) } else { None } . } . . /// Returns the first and all the rest of the elements of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; -- line 213 ---------------------------------------- -- line 237 ---------------------------------------- . /// assert_eq!(last, &2); . /// assert_eq!(elements, &[0, 1]); . /// } . /// ``` . #[stable(feature = "slice_splits", since = "1.5.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] . pub const fn split_last(&self) -> Option<(&T, &[T])> { 47,066 ( 0.00%) if let [init @ .., last] = self { Some((last, init)) } else { None } . } . . /// Returns the last and all the rest of the elements of the slice, or `None` if it is empty. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; -- line 253 ---------------------------------------- -- line 275 ---------------------------------------- . /// assert_eq!(Some(&30), v.last()); . /// . /// let w: &[i32] = &[]; . /// assert_eq!(None, w.last()); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_first_last_not_mut", since = "1.56.0")] . #[inline] 65 ( 0.00%) pub const fn last(&self) -> Option<&T> { 605,445 ( 0.00%) if let [.., last] = self { Some(last) } else { None } 39 ( 0.00%) } . . /// Returns a mutable pointer to the last item in the slice. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [0, 1, 2]; . /// -- line 293 ---------------------------------------- -- line 295 ---------------------------------------- . /// *last = 10; . /// } . /// assert_eq!(x, &[0, 1, 10]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_slice_first_last", issue = "83570")] . #[inline] . pub const fn last_mut(&mut self) -> Option<&mut T> { 1,952,742 ( 0.01%) if let [.., last] = self { Some(last) } else { None } . } . . /// Returns a reference to an element or subslice depending on the type of . /// index. . /// . /// - If given a position, returns a reference to the element at that . /// position or `None` if out of bounds. . /// - If given a range, returns the subslice corresponding to that range, -- line 311 ---------------------------------------- -- line 317 ---------------------------------------- . /// let v = [10, 40, 30]; . /// assert_eq!(Some(&40), v.get(1)); . /// assert_eq!(Some(&[10, 40][..]), v.get(0..2)); . /// assert_eq!(None, v.get(3)); . /// assert_eq!(None, v.get(0..4)); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] 24,051 ( 0.00%) pub fn get(&self, index: I) -> Option<&I::Output> . where . I: SliceIndex, . { 6,031 ( 0.00%) index.get(self) 5,958 ( 0.00%) } . . /// Returns a mutable reference to an element or subslice depending on the . /// type of index (see [`get`]) or `None` if the index is out of bounds. . /// . /// [`get`]: slice::get . /// . /// # Examples . /// -- line 338 ---------------------------------------- -- line 372 ---------------------------------------- . /// let x = &[1, 2, 4]; . /// . /// unsafe { . /// assert_eq!(x.get_unchecked(1), &2); . /// } . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] 1,176 ( 0.00%) pub unsafe fn get_unchecked(&self, index: I) -> &I::Output . where . I: SliceIndex, . { . // SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`; . // the slice is dereferenceable because `self` is a safe reference. . // The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is. 368 ( 0.00%) unsafe { &*index.get_unchecked(self) } 294 ( 0.00%) } . . /// Returns a mutable reference to an element or subslice, without doing . /// bounds checking. . /// . /// For a safe alternative see [`get_mut`]. . /// . /// # Safety . /// -- line 396 ---------------------------------------- -- line 408 ---------------------------------------- . /// unsafe { . /// let elem = x.get_unchecked_mut(1); . /// *elem = 13; . /// } . /// assert_eq!(x, &[1, 13, 4]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] 1,928 ( 0.00%) pub unsafe fn get_unchecked_mut(&mut self, index: I) -> &mut I::Output . where . I: SliceIndex, . { . // SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`; . // the slice is dereferenceable because `self` is a safe reference. . // The returned pointer is safe because impls of `SliceIndex` have to guarantee that it is. 556 ( 0.00%) unsafe { &mut *index.get_unchecked_mut(self) } 482 ( 0.00%) } . . /// Returns a raw pointer to the slice's buffer. . /// . /// The caller must ensure that the slice outlives the pointer this . /// function returns, or else it will end up pointing to garbage. . /// . /// The caller must also ensure that the memory the pointer (non-transitively) points to . /// is never written to (except inside an `UnsafeCell`) using this pointer or any pointer -- line 432 ---------------------------------------- -- line 447 ---------------------------------------- . /// } . /// } . /// ``` . /// . /// [`as_mut_ptr`]: slice::as_mut_ptr . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_stable(feature = "const_slice_as_ptr", since = "1.32.0")] . #[inline] 182,248 ( 0.00%) pub const fn as_ptr(&self) -> *const T { 2,735,799 ( 0.01%) self as *const [T] as *const T 91,124 ( 0.00%) } . . /// Returns an unsafe mutable pointer to the slice's buffer. . /// . /// The caller must ensure that the slice outlives the pointer this . /// function returns, or else it will end up pointing to garbage. . /// . /// Modifying the container referenced by this slice may cause its buffer . /// to be reallocated, which would also make any pointers to it invalid. -- line 465 ---------------------------------------- -- line 475 ---------------------------------------- . /// *x_ptr.add(i) += 2; . /// } . /// } . /// assert_eq!(x, &[3, 4, 6]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_ptr_offset", issue = "71499")] . #[inline] 912 ( 0.00%) pub const fn as_mut_ptr(&mut self) -> *mut T { 27 ( 0.00%) self as *mut [T] as *mut T 456 ( 0.00%) } . . /// Returns the two raw pointers spanning the slice. . /// . /// The returned range is half-open, which means that the end pointer . /// points *one past* the last element of the slice. This way, an empty . /// slice is represented by two equal pointers, and the difference between . /// the two pointers represents the size of the slice. . /// -- line 493 ---------------------------------------- -- line 582 ---------------------------------------- . /// v.swap(2, 4); . /// assert!(v == ["a", "b", "e", "d", "c"]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[rustc_const_unstable(feature = "const_swap", issue = "83163")] . #[inline] . #[track_caller] . pub const fn swap(&mut self, a: usize, b: usize) { 73,786 ( 0.00%) let _ = &self[a]; 159,007 ( 0.00%) let _ = &self[b]; . . // SAFETY: we just checked that both `a` and `b` are in bounds . unsafe { self.swap_unchecked(a, b) } . } . . /// Swaps two elements in the slice, without doing bounds checking. . /// . /// For a safe alternative see [`swap`]. -- line 599 ---------------------------------------- -- line 677 ---------------------------------------- . . // Because this function is first compiled in isolation, . // this check tells LLVM that the indexing below is . // in-bounds. Then after inlining -- once the actual . // lengths of the slices are known -- it's removed. . let (a, b) = (&mut a[..n], &mut b[..n]); . . for i in 0..n { 40,612 ( 0.00%) mem::swap(&mut a[i], &mut b[n - 1 - i]); . } . } . } . . /// Returns an iterator over the slice. . /// . /// # Examples . /// -- line 693 ---------------------------------------- -- line 697 ---------------------------------------- . /// . /// assert_eq!(iterator.next(), Some(&1)); . /// assert_eq!(iterator.next(), Some(&2)); . /// assert_eq!(iterator.next(), Some(&4)); . /// assert_eq!(iterator.next(), None); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] 56,874 ( 0.00%) pub fn iter(&self) -> Iter<'_, T> { 56,874 ( 0.00%) Iter::new(self) 37,916 ( 0.00%) } . . /// Returns an iterator that allows modifying each value. . /// . /// # Examples . /// . /// ``` . /// let x = &mut [1, 2, 4]; . /// for elem in x.iter_mut() { . /// *elem += 2; . /// } . /// assert_eq!(x, &[3, 4, 6]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] 381 ( 0.00%) pub fn iter_mut(&mut self) -> IterMut<'_, T> { 381 ( 0.00%) IterMut::new(self) 254 ( 0.00%) } . . /// Returns an iterator over all contiguous windows of length . /// `size`. The windows overlap. If the slice is shorter than . /// `size`, the iterator returns no values. . /// . /// # Panics . /// . /// Panics if `size` is 0. -- line 732 ---------------------------------------- -- line 1499 ---------------------------------------- . /// assert_eq!(left, [1, 2, 3, 4, 5, 6]); . /// assert_eq!(right, []); . /// } . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . #[track_caller] . pub fn split_at(&self, mid: usize) -> (&[T], &[T]) { 672 ( 0.00%) assert!(mid <= self.len()); . // SAFETY: `[ptr; mid]` and `[mid; len]` are inside `self`, which . // fulfills the requirements of `from_raw_parts_mut`. . unsafe { self.split_at_unchecked(mid) } . } . . /// Divides one mutable slice into two at an index. . /// . /// The first will contain all indices from `[0, mid)` (excluding -- line 1515 ---------------------------------------- -- line 1530 ---------------------------------------- . /// left[1] = 2; . /// right[1] = 4; . /// assert_eq!(v, [1, 2, 3, 4, 5, 6]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] . #[track_caller] . pub fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { 98,450 ( 0.00%) assert!(mid <= self.len()); . // SAFETY: `[ptr; mid]` and `[mid; len]` are inside `self`, which . // fulfills the requirements of `from_raw_parts_mut`. . unsafe { self.split_at_mut_unchecked(mid) } . } . . /// Divides one slice into two at an index, without doing bounds checking. . /// . /// The first will contain all indices from `[0, mid)` (excluding -- line 1546 ---------------------------------------- -- line 1628 ---------------------------------------- . pub unsafe fn split_at_mut_unchecked(&mut self, mid: usize) -> (&mut [T], &mut [T]) { . let len = self.len(); . let ptr = self.as_mut_ptr(); . . // SAFETY: Caller has to check that `0 <= mid <= self.len()`. . // . // `[ptr; mid]` and `[mid; len]` are not overlapping, so returning a mutable reference . // is fine. 12,527 ( 0.00%) unsafe { (from_raw_parts_mut(ptr, mid), from_raw_parts_mut(ptr.add(mid), len - mid)) } . } . . /// Divides one slice into an array and a remainder slice at an index. . /// . /// The array will contain all indices from `[0, N)` (excluding . /// the index `N` itself) and the slice will contain all . /// indices from `[N, len)` (excluding the index `len` itself). . /// -- line 1644 ---------------------------------------- -- line 2109 ---------------------------------------- . /// . /// ``` . /// let v = [String::from("hello"), String::from("world")]; // slice of `String` . /// assert!(v.iter().any(|e| e == "hello")); // search with `&str` . /// assert!(!v.iter().any(|e| e == "hi")); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . #[inline] 224 ( 0.00%) pub fn contains(&self, x: &T) -> bool . where . T: PartialEq, . { 1,070 ( 0.00%) cmp::SliceContains::slice_contains(x, self) 112 ( 0.00%) } . . /// Returns `true` if `needle` is a prefix of the slice. . /// . /// # Examples . /// . /// ``` . /// let v = [10, 40, 30]; . /// assert!(v.starts_with(&[10])); -- line 2130 ---------------------------------------- -- line 2137 ---------------------------------------- . /// . /// ``` . /// let v = &[10, 40, 30]; . /// assert!(v.starts_with(&[])); . /// let v: &[u8] = &[]; . /// assert!(v.starts_with(&[])); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] 55,356 ( 0.00%) pub fn starts_with(&self, needle: &[T]) -> bool . where . T: PartialEq, . { 23,724 ( 0.00%) let n = needle.len(); 214,123 ( 0.00%) self.len() >= n && needle == &self[..n] 39,540 ( 0.00%) } . . /// Returns `true` if `needle` is a suffix of the slice. . /// . /// # Examples . /// . /// ``` . /// let v = [10, 40, 30]; . /// assert!(v.ends_with(&[30])); -- line 2159 ---------------------------------------- -- line 2166 ---------------------------------------- . /// . /// ``` . /// let v = &[10, 40, 30]; . /// assert!(v.ends_with(&[])); . /// let v: &[u8] = &[]; . /// assert!(v.ends_with(&[])); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] 4,851 ( 0.00%) pub fn ends_with(&self, needle: &[T]) -> bool . where . T: PartialEq, . { 6,237 ( 0.00%) let (m, n) = (self.len(), needle.len()); 280,405 ( 0.00%) m >= n && needle == &self[m - n..] 3,465 ( 0.00%) } . . /// Returns a subslice with the prefix removed. . /// . /// If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`. . /// If `prefix` is empty, simply returns the original slice. . /// . /// If the slice does not start with `prefix`, returns `None`. . /// -- line 2188 ---------------------------------------- -- line 2293 ---------------------------------------- . /// s.insert(idx, num); . /// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); . /// ``` . #[stable(feature = "rust1", since = "1.0.0")] . pub fn binary_search(&self, x: &T) -> Result . where . T: Ord, . { 3 ( 0.00%) self.binary_search_by(|p| p.cmp(x)) . } . . /// Binary searches this sorted slice with a comparator function. . /// . /// The comparator function should implement an order consistent . /// with the sort order of the underlying slice, returning an . /// order code that indicates whether its argument is `Less`, . /// `Equal` or `Greater` the desired target. -- line 2309 ---------------------------------------- -- line 2345 ---------------------------------------- . #[inline] . pub fn binary_search_by<'a, F>(&'a self, mut f: F) -> Result . where . F: FnMut(&'a T) -> Ordering, . { . let mut size = self.len(); . let mut left = 0; . let mut right = size; 16,379,673 ( 0.07%) while left < right { 28,057,809 ( 0.13%) let mid = left + size / 2; . . // SAFETY: the call is made safe by the following invariants: . // - `mid >= 0` . // - `mid < size`: `mid` is limited by `[left; right)` bound. 2,758,775 ( 0.01%) let cmp = f(unsafe { self.get_unchecked(mid) }); . . // The reason why we use if/else control flow rather than match . // is because match reorders comparison operations, which is perf sensitive. . // This is x86 asm for u8: https://rust.godbolt.org/z/8Y8Pra. 7,159,606 ( 0.03%) if cmp == Less { 15,519,103 ( 0.07%) left = mid + 1; 3,848,563 ( 0.02%) } else if cmp == Greater { . right = mid; . } else { . // SAFETY: same as the `get_unchecked` above . unsafe { crate::intrinsics::assume(mid < self.len()) }; . return Ok(mid); . } . 21,206,355 ( 0.10%) size = right - left; . } . Err(left) . } . . /// Binary searches this sorted slice with a key extraction function. . /// . /// Assumes that the slice is sorted by the key, for instance with . /// [`sort_by_key`] using the same key extraction function. -- line 2382 ---------------------------------------- -- line 3187 ---------------------------------------- . /// assert_eq!(slice, [4, 5, 3, 4, 5]); . /// ``` . /// . /// [`clone_from_slice`]: slice::clone_from_slice . /// [`split_at_mut`]: slice::split_at_mut . #[doc(alias = "memcpy")] . #[stable(feature = "copy_from_slice", since = "1.9.0")] . #[track_caller] 270 ( 0.00%) pub fn copy_from_slice(&mut self, src: &[T]) . where . T: Copy, . { . // The panic code path was put into a cold function to not bloat the . // call site. . #[inline(never)] . #[cold] . #[track_caller] . fn len_mismatch_fail(dst_len: usize, src_len: usize) -> ! { . panic!( . "source slice length ({}) does not match destination slice length ({})", . src_len, dst_len, . ); . } . 294,370 ( 0.00%) if self.len() != src.len() { . len_mismatch_fail(self.len(), src.len()); . } . . // SAFETY: `self` is valid for `self.len()` elements by definition, and `src` was . // checked to have the same length. The slices cannot overlap because . // mutable references are exclusive. . unsafe { 162 ( 0.00%) ptr::copy_nonoverlapping(src.as_ptr(), self.as_mut_ptr(), self.len()); . } 54 ( 0.00%) } . . /// Copies elements from one part of the slice to another part of itself, . /// using a memmove. . /// . /// `src` is the range within `self` to copy from. `dest` is the starting . /// index of the range within `self` to copy to, which will have the same . /// length as `src`. The two ranges may overlap. The ends of the two ranges . /// must be less than or equal to `self.len()`. -- line 3229 ---------------------------------------- -- line 3380 ---------------------------------------- . } . a << k . } . let gcd: usize = gcd(mem::size_of::(), mem::size_of::()); . let ts: usize = mem::size_of::() / gcd; . let us: usize = mem::size_of::() / gcd; . . // Armed with this knowledge, we can find how many `U`s we can fit! 8 ( 0.00%) let us_len = self.len() / ts * us; . // And how many `T`s will be in the trailing slice! 51,380 ( 0.00%) let ts_len = self.len() % ts; . (us_len, ts_len) . } . . /// Transmute the slice to a slice of another type, ensuring alignment of the types is . /// maintained. . /// . /// This method splits the slice into three distinct slices: prefix, correctly aligned middle . /// slice of a new type, and the suffix slice. The method may make the middle slice the greatest -- line 3398 ---------------------------------------- -- line 3429 ---------------------------------------- . return (self, &[], &[]); . } . . // First, find at what point do we split between the first and 2nd slice. Easy with . // ptr.align_offset. . let ptr = self.as_ptr(); . // SAFETY: See the `align_to_mut` method for the detailed safety comment. . let offset = unsafe { crate::ptr::align_offset(ptr, mem::align_of::()) }; 51,380 ( 0.00%) if offset > self.len() { . (self, &[], &[]) . } else { . let (left, rest) = self.split_at(offset); . let (us_len, ts_len) = rest.align_to_offsets::(); . // SAFETY: now `rest` is definitely aligned, so `from_raw_parts` below is okay, . // since the caller guarantees that we can transmute `T` to `U` safely. . unsafe { . ( . left, . from_raw_parts(rest.as_ptr() as *const U, us_len), 51,388 ( 0.00%) from_raw_parts(rest.as_ptr().add(rest.len() - ts_len), ts_len), . ) . } . } . } . . /// Transmute the slice to a slice of another type, ensuring alignment of the types is . /// maintained. . /// -- line 3456 ---------------------------------------- -- line 3731 ---------------------------------------- . /// let v = [1, 2, 3, 3, 5, 6, 7]; . /// let i = v.partition_point(|&x| x < 5); . /// . /// assert_eq!(i, 4); . /// assert!(v[..i].iter().all(|&x| x < 5)); . /// assert!(v[i..].iter().all(|&x| !(x < 5))); . /// ``` . #[stable(feature = "partition_point", since = "1.52.0")] 93 ( 0.00%) pub fn partition_point

(&self, mut pred: P) -> usize . where . P: FnMut(&T) -> bool, . { . self.binary_search_by(|x| if pred(x) { Less } else { Greater }).unwrap_or_else(|i| i) 186 ( 0.00%) } . . /// Removes the subslice corresponding to the given range . /// and returns a reference to it. . /// . /// Returns `None` and does not modify the slice if the given . /// range is out of bounds. . /// . /// Note that this method only accepts one-sided ranges such as -- line 3752 ---------------------------------------- 11,896,674 ( 0.05%) -------------------------------------------------------------------------------- -- Auto-annotated source: /usr/home/liquid/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.12.0/src/raw/mod.rs -------------------------------------------------------------------------------- Ir -- line 110 ---------------------------------------- . /// Control byte value for an empty bucket. . const EMPTY: u8 = 0b1111_1111; . . /// Control byte value for a deleted bucket. . const DELETED: u8 = 0b1000_0000; . . /// Checks whether a control byte represents a full bucket (top bit is clear). . #[inline] 114 ( 0.00%) fn is_full(ctrl: u8) -> bool { 5,557,145 ( 0.03%) ctrl & 0x80 == 0 152 ( 0.00%) } . . /// Checks whether a control byte represents a special value (top bit is set). . #[inline] . fn is_special(ctrl: u8) -> bool { . ctrl & 0x80 != 0 . } . . /// Checks whether a special control value is EMPTY (just check 1 bit). . #[inline] 78 ( 0.00%) fn special_is_empty(ctrl: u8) -> bool { . debug_assert!(is_special(ctrl)); 414,000 ( 0.00%) ctrl & 0x01 != 0 104 ( 0.00%) } . . /// Primary hash function, used to select the initial bucket to probe from. . #[inline] . #[allow(clippy::cast_possible_truncation)] 231 ( 0.00%) fn h1(hash: u64) -> usize { . // On 32-bit platforms we simply ignore the higher hash bits. . hash as usize 154 ( 0.00%) } . . /// Secondary hash function, saved in the low 7 bits of the control byte. . #[inline] . #[allow(clippy::cast_possible_truncation)] 195 ( 0.00%) fn h2(hash: u64) -> u8 { . // Grab the top 7 bits of the hash. While the hash is normally a full 64-bit . // value, some hash functions (such as FxHash) produce a usize result . // instead, which means that the top 32 bits are 0 on 32-bit platforms. 390 ( 0.00%) let hash_len = usize::min(mem::size_of::(), mem::size_of::()); 107,930,638 ( 0.49%) let top7 = hash >> (hash_len * 8 - 7); 65 ( 0.00%) (top7 & 0x7f) as u8 // truncation 130 ( 0.00%) } . . /// Probe sequence based on triangular numbers, which is guaranteed (since our . /// table size is a power of two) to visit every group of elements exactly once. . /// . /// A triangular probe has us jump by 1 more group every time. So first we . /// jump by 1 group (meaning we just continue our linear scan), then 2 groups . /// (skipping over 1 group), then 3 groups (skipping over 2 groups), and so on. . /// -- line 161 ---------------------------------------- -- line 170 ---------------------------------------- . #[inline] . fn move_next(&mut self, bucket_mask: usize) { . // We should have found an empty bucket by now and ended the probe. . debug_assert!( . self.stride <= bucket_mask, . "Went past end of probe sequence" . ); . 1,084,968 ( 0.00%) self.stride += Group::WIDTH; 1,084,968 ( 0.00%) self.pos += self.stride; 926,144 ( 0.00%) self.pos &= bucket_mask; . } . } . . /// Returns the number of buckets needed to hold the given number of items, . /// taking the maximum load factor into account. . /// . /// Returns `None` if an overflow occurs. . // Workaround for emscripten bug emscripten-core/emscripten-fastcomp#258 . #[cfg_attr(target_os = "emscripten", inline(never))] . #[cfg_attr(not(target_os = "emscripten"), inline)] 36 ( 0.00%) fn capacity_to_buckets(cap: usize) -> Option { . debug_assert_ne!(cap, 0); . . // For small tables we require at least 1 empty bucket so that lookups are . // guaranteed to terminate if an element doesn't exist in the table. 327,060 ( 0.00%) if cap < 8 { . // We don't bother with a table size of 2 buckets since that can only . // hold a single element. Instead we skip directly to a 4 bucket table . // which can hold 3 elements. 684,652 ( 0.00%) return Some(if cap < 4 { 4 } else { 8 }); . } . . // Otherwise require 1/8 buckets to be empty (87.5% load) . // . // Be careful when modifying this, calculate_layout relies on the . // overflow check here. 159,612 ( 0.00%) let adjusted_cap = cap.checked_mul(8)? / 7; . . // Any overflows will have been caught by the checked_mul. Also, any . // rounding errors from the division above will be cleaned up by . // next_power_of_two (which can't overflow because of the previous division). . Some(adjusted_cap.next_power_of_two()) 48 ( 0.00%) } . . /// Returns the maximum effective capacity for the given bucket mask, taking . /// the maximum load factor into account. . #[inline] 72 ( 0.00%) fn bucket_mask_to_capacity(bucket_mask: usize) -> usize { 913,242 ( 0.00%) if bucket_mask < 8 { . // For tables with 1/2/4/8 buckets, we always reserve one empty slot. . // Keep in mind that the bucket mask is one less than the bucket count. 24 ( 0.00%) bucket_mask . } else { . // For larger tables we reserve 12.5% of the slots as empty. 182,121 ( 0.00%) ((bucket_mask + 1) / 8) * 7 . } 72 ( 0.00%) } . . /// Helper which allows the max calculation for ctrl_align to be statically computed for each T . /// while keeping the rest of `calculate_layout_for` independent of `T` . #[derive(Copy, Clone)] . struct TableLayout { . size: usize, . ctrl_align: usize, . } . . impl TableLayout { . #[inline] 24 ( 0.00%) fn new() -> Self { 72 ( 0.00%) let layout = Layout::new::(); 48 ( 0.00%) Self { 72 ( 0.00%) size: layout.size(), 144 ( 0.00%) ctrl_align: usize::max(layout.align(), Group::WIDTH), . } 96 ( 0.00%) } . . #[inline] 312 ( 0.00%) fn calculate_layout_for(self, buckets: usize) -> Option<(Layout, usize)> { . debug_assert!(buckets.is_power_of_two()); . 48 ( 0.00%) let TableLayout { size, ctrl_align } = self; . // Manual layout calculation since Layout methods are not yet stable. . let ctrl_offset = 616,759 ( 0.00%) size.checked_mul(buckets)?.checked_add(ctrl_align - 1)? & !(ctrl_align - 1); 863,382 ( 0.00%) let len = ctrl_offset.checked_add(buckets + Group::WIDTH)?; . 216 ( 0.00%) Some(( 96 ( 0.00%) unsafe { Layout::from_size_align_unchecked(len, ctrl_align) }, . ctrl_offset, . )) 72 ( 0.00%) } . } . . /// Returns a Layout which describes the allocation required for a hash table, . /// and the offset of the control bytes in the allocation. . /// (the offset is also one past last element of buckets) . /// . /// Returns `None` if an overflow occurs. . #[cfg_attr(feature = "inline-more", inline)] -- line 269 ---------------------------------------- -- line 292 ---------------------------------------- . #[inline] . fn clone(&self) -> Self { . Self { ptr: self.ptr } . } . } . . impl Bucket { . #[inline] 440 ( 0.00%) unsafe fn from_base_index(base: NonNull, index: usize) -> Self { 352 ( 0.00%) let ptr = if mem::size_of::() == 0 { . // won't overflow because index must be less than length . (index + 1) as *mut T . } else { 352 ( 0.00%) base.as_ptr().sub(index) . }; 88 ( 0.00%) Self { 352 ( 0.00%) ptr: NonNull::new_unchecked(ptr), . } 264 ( 0.00%) } . #[inline] . unsafe fn to_base_index(&self, base: NonNull) -> usize { . if mem::size_of::() == 0 { . self.ptr.as_ptr() as usize - 1 . } else { . offset_from(base.as_ptr(), self.ptr.as_ptr()) . } . } . #[inline] 264 ( 0.00%) pub fn as_ptr(&self) -> *mut T { 352 ( 0.00%) if mem::size_of::() == 0 { . // Just return an arbitrary ZST pointer which is properly aligned . mem::align_of::() as *mut T . } else { 528 ( 0.00%) unsafe { self.ptr.as_ptr().sub(1) } . } 264 ( 0.00%) } . #[inline] . unsafe fn next_n(&self, offset: usize) -> Self { . let ptr = if mem::size_of::() == 0 { . (self.ptr.as_ptr() as usize + offset) as *mut T . } else { . self.ptr.as_ptr().sub(offset) . }; . Self { -- line 335 ---------------------------------------- -- line 337 ---------------------------------------- . } . } . #[cfg_attr(feature = "inline-more", inline)] . pub unsafe fn drop(&self) { . self.as_ptr().drop_in_place(); . } . #[inline] . pub unsafe fn read(&self) -> T { 2,728 ( 0.00%) self.as_ptr().read() . } . #[inline] 84 ( 0.00%) pub unsafe fn write(&self, val: T) { 126 ( 0.00%) self.as_ptr().write(val); 28 ( 0.00%) } . #[inline] 148 ( 0.00%) pub unsafe fn as_ref<'a>(&self) -> &'a T { 148 ( 0.00%) &*self.as_ptr() 148 ( 0.00%) } . #[inline] . pub unsafe fn as_mut<'a>(&self) -> &'a mut T { . &mut *self.as_ptr() . } . #[cfg(feature = "raw")] . #[inline] . pub unsafe fn copy_from_nonoverlapping(&self, other: &Self) { . self.as_ptr().copy_from_nonoverlapping(other.as_ptr(), 1); -- line 362 ---------------------------------------- -- line 392 ---------------------------------------- . . impl RawTable { . /// Creates a new empty hash table without allocating any memory. . /// . /// In effect this returns a table with exactly 1 bucket. However we can . /// leave the data pointer dangling since that bucket is never written to . /// due to our load factor forcing us to always have at least 1 free bucket. . #[inline] 156 ( 0.00%) pub const fn new() -> Self { 416 ( 0.00%) Self { 104 ( 0.00%) table: RawTableInner::new_in(Global), . marker: PhantomData, . } 104 ( 0.00%) } . . /// Attempts to allocate a new hash table with at least enough capacity . /// for inserting the given number of elements without reallocating. . #[cfg(feature = "raw")] . pub fn try_with_capacity(capacity: usize) -> Result { . Self::try_with_capacity_in(capacity, Global) . } . -- line 413 ---------------------------------------- -- line 421 ---------------------------------------- . impl RawTable { . /// Creates a new empty hash table without allocating any memory, using the . /// given allocator. . /// . /// In effect this returns a table with exactly 1 bucket. However we can . /// leave the data pointer dangling since that bucket is never written to . /// due to our load factor forcing us to always have at least 1 free bucket. . #[inline] 105 ( 0.00%) pub fn new_in(alloc: A) -> Self { 1,801 ( 0.00%) Self { 70 ( 0.00%) table: RawTableInner::new_in(alloc), . marker: PhantomData, . } 70 ( 0.00%) } . . /// Allocates a new hash table with the given number of buckets. . /// . /// The control bytes are left uninitialized. . #[cfg_attr(feature = "inline-more", inline)] . unsafe fn new_uninitialized( . alloc: A, . buckets: usize, . fallibility: Fallibility, . ) -> Result { . debug_assert!(buckets.is_power_of_two()); . . Ok(Self { 355 ( 0.00%) table: RawTableInner::new_uninitialized( . alloc, . TableLayout::new::(), . buckets, . fallibility, . )?, . marker: PhantomData, . }) . } -- line 456 ---------------------------------------- -- line 458 ---------------------------------------- . /// Attempts to allocate a new hash table with at least enough capacity . /// for inserting the given number of elements without reallocating. . fn fallible_with_capacity( . alloc: A, . capacity: usize, . fallibility: Fallibility, . ) -> Result { . Ok(Self { 30,300 ( 0.00%) table: RawTableInner::fallible_with_capacity( . alloc, . TableLayout::new::(), . capacity, . fallibility, . )?, . marker: PhantomData, . }) . } -- line 474 ---------------------------------------- -- line 493 ---------------------------------------- . /// Returns a reference to the underlying allocator. . #[inline] . pub fn allocator(&self) -> &A { . &self.table.alloc . } . . /// Deallocates the table without dropping any entries. . #[cfg_attr(feature = "inline-more", inline)] 36 ( 0.00%) unsafe fn free_buckets(&mut self) { 48 ( 0.00%) self.table.free_buckets(TableLayout::new::()); 24 ( 0.00%) } . . /// Returns pointer to one past last element of data table. . #[inline] 176 ( 0.00%) pub unsafe fn data_end(&self) -> NonNull { 440 ( 0.00%) NonNull::new_unchecked(self.table.ctrl.as_ptr().cast()) 176 ( 0.00%) } . . /// Returns pointer to start of data table. . #[inline] . #[cfg(feature = "nightly")] . pub unsafe fn data_start(&self) -> *mut T { . self.data_end().as_ptr().wrapping_sub(self.buckets()) . } . -- line 517 ---------------------------------------- -- line 518 ---------------------------------------- . /// Returns the index of a bucket from a `Bucket`. . #[inline] . pub unsafe fn bucket_index(&self, bucket: &Bucket) -> usize { . bucket.to_base_index(self.data_end()) . } . . /// Returns a pointer to an element in the table. . #[inline] 352 ( 0.00%) pub unsafe fn bucket(&self, index: usize) -> Bucket { . debug_assert_ne!(self.table.bucket_mask, 0); . debug_assert!(index < self.buckets()); 352 ( 0.00%) Bucket::from_base_index(self.data_end(), index) 176 ( 0.00%) } . . /// Erases an element from the table without dropping it. . #[cfg_attr(feature = "inline-more", inline)] . #[deprecated(since = "0.8.1", note = "use erase or remove instead")] 51,466 ( 0.00%) pub unsafe fn erase_no_drop(&mut self, item: &Bucket) { 51,466 ( 0.00%) let index = self.bucket_index(item); . self.table.erase(index); 102,932 ( 0.00%) } . . /// Erases an element from the table, dropping it in place. . #[cfg_attr(feature = "inline-more", inline)] . #[allow(clippy::needless_pass_by_value)] . #[allow(deprecated)] . pub unsafe fn erase(&mut self, item: Bucket) { . // Erase the element from the table first since drop might panic. 23,358 ( 0.00%) self.erase_no_drop(&item); . item.drop(); . } . . /// Finds and erases an element from the table, dropping it in place. . /// Returns true if an element was found. . #[cfg(feature = "raw")] . #[cfg_attr(feature = "inline-more", inline)] . pub fn erase_entry(&mut self, hash: u64, eq: impl FnMut(&T) -> bool) -> bool { -- line 554 ---------------------------------------- -- line 563 ---------------------------------------- . } . } . . /// Removes an element from the table, returning it. . #[cfg_attr(feature = "inline-more", inline)] . #[allow(clippy::needless_pass_by_value)] . #[allow(deprecated)] . pub unsafe fn remove(&mut self, item: Bucket) -> T { 79,574 ( 0.00%) self.erase_no_drop(&item); 490 ( 0.00%) item.read() . } . . /// Finds and removes an element from the table, returning it. . #[cfg_attr(feature = "inline-more", inline)] 1,846,167 ( 0.01%) pub fn remove_entry(&mut self, hash: u64, eq: impl FnMut(&T) -> bool) -> Option { . // Avoid `Option::map` because it bloats LLVM IR. 8,178 ( 0.00%) match self.find(hash, eq) { 13,328 ( 0.00%) Some(bucket) => Some(unsafe { self.remove(bucket) }), 269,031 ( 0.00%) None => None, . } 2,514,673 ( 0.01%) } . . /// Marks all table buckets as empty without dropping their contents. . #[cfg_attr(feature = "inline-more", inline)] . pub fn clear_no_drop(&mut self) { . self.table.clear_no_drop(); . } . . /// Removes all elements from the table without freeing the backing memory. . #[cfg_attr(feature = "inline-more", inline)] . pub fn clear(&mut self) { . // Ensure that the table is reset even if one of the drops panic . let mut self_ = guard(self, |self_| self_.clear_no_drop()); . unsafe { 1 ( 0.00%) self_.drop_elements(); . } . } . 43 ( 0.00%) unsafe fn drop_elements(&mut self) { 37,822 ( 0.00%) if mem::needs_drop::() && !self.is_empty() { . for item in self.iter() { . item.drop(); . } . } 32 ( 0.00%) } . . /// Shrinks the table to fit `max(self.len(), min_size)` elements. . #[cfg_attr(feature = "inline-more", inline)] . pub fn shrink_to(&mut self, min_size: usize, hasher: impl Fn(&T) -> u64) { . // Calculate the minimal number of elements that we need to reserve . // space for. . let min_size = usize::max(self.table.items, min_size); . if min_size == 0 { -- line 615 ---------------------------------------- -- line 641 ---------------------------------------- . } . } . } . } . . /// Ensures that at least `additional` items can be inserted into the table . /// without reallocation. . #[cfg_attr(feature = "inline-more", inline)] 329 ( 0.00%) pub fn reserve(&mut self, additional: usize, hasher: impl Fn(&T) -> u64) { 1,043,807 ( 0.00%) if additional > self.table.growth_left { . // Avoid `Result::unwrap_or_else` because it bloats LLVM IR. 553,503 ( 0.00%) if self 24 ( 0.00%) .reserve_rehash(additional, hasher, Fallibility::Infallible) . .is_err() . { . unsafe { hint::unreachable_unchecked() } . } . } 235 ( 0.00%) } . . /// Tries to ensure that at least `additional` items can be inserted into . /// the table without reallocation. . #[cfg_attr(feature = "inline-more", inline)] . pub fn try_reserve( . &mut self, . additional: usize, . hasher: impl Fn(&T) -> u64, -- line 667 ---------------------------------------- -- line 671 ---------------------------------------- . } else { . Ok(()) . } . } . . /// Out-of-line slow path for `reserve` and `try_reserve`. . #[cold] . #[inline(never)] 1,299,519 ( 0.01%) fn reserve_rehash( . &mut self, . additional: usize, . hasher: impl Fn(&T) -> u64, . fallibility: Fallibility, . ) -> Result<(), TryReserveError> { . unsafe { 144 ( 0.00%) self.table.reserve_rehash_inner( . additional, 36 ( 0.00%) &|table, index| hasher(table.bucket::(index).as_ref()), . fallibility, 48 ( 0.00%) TableLayout::new::(), 84 ( 0.00%) if mem::needs_drop::() { . Some(mem::transmute(ptr::drop_in_place:: as unsafe fn(*mut T))) . } else { 12 ( 0.00%) None . }, . ) . } 904,700 ( 0.00%) } . . /// Allocates a new table of a different size and moves the contents of the . /// current table into it. . fn resize( . &mut self, . capacity: usize, . hasher: impl Fn(&T) -> u64, . fallibility: Fallibility, -- line 706 ---------------------------------------- -- line 714 ---------------------------------------- . ) . } . } . . /// Inserts a new element into the table, and returns its raw bucket. . /// . /// This does not check if the given element already exists in the table. . #[cfg_attr(feature = "inline-more", inline)] 7,075,684 ( 0.03%) pub fn insert(&mut self, hash: u64, value: T, hasher: impl Fn(&T) -> u64) -> Bucket { . unsafe { 112 ( 0.00%) let mut index = self.table.find_insert_slot(hash); . . // We can avoid growing the table once we have reached our load . // factor if we are replacing a tombstone. This works since the . // number of EMPTY slots does not change in this case. 16,265 ( 0.00%) let old_ctrl = *self.table.ctrl(index); 5,252,600 ( 0.02%) if unlikely(self.table.growth_left == 0 && special_is_empty(old_ctrl)) { 48 ( 0.00%) self.reserve(1, hasher); 48 ( 0.00%) index = self.table.find_insert_slot(hash); . } . 56 ( 0.00%) self.table.record_item_insert_at(index, old_ctrl, hash); . 70 ( 0.00%) let bucket = self.bucket(index); 58 ( 0.00%) bucket.write(value); 28 ( 0.00%) bucket . } 5,238,379 ( 0.02%) } . . /// Attempts to insert a new element without growing the table and return its raw bucket. . /// . /// Returns an `Err` containing the given element if inserting it would require growing the . /// table. . /// . /// This does not check if the given element already exists in the table. . #[cfg(feature = "raw")] -- line 749 ---------------------------------------- -- line 760 ---------------------------------------- . } . } . } . . /// Inserts a new element into the table, and returns a mutable reference to it. . /// . /// This does not check if the given element already exists in the table. . #[cfg_attr(feature = "inline-more", inline)] 1,914,528 ( 0.01%) pub fn insert_entry(&mut self, hash: u64, value: T, hasher: impl Fn(&T) -> u64) -> &mut T { 1,437 ( 0.00%) unsafe { self.insert(hash, value, hasher).as_mut() } 1,435,896 ( 0.01%) } . . /// Inserts a new element into the table, without growing the table. . /// . /// There must be enough space in the table to insert the new element. . /// . /// This does not check if the given element already exists in the table. . #[cfg_attr(feature = "inline-more", inline)] . #[cfg(any(feature = "raw", feature = "rustc-internal-api"))] 10,575 ( 0.00%) pub unsafe fn insert_no_grow(&mut self, hash: u64, value: T) -> Bucket { 1,200,815 ( 0.01%) let (index, old_ctrl) = self.table.prepare_insert_slot(hash); 25,246 ( 0.00%) let bucket = self.table.bucket(index); . . // If we are replacing a DELETED entry then we don't need to update . // the load counter. 2,463,787 ( 0.01%) self.table.growth_left -= special_is_empty(old_ctrl) as usize; . . bucket.write(value); 1,916,032 ( 0.01%) self.table.items += 1; . bucket 17,709 ( 0.00%) } . . /// Temporary removes a bucket, applying the given function to the removed . /// element and optionally put back the returned value in the same bucket. . /// . /// Returns `true` if the bucket still contains an element . /// . /// This does not check if the given bucket is actually occupied. . #[cfg_attr(feature = "inline-more", inline)] -- line 798 ---------------------------------------- -- line 813 ---------------------------------------- . true . } else { . false . } . } . . /// Searches for an element in the table. . #[inline] 288,784 ( 0.00%) pub fn find(&self, hash: u64, mut eq: impl FnMut(&T) -> bool) -> Option> { 33,713 ( 0.00%) let result = self.table.find_inner(hash, &mut |index| unsafe { 123,250 ( 0.00%) eq(self.bucket(index).as_ref()) 9,767 ( 0.00%) }); . . // Avoid `Option::map` because it bloats LLVM IR. 227 ( 0.00%) match result { 4,046 ( 0.00%) Some(index) => Some(unsafe { self.bucket(index) }), 28 ( 0.00%) None => None, . } 328,564 ( 0.00%) } . . /// Gets a reference to an element in the table. . #[inline] 148 ( 0.00%) pub fn get(&self, hash: u64, eq: impl FnMut(&T) -> bool) -> Option<&T> { . // Avoid `Option::map` because it bloats LLVM IR. 98,941 ( 0.00%) match self.find(hash, eq) { 222 ( 0.00%) Some(bucket) => Some(unsafe { bucket.as_ref() }), . None => None, . } 111 ( 0.00%) } . . /// Gets a mutable reference to an element in the table. . #[inline] 44,786 ( 0.00%) pub fn get_mut(&mut self, hash: u64, eq: impl FnMut(&T) -> bool) -> Option<&mut T> { . // Avoid `Option::map` because it bloats LLVM IR. 148,894 ( 0.00%) match self.find(hash, eq) { . Some(bucket) => Some(unsafe { bucket.as_mut() }), 28 ( 0.00%) None => None, . } 51,162 ( 0.00%) } . . /// Attempts to get mutable references to `N` entries in the table at once. . /// . /// Returns an array of length `N` with the results of each query. . /// . /// At most one mutable reference will be returned to any entry. `None` will be returned if any . /// of the hashes are duplicates. `None` will be returned if the hash is not found. . /// -- line 859 ---------------------------------------- -- line 913 ---------------------------------------- . /// more, but is guaranteed to be able to hold at least this many. . #[inline] . pub fn capacity(&self) -> usize { . self.table.items + self.table.growth_left . } . . /// Returns the number of elements in the table. . #[inline] 310 ( 0.00%) pub fn len(&self) -> usize { 155 ( 0.00%) self.table.items 310 ( 0.00%) } . . /// Returns `true` if the table contains no elements. . #[inline] 240 ( 0.00%) pub fn is_empty(&self) -> bool { 2,440,156 ( 0.01%) self.len() == 0 480 ( 0.00%) } . . /// Returns the number of buckets in the table. . #[inline] . pub fn buckets(&self) -> usize { . self.table.bucket_mask + 1 . } . . /// Returns an iterator over every element in the table. It is up to . /// the caller to ensure that the `RawTable` outlives the `RawIter`. . /// Because we cannot make the `next` method unsafe on the `RawIter` . /// struct, we have to make the `iter` method unsafe. . #[inline] . pub unsafe fn iter(&self) -> RawIter { 16 ( 0.00%) let data = Bucket::from_base_index(self.data_end(), 0); . RawIter { . iter: RawIterRange::new(self.table.ctrl.as_ptr(), data, self.table.buckets()), 240,781 ( 0.00%) items: self.table.items, . } . } . . /// Returns an iterator over occupied buckets that could match a given hash. . /// . /// `RawTable` only stores 7 bits of the hash value, so this iterator may . /// return items that have a hash value different than the one provided. You . /// should always validate the returned values before using them. -- line 954 ---------------------------------------- -- line 995 ---------------------------------------- . /// Iteration starts at the provided iterator's current location. . /// . /// It is up to the caller to ensure that the iterator is valid for this . /// `RawTable` and covers all items that remain in the table. . pub unsafe fn into_iter_from(self, iter: RawIter) -> RawIntoIter { . debug_assert_eq!(iter.len(), self.len()); . . let alloc = self.table.alloc.clone(); 16,168 ( 0.00%) let allocation = self.into_allocation(); 12,126 ( 0.00%) RawIntoIter { 20,210 ( 0.00%) iter, . allocation, . marker: PhantomData, . alloc, . } . } . . /// Converts the table into a raw allocation. The contents of the table . /// should be dropped using a `RawIter` before freeing the allocation. . #[cfg_attr(feature = "inline-more", inline)] . pub(crate) fn into_allocation(self) -> Option<(NonNull, Layout)> { 7,736 ( 0.00%) let alloc = if self.table.is_empty_singleton() { . None . } else { . // Avoid `Option::unwrap_or_else` because it bloats LLVM IR. . let (layout, ctrl_offset) = match calculate_layout::(self.table.buckets()) { . Some(lco) => lco, . None => unsafe { hint::unreachable_unchecked() }, . }; . Some(( 1,401 ( 0.00%) unsafe { NonNull::new_unchecked(self.table.ctrl.as_ptr().sub(ctrl_offset)) }, . layout, . )) . }; . mem::forget(self); . alloc . } . } . -- line 1033 ---------------------------------------- -- line 1041 ---------------------------------------- . where . T: Sync, . A: Sync, . { . } . . impl RawTableInner { . #[inline] 261 ( 0.00%) const fn new_in(alloc: A) -> Self { 1,842,327 ( 0.01%) Self { . // Be careful to cast the entire slice to a raw pointer. 609 ( 0.00%) ctrl: unsafe { NonNull::new_unchecked(Group::static_empty() as *const _ as *mut u8) }, . bucket_mask: 0, . items: 0, . growth_left: 0, . alloc, . } 174 ( 0.00%) } . } . . impl RawTableInner { . #[cfg_attr(feature = "inline-more", inline)] 1,031,846 ( 0.00%) unsafe fn new_uninitialized( . alloc: A, . table_layout: TableLayout, . buckets: usize, . fallibility: Fallibility, . ) -> Result { . debug_assert!(buckets.is_power_of_two()); . . // Avoid `Option::ok_or_else` because it bloats LLVM IR. 192 ( 0.00%) let (layout, ctrl_offset) = match table_layout.calculate_layout_for(buckets) { 144 ( 0.00%) Some(lco) => lco, . None => return Err(fallibility.capacity_overflow()), . }; . . // We need an additional check to ensure that the allocation doesn't . // exceed `isize::MAX`. We can skip this check on 64-bit systems since . // such allocations will never succeed anyways. . // . // This mirrors what Vec does in the standard library. 48 ( 0.00%) if mem::size_of::() < 8 && layout.size() > isize::MAX as usize { . return Err(fallibility.capacity_overflow()); . } . 262,496 ( 0.00%) let ptr: NonNull = match do_alloc(&alloc, layout) { 72 ( 0.00%) Ok(block) => block.cast(), . Err(_) => return Err(fallibility.alloc_err(layout)), . }; . 108 ( 0.00%) let ctrl = NonNull::new_unchecked(ptr.as_ptr().add(ctrl_offset)); 569,592 ( 0.00%) Ok(Self { . ctrl, 258,555 ( 0.00%) bucket_mask: buckets - 1, . items: 0, 108 ( 0.00%) growth_left: bucket_mask_to_capacity(buckets - 1), . alloc, . }) 751,096 ( 0.00%) } . . #[inline] 87,456 ( 0.00%) fn fallible_with_capacity( . alloc: A, . table_layout: TableLayout, . capacity: usize, . fallibility: Fallibility, . ) -> Result { 22,440 ( 0.00%) if capacity == 0 { 16,084 ( 0.00%) Ok(Self::new_in(alloc)) . } else { . unsafe { . let buckets = 204 ( 0.00%) capacity_to_buckets(capacity).ok_or_else(|| fallibility.capacity_overflow())?; . 466,934 ( 0.00%) let result = Self::new_uninitialized(alloc, table_layout, buckets, fallibility)?; 72 ( 0.00%) result.ctrl(0).write_bytes(EMPTY, result.num_ctrl_bytes()); . 47,179 ( 0.00%) Ok(result) . } . } 87,348 ( 0.00%) } . . /// Searches for an empty or deleted bucket which is suitable for inserting . /// a new element and sets the hash for that slot. . /// . /// There must be at least 1 empty bucket in the table. . #[inline] 405,929 ( 0.00%) unsafe fn prepare_insert_slot(&self, hash: u64) -> (usize, u8) { . let index = self.find_insert_slot(hash); 405,929 ( 0.00%) let old_ctrl = *self.ctrl(index); . self.set_ctrl_h2(index, hash); . (index, old_ctrl) 811,858 ( 0.00%) } . . /// Searches for an empty or deleted bucket which is suitable for inserting . /// a new element. . /// . /// There must be at least 1 empty bucket in the table. . #[inline] 104 ( 0.00%) fn find_insert_slot(&self, hash: u64) -> usize { 78 ( 0.00%) let mut probe_seq = self.probe_seq(hash); 26 ( 0.00%) loop { . unsafe { 208 ( 0.00%) let group = Group::load(self.ctrl(probe_seq.pos)); 3,637,929 ( 0.02%) if let Some(bit) = group.match_empty_or_deleted().lowest_set_bit() { 10,542,097 ( 0.05%) let result = (probe_seq.pos + bit) & self.bucket_mask; . . // In tables smaller than the group width, trailing control . // bytes outside the range of the table are filled with . // EMPTY entries. These will unfortunately trigger a . // match, but once masked may point to a full bucket that . // is already occupied. We detect this situation here and . // perform a second scan starting at the beginning of the . // table. This second scan is guaranteed to find an empty . // slot (due to the load factor) before hitting the trailing . // control bytes (containing EMPTY). 4,826,362 ( 0.02%) if unlikely(is_full(*self.ctrl(result))) { . debug_assert!(self.bucket_mask < Group::WIDTH); . debug_assert_ne!(probe_seq.pos, 0); . return Group::load_aligned(self.ctrl(0)) . .match_empty_or_deleted() . .lowest_set_bit_nonzero(); . } . 52 ( 0.00%) return result; . } . } . probe_seq.move_next(self.bucket_mask); . } 78 ( 0.00%) } . . /// Searches for an element in the table. This uses dynamic dispatch to reduce the amount of . /// code generated, but it is eliminated by LLVM optimizations. . #[inline] 612 ( 0.00%) fn find_inner(&self, hash: u64, eq: &mut dyn FnMut(usize) -> bool) -> Option { 153 ( 0.00%) let h2_hash = h2(hash); 153 ( 0.00%) let mut probe_seq = self.probe_seq(hash); . 394,451 ( 0.00%) loop { 408 ( 0.00%) let group = unsafe { Group::load(self.ctrl(probe_seq.pos)) }; . 12,183,141 ( 0.06%) for bit in group.match_byte(h2_hash) { 24,996,863 ( 0.11%) let index = (probe_seq.pos + bit) & self.bucket_mask; . 17,874,288 ( 0.08%) if likely(eq(index)) { 74 ( 0.00%) return Some(index); . } . } . 3,382,465 ( 0.02%) if likely(group.match_empty().any_bit_set()) { 14 ( 0.00%) return None; . } . . probe_seq.move_next(self.bucket_mask); . } 204 ( 0.00%) } . . #[allow(clippy::mut_mut)] . #[inline] . unsafe fn prepare_rehash_in_place(&mut self) { . // Bulk convert all full control bytes to DELETED, and all DELETED . // control bytes to EMPTY. This effectively frees up all buckets . // containing a DELETED entry. 11 ( 0.00%) for i in (0..self.buckets()).step_by(Group::WIDTH) { . let group = Group::load_aligned(self.ctrl(i)); . let group = group.convert_special_to_empty_and_full_to_deleted(); . group.store_aligned(self.ctrl(i)); . } . . // Fix up the trailing control bytes. See the comments in set_ctrl . // for the handling of tables smaller than the group width. 9 ( 0.00%) if self.buckets() < Group::WIDTH { . self.ctrl(0) . .copy_to(self.ctrl(Group::WIDTH), self.buckets()); . } else { . self.ctrl(0) . .copy_to(self.ctrl(self.buckets()), Group::WIDTH); . } . } . -- line 1220 ---------------------------------------- -- line 1225 ---------------------------------------- . Bucket::from_base_index(self.data_end(), index) . } . . #[inline] . unsafe fn bucket_ptr(&self, index: usize, size_of: usize) -> *mut u8 { . debug_assert_ne!(self.bucket_mask, 0); . debug_assert!(index < self.buckets()); . let base: *mut u8 = self.data_end().as_ptr(); 13,423,176 ( 0.06%) base.sub((index + 1) * size_of) . } . . #[inline] . unsafe fn data_end(&self) -> NonNull { . NonNull::new_unchecked(self.ctrl.as_ptr().cast()) . } . . /// Returns an iterator-like object for a probe sequence on the table. . /// . /// This iterator never terminates, but is guaranteed to visit each bucket . /// group exactly once. The loop using `probe_seq` must terminate upon . /// reaching a group containing an empty bucket. . #[inline] 539 ( 0.00%) fn probe_seq(&self, hash: u64) -> ProbeSeq { 154 ( 0.00%) ProbeSeq { 70,737,539 ( 0.32%) pos: h1(hash) & self.bucket_mask, . stride: 0, . } 308 ( 0.00%) } . . /// Returns the index of a bucket for which a value must be inserted if there is enough rooom . /// in the table, otherwise returns error . #[cfg(feature = "raw")] . #[inline] . unsafe fn prepare_insert_no_grow(&mut self, hash: u64) -> Result { . let index = self.find_insert_slot(hash); . let old_ctrl = *self.ctrl(index); -- line 1260 ---------------------------------------- -- line 1262 ---------------------------------------- . Err(()) . } else { . self.record_item_insert_at(index, old_ctrl, hash); . Ok(index) . } . } . . #[inline] 126 ( 0.00%) unsafe fn record_item_insert_at(&mut self, index: usize, old_ctrl: u8, hash: u64) { 6,585,918 ( 0.03%) self.growth_left -= special_is_empty(old_ctrl) as usize; 28 ( 0.00%) self.set_ctrl_h2(index, hash); 5,250,806 ( 0.02%) self.items += 1; 28 ( 0.00%) } . . #[inline] . fn is_in_same_group(&self, i: usize, new_i: usize, hash: u64) -> bool { . let probe_seq_pos = self.probe_seq(hash).pos; . let probe_index = . |pos: usize| (pos.wrapping_sub(probe_seq_pos) & self.bucket_mask) / Group::WIDTH; 108 ( 0.00%) probe_index(i) == probe_index(new_i) . } . . /// Sets a control byte to the hash, and possibly also the replicated control byte at . /// the end of the array. . #[inline] 126 ( 0.00%) unsafe fn set_ctrl_h2(&self, index: usize, hash: u64) { 56 ( 0.00%) self.set_ctrl(index, h2(hash)); 28 ( 0.00%) } . . #[inline] . unsafe fn replace_ctrl_h2(&self, index: usize, hash: u64) -> u8 { . let prev_ctrl = *self.ctrl(index); . self.set_ctrl_h2(index, hash); . prev_ctrl . } . . /// Sets a control byte, and possibly also the replicated control byte at . /// the end of the array. . #[inline] 140 ( 0.00%) unsafe fn set_ctrl(&self, index: usize, ctrl: u8) { . // Replicate the first Group::WIDTH control bytes at the end of . // the array without using a branch: . // - If index >= Group::WIDTH then index == index2. . // - Otherwise index2 == self.bucket_mask + 1 + index. . // . // The very last replicated control byte is never actually read because . // we mask the initial index for unaligned loads, but we write it . // anyways because it makes the set_ctrl implementation simpler. -- line 1309 ---------------------------------------- -- line 1312 ---------------------------------------- . // replicate the buckets at the end of the trailing group. For example . // with 2 buckets and a group size of 4, the control bytes will look . // like this: . // . // Real | Replicated . // --------------------------------------------- . // | [A] | [B] | [EMPTY] | [EMPTY] | [A] | [B] | . // --------------------------------------------- 10,230,496 ( 0.05%) let index2 = ((index.wrapping_sub(Group::WIDTH)) & self.bucket_mask) + Group::WIDTH; . 3,404,552 ( 0.02%) *self.ctrl(index) = ctrl; 3,405,334 ( 0.02%) *self.ctrl(index2) = ctrl; 28 ( 0.00%) } . . /// Returns a pointer to a control byte. . #[inline] 676 ( 0.00%) unsafe fn ctrl(&self, index: usize) -> *mut u8 { . debug_assert!(index < self.num_ctrl_bytes()); 507 ( 0.00%) self.ctrl.as_ptr().add(index) 338 ( 0.00%) } . . #[inline] 48 ( 0.00%) fn buckets(&self) -> usize { 770,915 ( 0.00%) self.bucket_mask + 1 48 ( 0.00%) } . . #[inline] 24 ( 0.00%) fn num_ctrl_bytes(&self) -> usize { 606,360 ( 0.00%) self.bucket_mask + 1 + Group::WIDTH 24 ( 0.00%) } . . #[inline] 198 ( 0.00%) fn is_empty_singleton(&self) -> bool { 3,380,967 ( 0.02%) self.bucket_mask == 0 396 ( 0.00%) } . . #[allow(clippy::mut_mut)] . #[inline] 204 ( 0.00%) unsafe fn prepare_resize( . &self, . table_layout: TableLayout, . capacity: usize, . fallibility: Fallibility, . ) -> Result, TryReserveError> { 12 ( 0.00%) debug_assert!(self.items <= capacity); . . // Allocate and initialize the new table. 10,623 ( 0.00%) let mut new_table = RawTableInner::fallible_with_capacity( 12 ( 0.00%) self.alloc.clone(), . table_layout, . capacity, . fallibility, . )?; 347,166 ( 0.00%) new_table.growth_left -= self.items; 24 ( 0.00%) new_table.items = self.items; . . // The hash function may panic, in which case we simply free the new . // table without dropping any elements that may have been copied into . // it. . // . // This guard is also used to free the old table on success, see . // the comment at the bottom of this function. 324 ( 0.00%) Ok(guard(new_table, move |self_| { 159,180 ( 0.00%) if !self_.is_empty_singleton() { . self_.free_buckets(table_layout); . } 24 ( 0.00%) })) 48 ( 0.00%) } . . /// Reserves or rehashes to make room for `additional` more elements. . /// . /// This uses dynamic dispatch to reduce the amount of . /// code generated, but it is eliminated by LLVM optimizations when inlined. . #[allow(clippy::inline_always)] . #[inline(always)] . unsafe fn reserve_rehash_inner( -- line 1387 ---------------------------------------- -- line 1388 ---------------------------------------- . &mut self, . additional: usize, . hasher: &dyn Fn(&mut Self, usize) -> u64, . fallibility: Fallibility, . layout: TableLayout, . drop: Option, . ) -> Result<(), TryReserveError> { . // Avoid `Option::ok_or_else` because it bloats LLVM IR. 318,399 ( 0.00%) let new_items = match self.items.checked_add(additional) { 48 ( 0.00%) Some(new_items) => new_items, . None => return Err(fallibility.capacity_overflow()), . }; 318,306 ( 0.00%) let full_capacity = bucket_mask_to_capacity(self.bucket_mask); 668,579 ( 0.00%) if new_items <= full_capacity / 2 { . // Rehash in-place without re-allocating if we have plenty of spare . // capacity that is locked up due to DELETED entries. . self.rehash_in_place(hasher, layout.size, drop); 6 ( 0.00%) Ok(()) . } else { . // Otherwise, conservatively resize to at least the next size up . // to avoid churning deletes into frequent rehashes. . self.resize_inner( 159,240 ( 0.00%) usize::max(new_items, full_capacity + 1), . hasher, . fallibility, . layout, . ) . } 24 ( 0.00%) } . . /// Allocates a new table of a different size and moves the contents of the . /// current table into it. . /// . /// This uses dynamic dispatch to reduce the amount of . /// code generated, but it is eliminated by LLVM optimizations when inlined. . #[allow(clippy::inline_always)] . #[inline(always)] . unsafe fn resize_inner( . &mut self, . capacity: usize, . hasher: &dyn Fn(&mut Self, usize) -> u64, . fallibility: Fallibility, . layout: TableLayout, . ) -> Result<(), TryReserveError> { 25,629 ( 0.00%) let mut new_table = self.prepare_resize(layout, capacity, fallibility)?; . . // Copy all elements to the new table. 492 ( 0.00%) for i in 0..self.buckets() { 2,043,804 ( 0.01%) if !is_full(*self.ctrl(i)) { . continue; . } . . // This may panic. . let hash = hasher(self, i); . . // We can use a simpler version of insert() here since: . // - there are no DELETED entries. -- line 1444 ---------------------------------------- -- line 1452 ---------------------------------------- . layout.size, . ); . } . . // We successfully copied all elements without panicking. Now replace . // self with the new table. The old table will have its memory freed but . // the items will not be dropped (since they have been moved into the . // new table). 60 ( 0.00%) mem::swap(self, &mut new_table); . 159,144 ( 0.00%) Ok(()) 48 ( 0.00%) } . . /// Rehashes the contents of the table in place (i.e. without changing the . /// allocation). . /// . /// If `hasher` panics then some the table's contents may be lost. . /// . /// This uses dynamic dispatch to reduce the amount of . /// code generated, but it is eliminated by LLVM optimizations when inlined. -- line 1471 ---------------------------------------- -- line 1496 ---------------------------------------- . } . self_.growth_left = bucket_mask_to_capacity(self_.bucket_mask) - self_.items; . }); . . // At this point, DELETED elements are elements that we haven't . // rehashed yet. Find them and re-insert them at their ideal . // position. . 'outer: for i in 0..guard.buckets() { 256 ( 0.00%) if *guard.ctrl(i) != DELETED { . continue; . } . . let i_p = guard.bucket_ptr(i, size_of); . . 'inner: loop { . // Hash the current item . let hash = hasher(*guard, i); -- line 1512 ---------------------------------------- -- line 1515 ---------------------------------------- . let new_i = guard.find_insert_slot(hash); . let new_i_p = guard.bucket_ptr(new_i, size_of); . . // Probing works by scanning through all of the control . // bytes in groups, which may not be aligned to the group . // size. If both the new and old position fall within the . // same unaligned group, then there is no benefit in moving . // it and we can just continue to the next item. 36 ( 0.00%) if likely(guard.is_in_same_group(i, new_i, hash)) { . guard.set_ctrl_h2(i, hash); . continue 'outer; . } . . // We are moving the current item to a new position. Write . // our H2 to the control byte of the new position. . let prev_ctrl = guard.replace_ctrl_h2(new_i, hash); . if prev_ctrl == EMPTY { -- line 1531 ---------------------------------------- -- line 1541 ---------------------------------------- . // swapped into the old slot. . debug_assert_eq!(prev_ctrl, DELETED); . ptr::swap_nonoverlapping(i_p, new_i_p, size_of); . continue 'inner; . } . } . } . 9 ( 0.00%) guard.growth_left = bucket_mask_to_capacity(guard.bucket_mask) - guard.items; . . mem::forget(guard); . } . . #[inline] 84 ( 0.00%) unsafe fn free_buckets(&mut self, table_layout: TableLayout) { . // Avoid `Option::unwrap_or_else` because it bloats LLVM IR. 240 ( 0.00%) let (layout, ctrl_offset) = match table_layout.calculate_layout_for(self.buckets()) { 144 ( 0.00%) Some(lco) => lco, . None => hint::unreachable_unchecked(), . }; 36 ( 0.00%) self.alloc.deallocate( 107,815 ( 0.00%) NonNull::new_unchecked(self.ctrl.as_ptr().sub(ctrl_offset)), . layout, . ); 24 ( 0.00%) } . . /// Marks all table buckets as empty without dropping their contents. . #[inline] . fn clear_no_drop(&mut self) { 27,946 ( 0.00%) if !self.is_empty_singleton() { . unsafe { . self.ctrl(0).write_bytes(EMPTY, self.num_ctrl_bytes()); . } . } 34,274 ( 0.00%) self.items = 0; 28,400 ( 0.00%) self.growth_left = bucket_mask_to_capacity(self.bucket_mask); . } . . #[inline] . unsafe fn erase(&mut self, index: usize) { . debug_assert!(is_full(*self.ctrl(index))); 337,137 ( 0.00%) let index_before = index.wrapping_sub(Group::WIDTH) & self.bucket_mask; . let empty_before = Group::load(self.ctrl(index_before)).match_empty(); . let empty_after = Group::load(self.ctrl(index)).match_empty(); . . // If we are inside a continuous block of Group::WIDTH full or deleted . // cells then a probe window may have seen a full block when trying to . // insert. We therefore need to keep that block non-empty so that . // lookups will continue searching to the next probe window. . // . // Note that in this context `leading_zeros` refers to the bytes at the . // end of a group, while `trailing_zeros` refers to the bytes at the . // beginning of a group. 1,348,548 ( 0.01%) let ctrl = if empty_before.leading_zeros() + empty_after.trailing_zeros() >= Group::WIDTH { . DELETED . } else { 1,672,360 ( 0.01%) self.growth_left += 1; . EMPTY . }; . self.set_ctrl(index, ctrl); 1,348,548 ( 0.01%) self.items -= 1; . } . } . . impl Clone for RawTable { 4,072 ( 0.00%) fn clone(&self) -> Self { 596 ( 0.00%) if self.table.is_empty_singleton() { . Self::new_in(self.table.alloc.clone()) . } else { . unsafe { . let mut new_table = ManuallyDrop::new( . // Avoid `Result::ok_or_else` because it bloats LLVM IR. . match Self::new_uninitialized( . self.table.alloc.clone(), . self.table.buckets(), -- line 1615 ---------------------------------------- -- line 1624 ---------------------------------------- . // We need to free the memory allocated for the new table. . new_table.free_buckets(); . }); . . // Return the newly created table. . ManuallyDrop::into_inner(new_table) . } . } 4,581 ( 0.00%) } . . fn clone_from(&mut self, source: &Self) { . if source.table.is_empty_singleton() { . *self = Self::new_in(self.table.alloc.clone()); . } else { . unsafe { . // First, drop all our elements without clearing the control bytes. . self.drop_elements(); -- line 1640 ---------------------------------------- -- line 1687 ---------------------------------------- . .table . .ctrl(0) . .copy_to_nonoverlapping(self.table.ctrl(0), self.table.num_ctrl_bytes()); . source . .data_start() . .copy_to_nonoverlapping(self.data_start(), self.table.buckets()); . . self.table.items = source.table.items; 142 ( 0.00%) self.table.growth_left = source.table.growth_left; . } . } . . impl RawTable { . /// Common code for clone and clone_from. Assumes `self.buckets() == source.buckets()`. . #[cfg_attr(feature = "inline-more", inline)] . unsafe fn clone_from_impl(&mut self, source: &Self, mut on_panic: impl FnMut(&mut Self)) { . // Copy the control bytes unchanged. We do this in a single pass -- line 1703 ---------------------------------------- -- line 1790 ---------------------------------------- . fn default() -> Self { . Self::new_in(Default::default()) . } . } . . #[cfg(feature = "nightly")] . unsafe impl<#[may_dangle] T, A: Allocator + Clone> Drop for RawTable { . #[cfg_attr(feature = "inline-more", inline)] 1,795,301 ( 0.01%) fn drop(&mut self) { 1,473,837 ( 0.01%) if !self.table.is_empty_singleton() { . unsafe { 12 ( 0.00%) self.drop_elements(); 12 ( 0.00%) self.free_buckets(); . } . } 1,920,806 ( 0.01%) } . } . #[cfg(not(feature = "nightly"))] . impl Drop for RawTable { . #[cfg_attr(feature = "inline-more", inline)] . fn drop(&mut self) { . if !self.table.is_empty_singleton() { . unsafe { . self.drop_elements(); -- line 1813 ---------------------------------------- -- line 1817 ---------------------------------------- . } . } . . impl IntoIterator for RawTable { . type Item = T; . type IntoIter = RawIntoIter; . . #[cfg_attr(feature = "inline-more", inline)] 16,168 ( 0.00%) fn into_iter(self) -> RawIntoIter { . unsafe { . let iter = self.iter(); . self.into_iter_from(iter) . } 20,210 ( 0.00%) } . } . . /// Iterator over a sub-range of a table. Unlike `RawIter` this iterator does . /// not track an item count. . pub(crate) struct RawIterRange { . // Mask of full buckets in the current group. Bits are cleared from this . // mask as each element is processed. . current_group: BitMask, -- line 1838 ---------------------------------------- -- line 1934 ---------------------------------------- . . impl Iterator for RawIterRange { . type Item = Bucket; . . #[cfg_attr(feature = "inline-more", inline)] . fn next(&mut self) -> Option> { . unsafe { . loop { 726,560 ( 0.00%) if let Some(index) = self.current_group.lowest_set_bit() { 122,579 ( 0.00%) self.current_group = self.current_group.remove_lowest_bit(); 201,078 ( 0.00%) return Some(self.data.next_n(index)); . } . 541,410 ( 0.00%) if self.next_ctrl >= self.end { . return None; . } . . // We might read past self.end up to the next group boundary, . // but this is fine because it only occurs on tables smaller . // than the group size where the trailing control bytes are all . // EMPTY. On larger tables self.end is guaranteed to be aligned . // to the group size (since tables are power-of-two sized). 19,374 ( 0.00%) self.current_group = Group::load_aligned(self.next_ctrl).match_full(); 20,243 ( 0.00%) self.data = self.data.next_n(Group::WIDTH); 36,186 ( 0.00%) self.next_ctrl = self.next_ctrl.add(Group::WIDTH); . } . } . } . . #[inline] . fn size_hint(&self) -> (usize, Option) { . // We don't have an item count, so just guess based on the range size. . ( -- line 1966 ---------------------------------------- -- line 2102 ---------------------------------------- . } . } else { . // We must have already iterated past the removed item. . } . } . } . . unsafe fn drop_elements(&mut self) { 3,316 ( 0.00%) if mem::needs_drop::() && self.len() != 0 { . for item in self { . item.drop(); . } . } . } . } . . impl Clone for RawIter { -- line 2118 ---------------------------------------- -- line 2124 ---------------------------------------- . } . } . } . . impl Iterator for RawIter { . type Item = Bucket; . . #[cfg_attr(feature = "inline-more", inline)] 133,586 ( 0.00%) fn next(&mut self) -> Option> { 352,726 ( 0.00%) if let Some(b) = self.iter.next() { 1,044,650 ( 0.00%) self.items -= 1; . Some(b) . } else { . // We don't check against items == 0 here to allow the . // compiler to optimize away the item count entirely if the . // iterator length is never queried. . debug_assert_eq!(self.items, 0); . None . } 267,172 ( 0.00%) } . . #[inline] . fn size_hint(&self) -> (usize, Option) { . (self.items, Some(self.items)) . } . } . . impl ExactSizeIterator for RawIter {} -- line 2151 ---------------------------------------- -- line 2177 ---------------------------------------- . T: Sync, . A: Sync, . { . } . . #[cfg(feature = "nightly")] . unsafe impl<#[may_dangle] T, A: Allocator + Clone> Drop for RawIntoIter { . #[cfg_attr(feature = "inline-more", inline)] 6,994 ( 0.00%) fn drop(&mut self) { . unsafe { . // Drop all remaining elements . self.iter.drop_elements(); . . // Free the table 36,226 ( 0.00%) if let Some((ptr, layout)) = self.allocation { . self.alloc.deallocate(ptr, layout); . } . } 690 ( 0.00%) } . } . #[cfg(not(feature = "nightly"))] . impl Drop for RawIntoIter { . #[cfg_attr(feature = "inline-more", inline)] . fn drop(&mut self) { . unsafe { . // Drop all remaining elements . self.iter.drop_elements(); -- line 2203 ---------------------------------------- -- line 2209 ---------------------------------------- . } . } . } . . impl Iterator for RawIntoIter { . type Item = T; . . #[cfg_attr(feature = "inline-more", inline)] 10,248 ( 0.00%) fn next(&mut self) -> Option { 2,091 ( 0.00%) unsafe { Some(self.iter.next()?.read()) } 28,430 ( 0.00%) } . . #[inline] . fn size_hint(&self) -> (usize, Option) { 5 ( 0.00%) self.iter.size_hint() . } . } . . impl ExactSizeIterator for RawIntoIter {} . impl FusedIterator for RawIntoIter {} . . /// Iterator which consumes elements without freeing the table storage. . pub struct RawDrain<'a, T, A: Allocator + Clone = Global> { -- line 2231 ---------------------------------------- -- line 2259 ---------------------------------------- . where . T: Sync, . A: Sync, . { . } . . impl Drop for RawDrain<'_, T, A> { . #[cfg_attr(feature = "inline-more", inline)] 1,408 ( 0.00%) fn drop(&mut self) { . unsafe { . // Drop all remaining elements. Note that this may panic. . self.iter.drop_elements(); . . // Reset the contents of the table now that all elements have been . // dropped. . self.table.clear_no_drop(); . . // Move the now empty table back to its original location. 176 ( 0.00%) self.orig_table . .as_ptr() . .copy_from_nonoverlapping(&*self.table, 1); . } 1,408 ( 0.00%) } . } . . impl Iterator for RawDrain<'_, T, A> { . type Item = T; . . #[cfg_attr(feature = "inline-more", inline)] . fn next(&mut self) -> Option { . unsafe { -- line 2289 ---------------------------------------- 37,245,388 ( 0.17%) -------------------------------------------------------------------------------- -- Auto-annotated source: /usr/home/liquid/rust/worktree-benchmarking/compiler/rustc_middle/src/ty/sty.rs -------------------------------------------------------------------------------- Ir -- line 21 ---------------------------------------- . use rustc_target::spec::abi; . use std::borrow::Cow; . use std::cmp::Ordering; . use std::marker::PhantomData; . use std::ops::Range; . use ty::util::IntTypeExt; . . #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] 39 ( 0.00%) #[derive(HashStable, TypeFoldable, Lift)] . pub struct TypeAndMut<'tcx> { 34,063 ( 0.00%) pub ty: Ty<'tcx>, 170,315 ( 0.00%) pub mutbl: hir::Mutability, . } . . #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, TyEncodable, TyDecodable, Copy)] . #[derive(HashStable)] . /// A "free" region `fr` can be interpreted as "some region . /// at least as big as the scope `fr.scope`". . pub struct FreeRegion { 44,828 ( 0.00%) pub scope: DefId, 92,562 ( 0.00%) pub bound_region: BoundRegionKind, . } . 763,143 ( 0.00%) #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, TyEncodable, TyDecodable, Copy)] 141 ( 0.00%) #[derive(HashStable)] . pub enum BoundRegionKind { . /// An anonymous region parameter for a given fn (&T) 50,701 ( 0.00%) BrAnon(u32), . . /// Named region parameters for functions (a in &'a T) . /// . /// The `DefId` is needed to distinguish free regions in . /// the event of shadowing. 1,974 ( 0.00%) BrNamed(DefId, Symbol), . . /// Anonymous region for the implicit env pointer parameter . /// to a closure . BrEnv, . } . 1,754 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, PartialOrd, Ord)] . #[derive(HashStable)] . pub struct BoundRegion { 173,584 ( 0.00%) pub var: BoundVar, 144,402 ( 0.00%) pub kind: BoundRegionKind, . } . . impl BoundRegionKind { . pub fn is_named(&self) -> bool { . match *self { . BoundRegionKind::BrNamed(_, name) => name != kw::UnderscoreLifetime, . _ => false, . } . } . } . . /// Defines the kinds of types. . /// . /// N.B., if you change this, you'll probably want to change the corresponding . /// AST structure in `rustc_ast/src/ast.rs` as well. 27,619,732 ( 0.13%) #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable, Debug)] 946,091 ( 0.00%) #[derive(HashStable)] . #[rustc_diagnostic_item = "TyKind"] . pub enum TyKind<'tcx> { . /// The primitive boolean type. Written as `bool`. . Bool, . . /// The primitive character type; holds a Unicode scalar value . /// (a non-surrogate code point). Written as `char`. . Char, -- line 90 ---------------------------------------- -- line 99 ---------------------------------------- . Float(ty::FloatTy), . . /// Algebraic data types (ADT). For example: structures, enumerations and unions. . /// . /// InternalSubsts here, possibly against intuition, *may* contain `Param`s. . /// That is, even after substitution it is possible that there are type . /// variables. This happens when the `Adt` corresponds to an ADT . /// definition and not a concrete use of it. 3,675,495 ( 0.02%) Adt(&'tcx AdtDef, SubstsRef<'tcx>), . . /// An unsized FFI type that is opaque to Rust. Written as `extern type T`. . Foreign(DefId), . . /// The pointee of a string slice. Written as `str`. . Str, . . /// An array with the given length. Written as `[T; n]`. 27,744 ( 0.00%) Array(Ty<'tcx>, &'tcx ty::Const<'tcx>), . . /// The pointee of an array slice. Written as `[T]`. . Slice(Ty<'tcx>), . . /// A raw pointer. Written as `*mut T` or `*const T` . RawPtr(TypeAndMut<'tcx>), . . /// A reference; a pointer with an associated lifetime. Written as . /// `&'a mut T` or `&'a T`. 2,267,483 ( 0.01%) Ref(Region<'tcx>, Ty<'tcx>, hir::Mutability), . . /// The anonymous type of a function declaration/definition. Each . /// function has a unique type, which is output (for a function . /// named `foo` returning an `i32`) as `fn() -> i32 {foo}`. . /// . /// For example the type of `bar` here: . /// . /// ```rust -- line 134 ---------------------------------------- -- line 143 ---------------------------------------- . /// . /// ```rust . /// fn foo() -> i32 { 1 } . /// let bar: fn() -> i32 = foo; . /// ``` . FnPtr(PolyFnSig<'tcx>), . . /// A trait object. Written as `dyn for<'b> Trait<'b, Assoc = u32> + Send + 'a`. 135,965 ( 0.00%) Dynamic(&'tcx List>>, ty::Region<'tcx>), . . /// The anonymous type of a closure. Used to represent the type of . /// `|a| a`. . Closure(DefId, SubstsRef<'tcx>), . . /// The anonymous type of a generator. Used to represent the type of . /// `|a| yield a`. . Generator(DefId, SubstsRef<'tcx>, hir::Movability), -- line 159 ---------------------------------------- -- line 180 ---------------------------------------- . /// The substitutions are for the generics of the function in question. . /// After typeck, the concrete type can be found in the `types` map. . Opaque(DefId, SubstsRef<'tcx>), . . /// A type parameter; for example, `T` in `fn f(x: T) {}`. . Param(ParamTy), . . /// Bound type variable, used only when preparing a trait query. 4,971 ( 0.00%) Bound(ty::DebruijnIndex, BoundTy), . . /// A placeholder type - universally quantified higher-ranked type. . Placeholder(ty::PlaceholderType), . . /// A type variable used during type checking. . Infer(InferTy), . . /// A placeholder for a type which could not be computed; this is -- line 196 ---------------------------------------- -- line 330 ---------------------------------------- . pub closure_kind_ty: T, . pub closure_sig_as_fn_ptr_ty: T, . pub tupled_upvars_ty: T, . } . . impl<'tcx> ClosureSubsts<'tcx> { . /// Construct `ClosureSubsts` from `ClosureSubstsParts`, containing `Substs` . /// for the closure parent, alongside additional closure-specific components. 40 ( 0.00%) pub fn new( . tcx: TyCtxt<'tcx>, . parts: ClosureSubstsParts<'tcx, Ty<'tcx>>, . ) -> ClosureSubsts<'tcx> { . ClosureSubsts { . substs: tcx.mk_substs( 80 ( 0.00%) parts.parent_substs.iter().copied().chain( 160 ( 0.00%) [parts.closure_kind_ty, parts.closure_sig_as_fn_ptr_ty, parts.tupled_upvars_ty] . .iter() . .map(|&ty| ty.into()), . ), . ), . } 80 ( 0.00%) } . . /// Divides the closure substs into their respective components. . /// The ordering assumed here must match that used by `ClosureSubsts::new` above. 5,513 ( 0.00%) fn split(self) -> ClosureSubstsParts<'tcx, GenericArg<'tcx>> { . match self.substs[..] { 32,432 ( 0.00%) [ 8,855 ( 0.00%) ref parent_substs @ .., 10,016 ( 0.00%) closure_kind_ty, 3,717 ( 0.00%) closure_sig_as_fn_ptr_ty, 7,999 ( 0.00%) tupled_upvars_ty, 22,052 ( 0.00%) ] => ClosureSubstsParts { . parent_substs, . closure_kind_ty, . closure_sig_as_fn_ptr_ty, . tupled_upvars_ty, . }, . _ => bug!("closure substs missing synthetics"), . } 16,539 ( 0.00%) } . . /// Returns `true` only if enough of the synthetic types are known to . /// allow using all of the methods on `ClosureSubsts` without panicking. . /// . /// Used primarily by `ty::print::pretty` to be able to handle closure . /// types that haven't had their synthetic types substituted in. 3 ( 0.00%) pub fn is_valid(self) -> bool { 6 ( 0.00%) self.substs.len() >= 3 6 ( 0.00%) && matches!(self.split().tupled_upvars_ty.expect_ty().kind(), Tuple(_)) 6 ( 0.00%) } . . /// Returns the substitutions of the closure's parent. . pub fn parent_substs(self) -> &'tcx [GenericArg<'tcx>] { . self.split().parent_substs . } . . /// Returns an iterator over the list of types of captured paths by the closure. . /// In case there was a type error in figuring out the types of the captured path, an . /// empty iterator is returned. . #[inline] 5,064 ( 0.00%) pub fn upvar_tys(self) -> impl Iterator> + 'tcx { 5,549 ( 0.00%) match self.tupled_upvars_ty().kind() { . TyKind::Error(_) => None, 2,801 ( 0.00%) TyKind::Tuple(..) => Some(self.tupled_upvars_ty().tuple_fields()), . TyKind::Infer(_) => bug!("upvar_tys called before capture types are inferred"), . ty => bug!("Unexpected representation of upvar types tuple {:?}", ty), . } . .into_iter() . .flatten() 3,376 ( 0.00%) } . . /// Returns the tuple type representing the upvars for this closure. . #[inline] . pub fn tupled_upvars_ty(self) -> Ty<'tcx> { 28,018 ( 0.00%) self.split().tupled_upvars_ty.expect_ty() . } . . /// Returns the closure kind for this closure; may return a type . /// variable during inference. To get the closure kind during . /// inference, use `infcx.closure_kind(substs)`. 2,118 ( 0.00%) pub fn kind_ty(self) -> Ty<'tcx> { . self.split().closure_kind_ty.expect_ty() 4,236 ( 0.00%) } . . /// Returns the `fn` pointer type representing the closure signature for this . /// closure. . // FIXME(eddyb) this should be unnecessary, as the shallowly resolved . // type is known at the time of the creation of `ClosureSubsts`, . // see `rustc_typeck::check::closure`. . pub fn sig_as_fn_ptr_ty(self) -> Ty<'tcx> { . self.split().closure_sig_as_fn_ptr_ty.expect_ty() . } . . /// Returns the closure kind for this closure; only usable outside . /// of an inference context, because in that context we know that . /// there are no type variables. . /// . /// If you have an inference context, use `infcx.closure_kind()`. 13 ( 0.00%) pub fn kind(self) -> ty::ClosureKind { 347 ( 0.00%) self.kind_ty().to_opt_closure_kind().unwrap() 26 ( 0.00%) } . . /// Extracts the signature from the closure. 2,046 ( 0.00%) pub fn sig(self) -> ty::PolyFnSig<'tcx> { . let ty = self.sig_as_fn_ptr_ty(); 4,092 ( 0.00%) match ty.kind() { 8,184 ( 0.00%) ty::FnPtr(sig) => *sig, . _ => bug!("closure_sig_as_fn_ptr_ty is not a fn-ptr: {:?}", ty.kind()), . } 6,138 ( 0.00%) } . } . . /// Similar to `ClosureSubsts`; see the above documentation for more. . #[derive(Copy, Clone, Debug, TypeFoldable)] . pub struct GeneratorSubsts<'tcx> { . pub substs: SubstsRef<'tcx>, . } . -- line 448 ---------------------------------------- -- line 676 ---------------------------------------- . } . . impl<'tcx> UpvarSubsts<'tcx> { . /// Returns an iterator over the list of types of captured paths by the closure/generator. . /// In case there was a type error in figuring out the types of the captured path, an . /// empty iterator is returned. . #[inline] . pub fn upvar_tys(self) -> impl Iterator> + 'tcx { 106 ( 0.00%) let tupled_tys = match self { 146 ( 0.00%) UpvarSubsts::Closure(substs) => substs.as_closure().tupled_upvars_ty(), . UpvarSubsts::Generator(substs) => substs.as_generator().tupled_upvars_ty(), . }; . 239 ( 0.00%) match tupled_tys.kind() { . TyKind::Error(_) => None, 199 ( 0.00%) TyKind::Tuple(..) => Some(self.tupled_upvars_ty().tuple_fields()), . TyKind::Infer(_) => bug!("upvar_tys called before capture types are inferred"), . ty => bug!("Unexpected representation of upvar types tuple {:?}", ty), . } . .into_iter() . .flatten() . } . . #[inline] . pub fn tupled_upvars_ty(self) -> Ty<'tcx> { 186 ( 0.00%) match self { 210 ( 0.00%) UpvarSubsts::Closure(substs) => substs.as_closure().tupled_upvars_ty(), . UpvarSubsts::Generator(substs) => substs.as_generator().tupled_upvars_ty(), . } . } . } . . /// An inline const is modeled like . /// . /// const InlineConst<'l0...'li, T0...Tj, R>: R; -- line 710 ---------------------------------------- -- line 760 ---------------------------------------- . } . . /// Returns the type of this inline const. . pub fn ty(self) -> Ty<'tcx> { . self.split().ty.expect_ty() . } . } . 209,163 ( 0.00%) #[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, TyEncodable, TyDecodable)] 140,443 ( 0.00%) #[derive(HashStable, TypeFoldable)] . pub enum ExistentialPredicate<'tcx> { . /// E.g., `Iterator`. . Trait(ExistentialTraitRef<'tcx>), . /// E.g., `Iterator::Item = T`. . Projection(ExistentialProjection<'tcx>), . /// E.g., `Send`. 1,495 ( 0.00%) AutoTrait(DefId), . } . . impl<'tcx> ExistentialPredicate<'tcx> { . /// Compares via an ordering that will not change if modules are reordered or other changes are . /// made to the tree. In particular, this ordering is preserved across incremental compilations. 25,780 ( 0.00%) pub fn stable_cmp(&self, tcx: TyCtxt<'tcx>, other: &Self) -> Ordering { . use self::ExistentialPredicate::*; 33,102 ( 0.00%) match (*self, *other) { . (Trait(_), Trait(_)) => Ordering::Equal, . (Projection(ref a), Projection(ref b)) => { . tcx.def_path_hash(a.item_def_id).cmp(&tcx.def_path_hash(b.item_def_id)) . } . (AutoTrait(ref a), AutoTrait(ref b)) => { . tcx.def_path_hash(*a).cmp(&tcx.def_path_hash(*b)) . } . (Trait(_), _) => Ordering::Less, . (Projection(_), Trait(_)) => Ordering::Greater, . (Projection(_), _) => Ordering::Less, . (AutoTrait(_), _) => Ordering::Greater, . } 30,936 ( 0.00%) } . } . . impl<'tcx> Binder<'tcx, ExistentialPredicate<'tcx>> { 10,809 ( 0.00%) pub fn with_self_ty(&self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> { . use crate::ty::ToPredicate; 6,501 ( 0.00%) match self.skip_binder() { . ExistentialPredicate::Trait(tr) => { . self.rebind(tr).with_self_ty(tcx, self_ty).without_const().to_predicate(tcx) . } . ExistentialPredicate::Projection(p) => { 34 ( 0.00%) self.rebind(p.with_self_ty(tcx, self_ty)).to_predicate(tcx) . } . ExistentialPredicate::AutoTrait(did) => { 270 ( 0.00%) let trait_ref = self.rebind(ty::TraitRef { . def_id: did, . substs: tcx.mk_substs_trait(self_ty, &[]), . }); . trait_ref.without_const().to_predicate(tcx) . } . } 9,608 ( 0.00%) } . } . . impl<'tcx> List>> { . /// Returns the "principal `DefId`" of this set of existential predicates. . /// . /// A Rust trait object type consists (in addition to a lifetime bound) . /// of a set of trait bounds, which are separated into any number . /// of auto-trait bounds, and at most one non-auto-trait bound. The -- line 826 ---------------------------------------- -- line 839 ---------------------------------------- . /// are the set `{Sync}`. . /// . /// It is also possible to have a "trivial" trait object that . /// consists only of auto traits, with no principal - for example, . /// `dyn Send + Sync`. In that case, the set of auto-trait bounds . /// is `{Send, Sync}`, while there is no principal. These trait objects . /// have a "trivial" vtable consisting of just the size, alignment, . /// and destructor. 7,499 ( 0.00%) pub fn principal(&self) -> Option>> { 39,280 ( 0.00%) self[0] 13,356 ( 0.00%) .map_bound(|this| match this { . ExistentialPredicate::Trait(tr) => Some(tr), . _ => None, 29,996 ( 0.00%) }) . .transpose() 22,497 ( 0.00%) } . 1,002 ( 0.00%) pub fn principal_def_id(&self) -> Option { . self.principal().map(|trait_ref| trait_ref.skip_binder().def_id) 2,004 ( 0.00%) } . . #[inline] . pub fn projection_bounds<'a>( . &'a self, . ) -> impl Iterator>> + 'a { . self.iter().filter_map(|predicate| { 186 ( 0.00%) predicate 36,708 ( 0.00%) .map_bound(|pred| match pred { 8,688 ( 0.00%) ExistentialPredicate::Projection(projection) => Some(projection), . _ => None, . }) . .transpose() . }) . } . . #[inline] . pub fn auto_traits<'a>(&'a self) -> impl Iterator + 'a { 44 ( 0.00%) self.iter().filter_map(|predicate| match predicate.skip_binder() { . ExistentialPredicate::AutoTrait(did) => Some(did), . _ => None, . }) . } . } . . /// A complete reference to a trait. These take numerous guises in syntax, . /// but perhaps the most recognizable form is in a where-clause: -- line 884 ---------------------------------------- -- line 886 ---------------------------------------- . /// T: Foo . /// . /// This would be represented by a trait-reference where the `DefId` is the . /// `DefId` for the trait `Foo` and the substs define `T` as parameter 0, . /// and `U` as parameter 1. . /// . /// Trait references also appear in object types like `Foo`, but in . /// that case the `Self` parameter is absent from the substitutions. 38,609 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)] 1,789,380 ( 0.01%) #[derive(HashStable, TypeFoldable)] . pub struct TraitRef<'tcx> { 7,712 ( 0.00%) pub def_id: DefId, 1,262,881 ( 0.01%) pub substs: SubstsRef<'tcx>, . } . . impl<'tcx> TraitRef<'tcx> { 3,060 ( 0.00%) pub fn new(def_id: DefId, substs: SubstsRef<'tcx>) -> TraitRef<'tcx> { . TraitRef { def_id, substs } 12,240 ( 0.00%) } . . /// Returns a `TraitRef` of the form `P0: Foo` where `Pi` . /// are the parameters defined on trait. 8,874 ( 0.00%) pub fn identity(tcx: TyCtxt<'tcx>, def_id: DefId) -> Binder<'tcx, TraitRef<'tcx>> { 3,944 ( 0.00%) ty::Binder::dummy(TraitRef { . def_id, 5,916 ( 0.00%) substs: InternalSubsts::identity_for_item(tcx, def_id), . }) 7,888 ( 0.00%) } . . #[inline] 27 ( 0.00%) pub fn self_ty(&self) -> Ty<'tcx> { . self.substs.type_at(0) 18 ( 0.00%) } . 32,520 ( 0.00%) pub fn from_method( . tcx: TyCtxt<'tcx>, . trait_id: DefId, . substs: SubstsRef<'tcx>, . ) -> ty::TraitRef<'tcx> { . let defs = tcx.generics_of(trait_id); . 4,065 ( 0.00%) ty::TraitRef { def_id: trait_id, substs: tcx.intern_substs(&substs[..defs.params.len()]) } 44,715 ( 0.00%) } . } . . pub type PolyTraitRef<'tcx> = Binder<'tcx, TraitRef<'tcx>>; . . impl<'tcx> PolyTraitRef<'tcx> { . pub fn self_ty(&self) -> Binder<'tcx, Ty<'tcx>> { . self.map_bound_ref(|tr| tr.self_ty()) . } . . pub fn def_id(&self) -> DefId { 23,742 ( 0.00%) self.skip_binder().def_id 7,914 ( 0.00%) } . 7,316 ( 0.00%) pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> { 14,632 ( 0.00%) self.map_bound(|trait_ref| ty::TraitPredicate { . trait_ref, . constness: ty::BoundConstness::NotConst, . polarity: ty::ImplPolarity::Positive, . }) 7,316 ( 0.00%) } . } . . /// An existential reference to a trait, where `Self` is erased. . /// For example, the trait object `Trait<'a, 'b, X, Y>` is: . /// . /// exists T. T: Trait<'a, 'b, X, Y> . /// . /// The substitutions don't include the erased `Self`, only trait . /// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above). 3,336 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)] 54,909 ( 0.00%) #[derive(HashStable, TypeFoldable)] . pub struct ExistentialTraitRef<'tcx> { 12,344 ( 0.00%) pub def_id: DefId, 78,130 ( 0.00%) pub substs: SubstsRef<'tcx>, . } . . impl<'tcx> ExistentialTraitRef<'tcx> { 4,392 ( 0.00%) pub fn erase_self_ty( . tcx: TyCtxt<'tcx>, . trait_ref: ty::TraitRef<'tcx>, . ) -> ty::ExistentialTraitRef<'tcx> { . // Assert there is a Self. . trait_ref.substs.type_at(0); . . ty::ExistentialTraitRef { . def_id: trait_ref.def_id, . substs: tcx.intern_substs(&trait_ref.substs[1..]), . } 4,392 ( 0.00%) } . . /// Object types don't have a self type specified. Therefore, when . /// we convert the principal trait-ref into a normal trait-ref, . /// you must give *some* self type. A common choice is `mk_err()` . /// or some placeholder type. 1,240 ( 0.00%) pub fn with_self_ty(&self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> ty::TraitRef<'tcx> { . // otherwise the escaping vars would be captured by the binder . // debug_assert!(!self_ty.has_escaping_bound_vars()); . 620 ( 0.00%) ty::TraitRef { def_id: self.def_id, substs: tcx.mk_substs_trait(self_ty, self.substs) } 3,100 ( 0.00%) } . } . . pub type PolyExistentialTraitRef<'tcx> = Binder<'tcx, ExistentialTraitRef<'tcx>>; . . impl<'tcx> PolyExistentialTraitRef<'tcx> { . pub fn def_id(&self) -> DefId { . self.skip_binder().def_id . } . . /// Object types don't have a self type specified. Therefore, when . /// we convert the principal trait-ref into a normal trait-ref, . /// you must give *some* self type. A common choice is `mk_err()` . /// or some placeholder type. 3,765 ( 0.00%) pub fn with_self_ty(&self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> ty::PolyTraitRef<'tcx> { 4,937 ( 0.00%) self.map_bound(|trait_ref| trait_ref.with_self_ty(tcx, self_ty)) 5,020 ( 0.00%) } . } . 172,740 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] 260 ( 0.00%) #[derive(HashStable)] . pub enum BoundVariableKind { . Ty(BoundTyKind), . Region(BoundRegionKind), . Const, . } . . /// Binder is a binder for higher-ranked lifetimes or types. It is part of the . /// compiler's representation for things like `for<'a> Fn(&'a isize)` . /// (which would be represented by the type `PolyTraitRef == . /// Binder<'tcx, TraitRef>`). Note that when we instantiate, . /// erase, or otherwise "discharge" these bound vars, we change the . /// type from `Binder<'tcx, T>` to just `T` (see . /// e.g., `liberate_late_bound_regions`). . /// . /// `Decodable` and `Encodable` are implemented for `Binder` using the `impl_binder_encode_decode!` macro. 174,124 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] 728,445 ( 0.00%) pub struct Binder<'tcx, T>(T, &'tcx List); . . impl<'tcx, T> Binder<'tcx, T> . where . T: TypeFoldable<'tcx>, . { . /// Wraps `value` in a binder, asserting that `value` does not . /// contain any bound vars that would be bound by the . /// binder. This is commonly used to 'inject' a value T into a . /// different binding level. 43,467 ( 0.00%) pub fn dummy(value: T) -> Binder<'tcx, T> { 164,691 ( 0.00%) assert!(!value.has_escaping_bound_vars()); 388,875 ( 0.00%) Binder(value, ty::List::empty()) 43,126 ( 0.00%) } . . pub fn bind_with_vars(value: T, vars: &'tcx List) -> Binder<'tcx, T> { . if cfg!(debug_assertions) { . let mut validator = ValidateBoundVars::new(vars); . value.visit_with(&mut validator); . } 91,575 ( 0.00%) Binder(value, vars) . } . } . . impl<'tcx, T> Binder<'tcx, T> { . /// Skips the binder and returns the "bound" value. This is a . /// risky thing to do because it's easy to get confused about . /// De Bruijn indices and the like. It is usually better to . /// discharge the binder using `no_bound_vars` or -- line 1053 ---------------------------------------- -- line 1059 ---------------------------------------- . /// accounting. . /// . /// Some examples where `skip_binder` is reasonable: . /// . /// - extracting the `DefId` from a PolyTraitRef; . /// - comparing the self type of a PolyTraitRef to see if it is equal to . /// a type parameter `X`, since the type `X` does not reference any regions . pub fn skip_binder(self) -> T { 1,988,333 ( 0.01%) self.0 . } . . pub fn bound_vars(&self) -> &'tcx List { 10,158 ( 0.00%) self.1 . } . . pub fn as_ref(&self) -> Binder<'tcx, &T> { 10,426 ( 0.00%) Binder(&self.0, self.1) . } . . pub fn map_bound_ref_unchecked(&self, f: F) -> Binder<'tcx, U> . where . F: FnOnce(&T) -> U, . { . let value = f(&self.0); . Binder(value, self.1) -- line 1083 ---------------------------------------- -- line 1085 ---------------------------------------- . . pub fn map_bound_ref>(&self, f: F) -> Binder<'tcx, U> . where . F: FnOnce(&T) -> U, . { . self.as_ref().map_bound(f) . } . 2,578 ( 0.00%) pub fn map_bound>(self, f: F) -> Binder<'tcx, U> . where . F: FnOnce(T) -> U, . { 99,215 ( 0.00%) let value = f(self.0); . if cfg!(debug_assertions) { . let mut validator = ValidateBoundVars::new(self.1); . value.visit_with(&mut validator); . } 407,787 ( 0.00%) Binder(value, self.1) 2,581 ( 0.00%) } . . pub fn try_map_bound, E>(self, f: F) -> Result, E> . where . F: FnOnce(T) -> Result, . { . let value = f(self.0)?; . if cfg!(debug_assertions) { . let mut validator = ValidateBoundVars::new(self.1); . value.visit_with(&mut validator); . } 26,672 ( 0.00%) Ok(Binder(value, self.1)) . } . . /// Wraps a `value` in a binder, using the same bound variables as the . /// current `Binder`. This should not be used if the new value *changes* . /// the bound variables. Note: the (old or new) value itself does not . /// necessarily need to *name* all the bound variables. . /// . /// This currently doesn't do anything different than `bind`, because we -- line 1122 ---------------------------------------- -- line 1126 ---------------------------------------- . pub fn rebind(&self, value: U) -> Binder<'tcx, U> . where . U: TypeFoldable<'tcx>, . { . if cfg!(debug_assertions) { . let mut validator = ValidateBoundVars::new(self.bound_vars()); . value.visit_with(&mut validator); . } 57,524 ( 0.00%) Binder(value, self.1) . } . . /// Unwraps and returns the value within, but only if it contains . /// no bound vars at all. (In other words, if this binder -- . /// and indeed any enclosing binder -- doesn't bind anything at . /// all.) Otherwise, returns `None`. . /// . /// (One could imagine having a method that just unwraps a single -- line 1142 ---------------------------------------- -- line 1143 ---------------------------------------- . /// binder, but permits late-bound vars bound by enclosing . /// binders, but that would require adjusting the debruijn . /// indices, and given the shallow binding structure we often use, . /// would not be that useful.) . pub fn no_bound_vars(self) -> Option . where . T: TypeFoldable<'tcx>, . { 297,051 ( 0.00%) if self.0.has_escaping_bound_vars() { None } else { Some(self.skip_binder()) } 790 ( 0.00%) } . . /// Splits the contents into two things that share the same binder . /// level as the original, returning two distinct binders. . /// . /// `f` should consider bound regions at depth 1 to be free, and . /// anything it produces with bound regions at depth 1 will be . /// bound in the resulting return values. . pub fn split(self, f: F) -> (Binder<'tcx, U>, Binder<'tcx, V>) -- line 1160 ---------------------------------------- -- line 1170 ---------------------------------------- . pub fn transpose(self) -> Option> { . let bound_vars = self.1; . self.0.map(|v| Binder(v, bound_vars)) . } . } . . /// Represents the projection of an associated type. In explicit UFCS . /// form this would be written `>::N`. 4,426 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] 195,967 ( 0.00%) #[derive(HashStable, TypeFoldable)] . pub struct ProjectionTy<'tcx> { . /// The parameters of the associated item. 114,957 ( 0.00%) pub substs: SubstsRef<'tcx>, . . /// The `DefId` of the `TraitItem` for the associated type `N`. . /// . /// Note that this is not the `DefId` of the `TraitRef` containing this . /// associated type, which is in `tcx.associated_item(item_def_id).container`. 174,929 ( 0.00%) pub item_def_id: DefId, . } . . impl<'tcx> ProjectionTy<'tcx> { 35,735 ( 0.00%) pub fn trait_def_id(&self, tcx: TyCtxt<'tcx>) -> DefId { 10,210 ( 0.00%) tcx.associated_item(self.item_def_id).container.id() 40,840 ( 0.00%) } . . /// Extracts the underlying trait reference and own substs from this projection. . /// For example, if this is a projection of `::Item<'a>`, . /// then this function would return a `T: Iterator` trait reference and `['a]` as the own substs 22,680 ( 0.00%) pub fn trait_ref_and_own_substs( . &self, . tcx: TyCtxt<'tcx>, . ) -> (ty::TraitRef<'tcx>, &'tcx [ty::GenericArg<'tcx>]) { 9,720 ( 0.00%) let def_id = tcx.associated_item(self.item_def_id).container.id(); . let trait_generics = tcx.generics_of(def_id); 16,200 ( 0.00%) ( . ty::TraitRef { def_id, substs: self.substs.truncate_to(tcx, trait_generics) }, . &self.substs[trait_generics.count()..], . ) 29,160 ( 0.00%) } . . /// Extracts the underlying trait reference from this projection. . /// For example, if this is a projection of `::Item`, . /// then this function would return a `T: Iterator` trait reference. . /// . /// WARNING: This will drop the substs for generic associated types . /// consider calling [Self::trait_ref_and_own_substs] to get those . /// as well. 45,594 ( 0.00%) pub fn trait_ref(&self, tcx: TyCtxt<'tcx>) -> ty::TraitRef<'tcx> { 5,066 ( 0.00%) let def_id = self.trait_def_id(tcx); 5,066 ( 0.00%) ty::TraitRef { def_id, substs: self.substs.truncate_to(tcx, tcx.generics_of(def_id)) } 55,726 ( 0.00%) } . 10,581 ( 0.00%) pub fn self_ty(&self) -> Ty<'tcx> { 31,743 ( 0.00%) self.substs.type_at(0) 21,162 ( 0.00%) } . } . . #[derive(Copy, Clone, Debug, TypeFoldable)] . pub struct GenSig<'tcx> { . pub resume_ty: Ty<'tcx>, . pub yield_ty: Ty<'tcx>, . pub return_ty: Ty<'tcx>, . } -- line 1233 ---------------------------------------- -- line 1235 ---------------------------------------- . pub type PolyGenSig<'tcx> = Binder<'tcx, GenSig<'tcx>>; . . /// Signature of a function type, which we have arbitrarily . /// decided to use to refer to the input/output types. . /// . /// - `inputs`: is the list of arguments and their modes. . /// - `output`: is the return type. . /// - `c_variadic`: indicates whether this is a C-variadic function. 156,974 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)] 94,777 ( 0.00%) #[derive(HashStable, TypeFoldable)] . pub struct FnSig<'tcx> { 8,476 ( 0.00%) pub inputs_and_output: &'tcx List>, 75,758 ( 0.00%) pub c_variadic: bool, 13,466 ( 0.00%) pub unsafety: hir::Unsafety, 72,751 ( 0.00%) pub abi: abi::Abi, . } . . impl<'tcx> FnSig<'tcx> { 58,306 ( 0.00%) pub fn inputs(&self) -> &'tcx [Ty<'tcx>] { 275,980 ( 0.00%) &self.inputs_and_output[..self.inputs_and_output.len() - 1] 116,612 ( 0.00%) } . 28,624 ( 0.00%) pub fn output(&self) -> Ty<'tcx> { 264,194 ( 0.00%) self.inputs_and_output[self.inputs_and_output.len() - 1] 57,248 ( 0.00%) } . . // Creates a minimal `FnSig` to be used when encountering a `TyKind::Error` in a fallible . // method. . fn fake() -> FnSig<'tcx> { . FnSig { . inputs_and_output: List::empty(), . c_variadic: false, . unsafety: hir::Unsafety::Normal, -- line 1267 ---------------------------------------- -- line 1270 ---------------------------------------- . } . } . . pub type PolyFnSig<'tcx> = Binder<'tcx, FnSig<'tcx>>; . . impl<'tcx> PolyFnSig<'tcx> { . #[inline] . pub fn inputs(&self) -> Binder<'tcx, &'tcx [Ty<'tcx>]> { 22,021 ( 0.00%) self.map_bound_ref_unchecked(|fn_sig| fn_sig.inputs()) . } . #[inline] . pub fn input(&self, index: usize) -> ty::Binder<'tcx, Ty<'tcx>> { 17,943 ( 0.00%) self.map_bound_ref(|fn_sig| fn_sig.inputs()[index]) . } . pub fn inputs_and_output(&self) -> ty::Binder<'tcx, &'tcx List>> { . self.map_bound_ref(|fn_sig| fn_sig.inputs_and_output) 761 ( 0.00%) } . #[inline] . pub fn output(&self) -> ty::Binder<'tcx, Ty<'tcx>> { 11,949 ( 0.00%) self.map_bound_ref(|fn_sig| fn_sig.output()) . } . pub fn c_variadic(&self) -> bool { 1,520 ( 0.00%) self.skip_binder().c_variadic 760 ( 0.00%) } . pub fn unsafety(&self) -> hir::Unsafety { 4,892 ( 0.00%) self.skip_binder().unsafety 2,446 ( 0.00%) } . pub fn abi(&self) -> abi::Abi { 135,336 ( 0.00%) self.skip_binder().abi 33,834 ( 0.00%) } . } . . pub type CanonicalPolyFnSig<'tcx> = Canonical<'tcx, Binder<'tcx, FnSig<'tcx>>>; . 92 ( 0.00%) #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)] 3,046 ( 0.00%) #[derive(HashStable)] . pub struct ParamTy { 248 ( 0.00%) pub index: u32, . pub name: Symbol, . } . . impl<'tcx> ParamTy { 440 ( 0.00%) pub fn new(index: u32, name: Symbol) -> ParamTy { . ParamTy { index, name } 220 ( 0.00%) } . . pub fn for_def(def: &ty::GenericParamDef) -> ParamTy { 56 ( 0.00%) ParamTy::new(def.index, def.name) 28 ( 0.00%) } . . #[inline] . pub fn to_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { . tcx.mk_ty_param(self.index, self.name) . } . } . . #[derive(Copy, Clone, Hash, TyEncodable, TyDecodable, Eq, PartialEq, Ord, PartialOrd)] 23 ( 0.00%) #[derive(HashStable)] . pub struct ParamConst { 212 ( 0.00%) pub index: u32, 212 ( 0.00%) pub name: Symbol, . } . . impl ParamConst { . pub fn new(index: u32, name: Symbol) -> ParamConst { . ParamConst { index, name } . } . . pub fn for_def(def: &ty::GenericParamDef) -> ParamConst { -- line 1338 ---------------------------------------- -- line 1440 ---------------------------------------- . /// the inference variable is supposed to satisfy the relation . /// *for every value of the placeholder region*. To ensure that doesn't . /// happen, you can use `leak_check`. This is more clearly explained . /// by the [rustc dev guide]. . /// . /// [1]: https://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ . /// [2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ . /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html 7,288,329 ( 0.03%) #[derive(Clone, PartialEq, Eq, Hash, Copy, TyEncodable, TyDecodable, PartialOrd, Ord)] 16,242 ( 0.00%) pub enum RegionKind { . /// Region bound in a type or fn declaration which will be . /// substituted 'early' -- that is, at the same time when type . /// parameters are substituted. . ReEarlyBound(EarlyBoundRegion), . . /// Region bound in a function scope, which will be substituted when the . /// function is called. 287,366 ( 0.00%) ReLateBound(ty::DebruijnIndex, BoundRegion), . . /// When checking a function body, the types of all arguments and so forth . /// that refer to bound region parameters are modified to refer to free . /// region parameters. . ReFree(FreeRegion), . . /// Static data that has an "infinite" lifetime. Top in the region lattice. . ReStatic, -- line 1465 ---------------------------------------- -- line 1478 ---------------------------------------- . /// regions visible from `U`, but not less than regions not visible . /// from `U`. . ReEmpty(ty::UniverseIndex), . . /// Erased region, used by trait selection, in MIR and during codegen. . ReErased, . } . 38,816 ( 0.00%) #[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, PartialOrd, Ord)] . pub struct EarlyBoundRegion { 30,802 ( 0.00%) pub def_id: DefId, 34,395 ( 0.00%) pub index: u32, 98,466 ( 0.00%) pub name: Symbol, . } . . /// A **`const`** **v**ariable **ID**. . #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)] . pub struct ConstVid<'tcx> { 2,456 ( 0.00%) pub index: u32, 583 ( 0.00%) pub phantom: PhantomData<&'tcx ()>, . } . . rustc_index::newtype_index! { . /// A **region** (lifetime) **v**ariable **ID**. . pub struct RegionVid { . DEBUG_FORMAT = custom, . } . } -- line 1505 ---------------------------------------- -- line 1513 ---------------------------------------- . rustc_index::newtype_index! { . pub struct BoundVar { .. } . } . . #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] . #[derive(HashStable)] . pub struct BoundTy { . pub var: BoundVar, 4,971 ( 0.00%) pub kind: BoundTyKind, . } . 84,627 ( 0.00%) #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] . #[derive(HashStable)] . pub enum BoundTyKind { . Anon, . Param(Symbol), . } . . impl From for BoundTy { . fn from(var: BoundVar) -> Self { . BoundTy { var, kind: BoundTyKind::Anon } . } . } . . /// A `ProjectionPredicate` for an `ExistentialTraitRef`. 1,763 ( 0.00%) #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] 9,883 ( 0.00%) #[derive(HashStable, TypeFoldable)] . pub struct ExistentialProjection<'tcx> { 3,670 ( 0.00%) pub item_def_id: DefId, 16,164 ( 0.00%) pub substs: SubstsRef<'tcx>, 4,041 ( 0.00%) pub term: Term<'tcx>, . } . . pub type PolyExistentialProjection<'tcx> = Binder<'tcx, ExistentialProjection<'tcx>>; . . impl<'tcx> ExistentialProjection<'tcx> { . /// Extracts the underlying existential trait reference from this projection. . /// For example, if this is a projection of `exists T. ::Item == X`, . /// then this function would return an `exists T. T: Iterator` existential trait . /// reference. 546 ( 0.00%) pub fn trait_ref(&self, tcx: TyCtxt<'tcx>) -> ty::ExistentialTraitRef<'tcx> { 234 ( 0.00%) let def_id = tcx.associated_item(self.item_def_id).container.id(); 156 ( 0.00%) let subst_count = tcx.generics_of(def_id).count() - 1; 78 ( 0.00%) let substs = tcx.intern_substs(&self.substs[..subst_count]); . ty::ExistentialTraitRef { def_id, substs } 702 ( 0.00%) } . . pub fn with_self_ty( . &self, . tcx: TyCtxt<'tcx>, . self_ty: Ty<'tcx>, . ) -> ty::ProjectionPredicate<'tcx> { . // otherwise the escaping regions would be captured by the binders . debug_assert!(!self_ty.has_escaping_bound_vars()); -- line 1566 ---------------------------------------- -- line 1569 ---------------------------------------- . projection_ty: ty::ProjectionTy { . item_def_id: self.item_def_id, . substs: tcx.mk_substs_trait(self_ty, self.substs), . }, . term: self.term, . } . } . 80 ( 0.00%) pub fn erase_self_ty( . tcx: TyCtxt<'tcx>, . projection_predicate: ty::ProjectionPredicate<'tcx>, . ) -> Self { . // Assert there is a Self. 48 ( 0.00%) projection_predicate.projection_ty.substs.type_at(0); . 64 ( 0.00%) Self { 32 ( 0.00%) item_def_id: projection_predicate.projection_ty.item_def_id, . substs: tcx.intern_substs(&projection_predicate.projection_ty.substs[1..]), 16 ( 0.00%) term: projection_predicate.term, . } 112 ( 0.00%) } . } . . impl<'tcx> PolyExistentialProjection<'tcx> { 110 ( 0.00%) pub fn with_self_ty( . &self, . tcx: TyCtxt<'tcx>, . self_ty: Ty<'tcx>, . ) -> ty::PolyProjectionPredicate<'tcx> { 110 ( 0.00%) self.map_bound(|p| p.with_self_ty(tcx, self_ty)) 132 ( 0.00%) } . . pub fn item_def_id(&self) -> DefId { 42 ( 0.00%) self.skip_binder().item_def_id 21 ( 0.00%) } . } . . /// Region utilities . impl RegionKind { . /// Is this region named by the user? . pub fn has_name(&self) -> bool { . match *self { . RegionKind::ReEarlyBound(ebr) => ebr.has_name(), -- line 1611 ---------------------------------------- -- line 1616 ---------------------------------------- . RegionKind::RePlaceholder(placeholder) => placeholder.name.is_named(), . RegionKind::ReEmpty(_) => false, . RegionKind::ReErased => false, . } . } . . #[inline] . pub fn is_late_bound(&self) -> bool { 6,826 ( 0.00%) matches!(*self, ty::ReLateBound(..)) . } . . #[inline] . pub fn is_placeholder(&self) -> bool { 21 ( 0.00%) matches!(*self, ty::RePlaceholder(..)) . } . . #[inline] . pub fn bound_at_or_above_binder(&self, index: ty::DebruijnIndex) -> bool { 233,678 ( 0.00%) match *self { . ty::ReLateBound(debruijn, _) => debruijn >= index, . _ => false, . } . } . . pub fn type_flags(&self) -> TypeFlags { . let mut flags = TypeFlags::empty(); . 495,374 ( 0.00%) match *self { . ty::ReVar(..) => { . flags = flags | TypeFlags::HAS_FREE_REGIONS; . flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS; . flags = flags | TypeFlags::HAS_RE_INFER; . } . ty::RePlaceholder(..) => { . flags = flags | TypeFlags::HAS_FREE_REGIONS; . flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS; -- line 1651 ---------------------------------------- -- line 1669 ---------------------------------------- . ty::ReErased => { . flags = flags | TypeFlags::HAS_RE_ERASED; . } . } . . debug!("type_flags({:?}) = {:?}", self, flags); . . flags 68,444 ( 0.00%) } . . /// Given an early-bound or free region, returns the `DefId` where it was bound. . /// For example, consider the regions in this snippet of code: . /// . /// ``` . /// impl<'a> Foo { . /// ^^ -- early bound, declared on an impl . /// -- line 1685 ---------------------------------------- -- line 1713 ---------------------------------------- . . #[inline(always)] . pub fn flags(&self) -> TypeFlags { . self.flags . } . . #[inline] . pub fn is_unit(&self) -> bool { 5,502 ( 0.00%) match self.kind() { 928 ( 0.00%) Tuple(ref tys) => tys.is_empty(), . _ => false, . } . } . . #[inline] . pub fn is_never(&self) -> bool { 50,721 ( 0.00%) matches!(self.kind(), Never) . } . . #[inline] . pub fn is_primitive(&self) -> bool { . self.kind().is_primitive() . } . . #[inline] -- line 1737 ---------------------------------------- -- line 1741 ---------------------------------------- . . #[inline] . pub fn is_ref(&self) -> bool { . matches!(self.kind(), Ref(..)) . } . . #[inline] . pub fn is_ty_var(&self) -> bool { 80,746 ( 0.00%) matches!(self.kind(), Infer(TyVar(_))) . } . . #[inline] . pub fn ty_vid(&self) -> Option { 67,740 ( 0.00%) match self.kind() { 9,780 ( 0.00%) &Infer(TyVar(vid)) => Some(vid), . _ => None, . } . } . . #[inline] . pub fn is_ty_infer(&self) -> bool { 120 ( 0.00%) matches!(self.kind(), Infer(_)) . } . . #[inline] . pub fn is_phantom_data(&self) -> bool { . if let Adt(def, _) = self.kind() { def.is_phantom_data() } else { false } . } . . #[inline] -- line 1770 ---------------------------------------- -- line 1775 ---------------------------------------- . /// Returns `true` if this type is a `str`. . #[inline] . pub fn is_str(&self) -> bool { . *self.kind() == Str . } . . #[inline] . pub fn is_param(&self, index: u32) -> bool { 1,148 ( 0.00%) match self.kind() { . ty::Param(ref data) => data.index == index, . _ => false, . } . } . . #[inline] . pub fn is_slice(&self) -> bool { . match self.kind() { . RawPtr(TypeAndMut { ty, .. }) | Ref(_, ty, _) => matches!(ty.kind(), Slice(_) | Str), . _ => false, . } . } . . #[inline] . pub fn is_array(&self) -> bool { 282 ( 0.00%) matches!(self.kind(), Array(..)) . } . . #[inline] . pub fn is_simd(&self) -> bool { 34 ( 0.00%) match self.kind() { 17 ( 0.00%) Adt(def, _) => def.repr.simd(), . _ => false, . } . } . 166 ( 0.00%) pub fn sequence_element_type(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { 332 ( 0.00%) match self.kind() { . Array(ty, _) | Slice(ty) => ty, . Str => tcx.mk_mach_uint(ty::UintTy::U8), . _ => bug!("`sequence_element_type` called on non-sequence value: {}", self), . } 166 ( 0.00%) } . . pub fn simd_size_and_type(&self, tcx: TyCtxt<'tcx>) -> (u64, Ty<'tcx>) { . match self.kind() { . Adt(def, substs) => { . assert!(def.repr.simd(), "`simd_size_and_type` called on non-SIMD type"); . let variant = def.non_enum_variant(); . let f0_ty = variant.fields[0].ty(tcx, substs); . -- line 1824 ---------------------------------------- -- line 1838 ---------------------------------------- . } . } . _ => bug!("`simd_size_and_type` called on invalid type"), . } . } . . #[inline] . pub fn is_region_ptr(&self) -> bool { 5 ( 0.00%) matches!(self.kind(), Ref(..)) . } . . #[inline] . pub fn is_mutable_ptr(&self) -> bool { 15 ( 0.00%) matches!( 10 ( 0.00%) self.kind(), . RawPtr(TypeAndMut { mutbl: hir::Mutability::Mut, .. }) . | Ref(_, _, hir::Mutability::Mut) . ) . } . . /// Get the mutability of the reference or `None` when not a reference . #[inline] . pub fn ref_mutability(&self) -> Option { -- line 1860 ---------------------------------------- -- line 1861 ---------------------------------------- . match self.kind() { . Ref(_, _, mutability) => Some(*mutability), . _ => None, . } . } . . #[inline] . pub fn is_unsafe_ptr(&self) -> bool { 20,788 ( 0.00%) matches!(self.kind(), RawPtr(_)) . } . . /// Tests if this is any kind of primitive pointer type (reference, raw pointer, fn pointer). . #[inline] . pub fn is_any_ptr(&self) -> bool { 28 ( 0.00%) self.is_region_ptr() || self.is_unsafe_ptr() || self.is_fn_ptr() . } . . #[inline] . pub fn is_box(&self) -> bool { 65,080 ( 0.00%) match self.kind() { 15,353 ( 0.00%) Adt(def, _) => def.is_box(), . _ => false, . } . } . . /// Panics if called on any type other than `Box`. 3,192 ( 0.00%) pub fn boxed_ty(&self) -> Ty<'tcx> { 3,192 ( 0.00%) match self.kind() { 7,980 ( 0.00%) Adt(def, substs) if def.is_box() => substs.type_at(0), . _ => bug!("`boxed_ty` is called on non-box type {:?}", self), . } 3,192 ( 0.00%) } . . /// A scalar type is one that denotes an atomic datum, with no sub-components. . /// (A RawPtr is scalar because it represents a non-managed pointer, so its . /// contents are abstract to rustc.) . #[inline] . pub fn is_scalar(&self) -> bool { 765 ( 0.00%) matches!( 1,769 ( 0.00%) self.kind(), . Bool | Char . | Int(_) . | Float(_) . | Uint(_) . | FnDef(..) . | FnPtr(_) . | RawPtr(_) . | Infer(IntVar(_) | FloatVar(_)) . ) . } . . /// Returns `true` if this type is a floating point type. . #[inline] . pub fn is_floating_point(&self) -> bool { 4,230 ( 0.00%) matches!(self.kind(), Float(_) | Infer(FloatVar(_))) . } . . #[inline] . pub fn is_trait(&self) -> bool { 2,949 ( 0.00%) matches!(self.kind(), Dynamic(..)) . } . . #[inline] . pub fn is_enum(&self) -> bool { 2,918 ( 0.00%) matches!(self.kind(), Adt(adt_def, _) if adt_def.is_enum()) . } . . #[inline] . pub fn is_union(&self) -> bool { 12,986 ( 0.00%) matches!(self.kind(), Adt(adt_def, _) if adt_def.is_union()) . } . . #[inline] . pub fn is_closure(&self) -> bool { 3,054 ( 0.00%) matches!(self.kind(), Closure(..)) . } . . #[inline] . pub fn is_generator(&self) -> bool { 6,004 ( 0.00%) matches!(self.kind(), Generator(..)) . } . . #[inline] . pub fn is_integral(&self) -> bool { 9,761 ( 0.00%) matches!(self.kind(), Infer(IntVar(_)) | Int(_) | Uint(_)) . } . . #[inline] . pub fn is_fresh_ty(&self) -> bool { . matches!(self.kind(), Infer(FreshTy(_))) . } . . #[inline] . pub fn is_fresh(&self) -> bool { 8,870 ( 0.00%) matches!(self.kind(), Infer(FreshTy(_) | FreshIntTy(_) | FreshFloatTy(_))) . } . . #[inline] . pub fn is_char(&self) -> bool { . matches!(self.kind(), Char) . } . . #[inline] . pub fn is_numeric(&self) -> bool { . self.is_integral() || self.is_floating_point() . } . . #[inline] . pub fn is_signed(&self) -> bool { 1,459 ( 0.00%) matches!(self.kind(), Int(_)) . } . . #[inline] . pub fn is_ptr_sized_integral(&self) -> bool { 873 ( 0.00%) matches!(self.kind(), Int(ty::IntTy::Isize) | Uint(ty::UintTy::Usize)) . } . . #[inline] . pub fn has_concrete_skeleton(&self) -> bool { . !matches!(self.kind(), Param(_) | Infer(_) | Error(_)) . } . . /// Returns the type and mutability of `*ty`. . /// . /// The parameter `explicit` indicates if this is an *explicit* dereference. . /// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly. 25,282 ( 0.00%) pub fn builtin_deref(&self, explicit: bool) -> Option> { 167,854 ( 0.00%) match self.kind() { 1,922 ( 0.00%) Adt(def, _) if def.is_box() => { 1,146 ( 0.00%) Some(TypeAndMut { ty: self.boxed_ty(), mutbl: hir::Mutability::Not }) . } 84,670 ( 0.00%) Ref(_, ty, mutbl) => Some(TypeAndMut { ty, mutbl: *mutbl }), 14,688 ( 0.00%) RawPtr(mt) if explicit => Some(*mt), . _ => None, . } 50,564 ( 0.00%) } . . /// Returns the type of `ty[i]`. . pub fn builtin_index(&self) -> Option> { 3,376 ( 0.00%) match self.kind() { . Array(ty, _) | Slice(ty) => Some(ty), . _ => None, . } 220 ( 0.00%) } . 357,648 ( 0.00%) pub fn fn_sig(&self, tcx: TyCtxt<'tcx>) -> PolyFnSig<'tcx> { 178,824 ( 0.00%) match self.kind() { 133,302 ( 0.00%) FnDef(def_id, substs) => tcx.fn_sig(*def_id).subst(tcx, substs), 1,360 ( 0.00%) FnPtr(f) => *f, . Error(_) => { . // ignore errors (#54954) . ty::Binder::dummy(FnSig::fake()) . } . Closure(..) => bug!( . "to get the signature of a closure, use `substs.as_closure().sig()` not `fn_sig()`", . ), . _ => bug!("Ty::fn_sig() called on non-fn type: {:?}", self), . } 402,354 ( 0.00%) } . . #[inline] . pub fn is_fn(&self) -> bool { 42,585 ( 0.00%) matches!(self.kind(), FnDef(..) | FnPtr(_)) . } . . #[inline] . pub fn is_fn_ptr(&self) -> bool { . matches!(self.kind(), FnPtr(_)) . } . . #[inline] . pub fn is_impl_trait(&self) -> bool { . matches!(self.kind(), Opaque(..)) . } . . #[inline] . pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> { 7,338 ( 0.00%) match self.kind() { . Adt(adt, _) => Some(adt), . _ => None, . } . } . . /// Iterates over tuple fields. . /// Panics when called on anything but a tuple. 1,791 ( 0.00%) pub fn tuple_fields(&self) -> impl DoubleEndedIterator> { 6,240 ( 0.00%) match self.kind() { 5,388 ( 0.00%) Tuple(substs) => substs.iter().map(|field| field.expect_ty()), . _ => bug!("tuple_fields called on non-tuple"), . } 3,582 ( 0.00%) } . . /// Get the `i`-th element of a tuple. . /// Panics when called on anything but a tuple. 66 ( 0.00%) pub fn tuple_element_ty(&self, i: usize) -> Option> { 132 ( 0.00%) match self.kind() { 132 ( 0.00%) Tuple(substs) => substs.iter().nth(i).map(|field| field.expect_ty()), . _ => bug!("tuple_fields called on non-tuple"), . } 132 ( 0.00%) } . . /// If the type contains variants, returns the valid range of variant indices. . // . // FIXME: This requires the optimized MIR in the case of generators. . #[inline] . pub fn variant_range(&self, tcx: TyCtxt<'tcx>) -> Option> { . match self.kind() { . TyKind::Adt(adt, _) => Some(adt.variant_range()), -- line 2068 ---------------------------------------- -- line 2073 ---------------------------------------- . } . } . . /// If the type contains variants, returns the variant for `variant_index`. . /// Panics if `variant_index` is out of range. . // . // FIXME: This requires the optimized MIR in the case of generators. . #[inline] 40,240 ( 0.00%) pub fn discriminant_for_variant( . &self, . tcx: TyCtxt<'tcx>, . variant_index: VariantIdx, . ) -> Option> { 35,571 ( 0.00%) match self.kind() { 14,252 ( 0.00%) TyKind::Adt(adt, _) if adt.variants.is_empty() => { . // This can actually happen during CTFE, see . // https://github.com/rust-lang/rust/issues/89765. . None . } 7,126 ( 0.00%) TyKind::Adt(adt, _) if adt.is_enum() => { . Some(adt.discriminant_for_variant(tcx, variant_index)) . } . TyKind::Generator(def_id, substs, _) => { . Some(substs.as_generator().discriminant_for_variant(*def_id, tcx, variant_index)) . } . _ => None, . } 32,192 ( 0.00%) } . . /// Returns the type of the discriminant of this type. 34,590 ( 0.00%) pub fn discriminant_ty(&'tcx self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { 17,295 ( 0.00%) match self.kind() { 27,672 ( 0.00%) ty::Adt(adt, _) if adt.is_enum() => adt.repr.discr_type().to_ty(tcx), . ty::Generator(_, substs, _) => substs.as_generator().discr_ty(tcx), . . ty::Param(_) | ty::Projection(_) | ty::Opaque(..) | ty::Infer(ty::TyVar(_)) => { . let assoc_items = tcx.associated_item_def_ids( . tcx.require_lang_item(hir::LangItem::DiscriminantKind, None), . ); . tcx.mk_projection(assoc_items[0], tcx.intern_substs(&[self.into()])) . } -- line 2113 ---------------------------------------- -- line 2135 ---------------------------------------- . | ty::Infer(IntVar(_) | FloatVar(_)) => tcx.types.u8, . . ty::Bound(..) . | ty::Placeholder(_) . | ty::Infer(FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => { . bug!("`discriminant_ty` applied to unexpected type: {:?}", self) . } . } 27,672 ( 0.00%) } . . /// Returns the type of metadata for (potentially fat) pointers to this type. 270 ( 0.00%) pub fn ptr_metadata_ty( . &'tcx self, . tcx: TyCtxt<'tcx>, . normalize: impl FnMut(Ty<'tcx>) -> Ty<'tcx>, . ) -> Ty<'tcx> { 270 ( 0.00%) let tail = tcx.struct_tail_with_normalize(self, normalize); 150 ( 0.00%) match tail.kind() { . // Sized types . ty::Infer(ty::IntVar(_) | ty::FloatVar(_)) . | ty::Uint(_) . | ty::Int(_) . | ty::Bool . | ty::Float(_) . | ty::FnDef(..) . | ty::FnPtr(_) -- line 2160 ---------------------------------------- -- line 2170 ---------------------------------------- . | ty::Foreign(..) . // If returned by `struct_tail_without_normalization` this is a unit struct . // without any fields, or not a struct, and therefore is Sized. . | ty::Adt(..) . // If returned by `struct_tail_without_normalization` this is the empty tuple, . // a.k.a. unit type, which is Sized . | ty::Tuple(..) => tcx.types.unit, . 60 ( 0.00%) ty::Str | ty::Slice(_) => tcx.types.usize, . ty::Dynamic(..) => { . let dyn_metadata = tcx.lang_items().dyn_metadata().unwrap(); . tcx.type_of(dyn_metadata).subst(tcx, &[tail.into()]) . }, . . ty::Projection(_) . | ty::Param(_) . | ty::Opaque(..) . | ty::Infer(ty::TyVar(_)) . | ty::Bound(..) . | ty::Placeholder(..) . | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => { . bug!("`ptr_metadata_ty` applied to unexpected type: {:?}", tail) . } . } 240 ( 0.00%) } . . /// When we create a closure, we record its kind (i.e., what trait . /// it implements) into its `ClosureSubsts` using a type . /// parameter. This is kind of a phantom type, except that the . /// most convenient thing for us to are the integral types. This . /// function converts such a special type into the closure . /// kind. To go the other way, use . /// `tcx.closure_kind_ty(closure_kind)`. . /// . /// Note that during type checking, we use an inference variable . /// to represent the closure kind, because it has not yet been . /// inferred. Once upvar inference (in `rustc_typeck/src/check/upvar.rs`) . /// is complete, that type variable will be unified. 5,662 ( 0.00%) pub fn to_opt_closure_kind(&self) -> Option { 11,324 ( 0.00%) match self.kind() { 9,792 ( 0.00%) Int(int_ty) => match int_ty { . ty::IntTy::I8 => Some(ty::ClosureKind::Fn), . ty::IntTy::I16 => Some(ty::ClosureKind::FnMut), . ty::IntTy::I32 => Some(ty::ClosureKind::FnOnce), . _ => bug!("cannot convert type `{:?}` to a closure kind", self), . }, . . // "Bound" types appear in canonical queries when the . // closure type is not yet known . Bound(..) | Infer(_) => None, . . Error(_) => Some(ty::ClosureKind::Fn), . . _ => bug!("cannot convert type `{:?}` to a closure kind", self), . } 5,662 ( 0.00%) } . . /// Fast path helper for testing if a type is `Sized`. . /// . /// Returning true means the type is known to be sized. Returning . /// `false` means nothing -- could be sized, might not be. . /// . /// Note that we could never rely on the fact that a type such as `[_]` is . /// trivially `!Sized` because we could be in a type environment with a . /// bound such as `[_]: Copy`. A function with such a bound obviously never . /// can be called, but that doesn't mean it shouldn't typecheck. This is why . /// this method doesn't return `Option`. 553,032 ( 0.00%) pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx>) -> bool { 368,688 ( 0.00%) match self.kind() { . ty::Infer(ty::IntVar(_) | ty::FloatVar(_)) . | ty::Uint(_) . | ty::Int(_) . | ty::Bool . | ty::Float(_) . | ty::FnDef(..) . | ty::FnPtr(_) . | ty::RawPtr(..) -- line 2246 ---------------------------------------- -- line 2250 ---------------------------------------- . | ty::GeneratorWitness(..) . | ty::Array(..) . | ty::Closure(..) . | ty::Never . | ty::Error(_) => true, . . ty::Str | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => false, . 5,208 ( 0.00%) ty::Tuple(tys) => tys.iter().all(|ty| ty.expect_ty().is_trivially_sized(tcx)), . 78,384 ( 0.00%) ty::Adt(def, _substs) => def.sized_constraint(tcx).is_empty(), . . ty::Projection(_) | ty::Param(_) | ty::Opaque(..) => false, . . ty::Infer(ty::TyVar(_)) => false, . . ty::Bound(..) . | ty::Placeholder(..) . | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => { . bug!("`is_trivially_sized` applied to unexpected type: {:?}", self) . } . } 553,032 ( 0.00%) } . } . . /// Extra information about why we ended up with a particular variance. . /// This is only used to add more information to error messages, and . /// has no effect on soundness. While choosing the 'wrong' `VarianceDiagInfo` . /// may lead to confusing notes in error messages, it will never cause . /// a miscompilation or unsoundness. . /// . /// When in doubt, use `VarianceDiagInfo::default()` 189 ( 0.00%) #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] . pub enum VarianceDiagInfo<'tcx> { . /// No additional information - this is the default. . /// We will not add any additional information to error messages. . #[default] . None, . /// We switched our variance because a generic argument occurs inside . /// the invariant generic argument of another type. . Invariant { -- line 2290 ---------------------------------------- -- line 2295 ---------------------------------------- . /// (e.g. `0` for `*mut T`, `1` for `MyStruct<'CovariantParam, 'InvariantParam>`) . param_index: u32, . }, . } . . impl<'tcx> VarianceDiagInfo<'tcx> { . /// Mirrors `Variance::xform` - used to 'combine' the existing . /// and new `VarianceDiagInfo`s when our variance changes. 69,966 ( 0.00%) pub fn xform(self, other: VarianceDiagInfo<'tcx>) -> VarianceDiagInfo<'tcx> { . // For now, just use the first `VarianceDiagInfo::Invariant` that we see 104,949 ( 0.00%) match self { . VarianceDiagInfo::None => other, . VarianceDiagInfo::Invariant { .. } => self, . } 34,983 ( 0.00%) } . } 33,575,052 ( 0.15%) -------------------------------------------------------------------------------- The following files chosen for auto-annotation could not be found: -------------------------------------------------------------------------------- ./elf/dl-lookup.c ./malloc/malloc.c ./nptl/pthread_rwlock_common.c ./stdlib/msort.c ./string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S ./string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S ./string/../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S ./string/../sysdeps/x86_64/multiarch/strcmp-avx2.S /tmp/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/../../../../gcc-5.5.0/libstdc++-v3/libsupc++/new_op.cc -------------------------------------------------------------------------------- Ir -------------------------------------------------------------------------------- 544,922,443 ( 2.49%) events annotated