Skip to content

Commit f94a325

Browse files
authored
Rollup merge of #89785 - nbdd0121:master, r=Mark-Simulacrum
Fix ICE when compiling nightly std/rustc on beta compiler Fix #89775 #89479 renames a lot of diagnostic items, but it happens that the beta compiler assumes that there must be DefId with `rustc_diagnostic_item = "send_trait"`, causing an ICE when compiling stage 0 std or stage 1 compiler. So gate it with `cfg(bootstrap)`. The unwrap is also removed, so that existence of the diagnostic item is not required. I ripgreped the code base and this seems the only place where `unwrap` is called on the return value of `get_diagnostic_item`.
2 parents 603da7e + 148f456 commit f94a325

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
704704
.filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok())
705705
.collect();
706706

707-
never_suggest_borrow.push(self.tcx.get_diagnostic_item(sym::Send).unwrap());
707+
if let Some(def_id) = self.tcx.get_diagnostic_item(sym::Send) {
708+
never_suggest_borrow.push(def_id);
709+
}
708710

709711
let param_env = obligation.param_env;
710712
let trait_ref = poly_trait_ref.skip_binder();

library/core/src/marker.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ use crate::hash::Hasher;
3030
/// [arc]: ../../std/sync/struct.Arc.html
3131
/// [ub]: ../../reference/behavior-considered-undefined.html
3232
#[stable(feature = "rust1", since = "1.0.0")]
33-
#[cfg_attr(not(test), rustc_diagnostic_item = "Send")]
33+
#[cfg_attr(all(not(test), bootstrap), rustc_diagnostic_item = "send_trait")]
34+
#[cfg_attr(all(not(test), not(bootstrap)), rustc_diagnostic_item = "Send")]
3435
#[rustc_on_unimplemented(
3536
message = "`{Self}` cannot be sent between threads safely",
3637
label = "`{Self}` cannot be sent between threads safely"

0 commit comments

Comments
 (0)