diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-11 23:45:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-11 23:45:53 +0200 |
| commit | f94a325496a475ec866f41a8036d4a418832522c (patch) | |
| tree | 1cb8588faab2e5f11d7e29c0f9efc32acc4a0ac2 | |
| parent | 603da7e83fec2767a7bcebb2f5c1aaaa244087a3 (diff) | |
| parent | 148f456cc6fd12a19f45a75b1fd758605c657d0d (diff) | |
| download | rust-f94a325496a475ec866f41a8036d4a418832522c.tar.gz rust-f94a325496a475ec866f41a8036d4a418832522c.zip | |
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`.
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 4 | ||||
| -rw-r--r-- | library/core/src/marker.rs | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index a73d2285d45..1a8f863952e 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -704,7 +704,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { .filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok()) .collect(); - never_suggest_borrow.push(self.tcx.get_diagnostic_item(sym::Send).unwrap()); + if let Some(def_id) = self.tcx.get_diagnostic_item(sym::Send) { + never_suggest_borrow.push(def_id); + } let param_env = obligation.param_env; let trait_ref = poly_trait_ref.skip_binder(); diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 37446bafacb..e5c3fafe5f1 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -30,7 +30,8 @@ use crate::hash::Hasher; /// [arc]: ../../std/sync/struct.Arc.html /// [ub]: ../../reference/behavior-considered-undefined.html #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(not(test), rustc_diagnostic_item = "Send")] +#[cfg_attr(all(not(test), bootstrap), rustc_diagnostic_item = "send_trait")] +#[cfg_attr(all(not(test), not(bootstrap)), rustc_diagnostic_item = "Send")] #[rustc_on_unimplemented( message = "`{Self}` cannot be sent between threads safely", label = "`{Self}` cannot be sent between threads safely" |
