Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --Minimal repro: This ICE needs a specific project setup with a that has a doc-comment referencing one of its crate dependencies. The git repo above is a full example, but this will work, too: The error only seems to happen with crates that do not contain hyphens in the name. I don't know, I haven't really dug into it. is a popular crate, it doesn't have any dependencies, and it exhibits the crash. The git repo above has a totally empty dependency named , so it doesn't really matter what the dependency itself contains. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
searched nightlies: from nightly-2024-02-08 to nightly-2024-02-09 regressed nightly: nightly-2024-02-09 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.7</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </detailsThis looks similar to
Fixed in
We're seeing this panic in our CI as well: I'm working on reproducing it.

Discussion:
pub fn maybe_process_path_extern(&mut self, name: Symbol) -> Option<CrateNum> { self.maybe_resolve_crate(name, CrateDepKind::Explicit, None).ok() } <del> pub fn unload_unused_crates(&mut self) { for opt_cdata in &mut self.cstore.metas { if let Some(cdata) = opt_cdata && !cdata.used() { *opt_cdata = None; } } } </del> } fn global_allocator_spans(krate: &ast::Crate) -> Vec<Span> {

tcx.untracked().cstore.freeze(); tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).iter_crate_data().map(|(cnum, _)| cnum)) }, <ins> used_crates: |tcx, ()| { // The list of loaded crates is now frozen in query cache, // so make sure cstore is not mutably accessed from here on. tcx.untracked().cstore.freeze(); tcx.arena.alloc_from_iter( CStore::from_tcx(tcx) .iter_crate_data() .filter_map(|(cnum, data)| data.used().then_some(cnum)), ) }, </ins> ..providers.queries }; provide_extern(&mut providers.extern_queries);

eval_always desc { "fetching all foreign CrateNum instances" } } <ins> // Crates that are loaded non-speculatively (not for diagnostics or doc links). // FIXME: This is currently only used for collecting lang items, but should be used instead of // `crates` in most other cases too. query used_crates(_: ()) -> &'tcx [CrateNum] { eval_always desc { "fetching `CrateNum`s for all crates loaded non-speculatively" } } </ins> /// A list of all traits in a crate, used by rustdoc and error reporting. query traits(_: CrateNum) -> &'tcx [DefId] {

let mut collector = LanguageItemCollector::new(tcx, resolver); // Collect lang items in other crates. <del> for &cnum in tcx.crates(()).iter() { </del> <ins> for &cnum in tcx.used_crates(()).iter() { </ins> for &(def_id, lang_item) in tcx.defined_lang_items(cnum).iter() { collector.collect_item(lang_item, def_id, None); }

use rustc_hir::def::{self, CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS}; use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE}; use rustc_hir::{PrimTy, TraitCandidate}; <del> use rustc_metadata::creader::CStore; </del> use rustc_middle::middle::resolve_bound_vars::Set1; use rustc_middle::{bug, span_bug}; use rustc_session::config::{CrateType, ResolveDocLinks};

// Encoding foreign def ids in proc macro crate metadata will ICE. return None; } <del> // Doc paths should be resolved speculatively and should not produce any // diagnostics, but if they are indeed resolved, then we need to keep the // corresponding crate alive. CStore::from_tcx_mut(self.r.tcx).set_used_recursively(def_id.krate); </del> } res });

self.tcx .sess .time("resolve_postprocess", || self.crate_loader(|c| c.postprocess(krate))); <del> self.crate_loader(|c| c.unload_unused_crates()); </del> }); // Make sure we don't mutate the cstore from here on.

error: extern location for std does not exist: <ins> error: `#[panic_handler]` function required, but not found error: unwinding panics are not supported without std | = help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding = note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem </ins> error: requires `sized` lang_item <del> error: aborting due to 2 previous errors </del> <ins> error: aborting due to 4 previous errors </ins>