diff options
| author | Roxane Fruytier <roxane.fruytier@hotmail.com> | 2021-06-29 14:17:25 -0400 |
|---|---|---|
| committer | Roxane <roxane.fruytier@hotmail.com> | 2021-06-29 17:47:57 -0400 |
| commit | 06afafd492c151d0521240bbee94a595a4e006e5 (patch) | |
| tree | d333d7f7bf20a3dcb1c4d239700bf923c0412bd0 /compiler/rustc_trait_selection | |
| parent | 3e569dd2dff023378debce3b98e19bf3ef8c6904 (diff) | |
| download | rust-06afafd492c151d0521240bbee94a595a4e006e5.tar.gz rust-06afafd492c151d0521240bbee94a595a4e006e5.zip | |
Use diagnostic items to check for Send, UnwindSafe and RefUnwindSafe traits
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 6 |
1 files changed, 4 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 5c35b515f3d..13c14d26b70 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -690,12 +690,14 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // Blacklist traits for which it would be nonsensical to suggest borrowing. // For instance, immutable references are always Copy, so suggesting to // borrow would always succeed, but it's probably not what the user wanted. - let blacklist: Vec<_> = - [LangItem::Copy, LangItem::Clone, LangItem::Unpin, LangItem::Sized, LangItem::Send] + let mut blacklist: Vec<_> = + [LangItem::Copy, LangItem::Clone, LangItem::Unpin, LangItem::Sized] .iter() .filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok()) .collect(); + blacklist.push(self.tcx.get_diagnostic_item(sym::send_trait).unwrap()); + let span = obligation.cause.span; let param_env = obligation.param_env; let trait_ref = trait_ref.skip_binder(); |
