diff options
| author | bors <bors@rust-lang.org> | 2021-07-08 17:51:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-08 17:51:10 +0000 |
| commit | aa65b08b1dbaf4b637847646801ebc8c01d7ecbd (patch) | |
| tree | 9828a028f1c2c73ed4f8c85959c7eebb747ecc48 /compiler/rustc_trait_selection/src | |
| parent | d0485c7986e0dac6ffd0207aba56467cb9378d85 (diff) | |
| parent | 60566820b3800036a00e2b7e5787b8c816dc2342 (diff) | |
Auto merge of #86982 - GuillaumeGomez:rollup-7sbye3c, r=GuillaumeGomez
Rollup of 8 pull requests Successful merges: - #84961 (Rework SESSION_GLOBALS API) - #86726 (Use diagnostic items instead of lang items for rfc2229 migrations) - #86789 (Update BTreeSet::drain_filter documentation) - #86838 (Checking that function is const if marked with rustc_const_unstable) - #86903 (Fix small headers display) - #86913 (Document rustdoc with `--document-private-items`) - #86957 (Update .mailmap file) - #86971 (mailmap: Add alternative addresses for myself) Failed merges: - #86869 (Account for capture kind in auto traits migration) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 12 |
1 files changed, 7 insertions, 5 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 cca40ff1ce6..26a5a65ed36 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -688,15 +688,17 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { return false; } - // Blacklist traits for which it would be nonsensical to suggest borrowing. + // List of 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 never_suggest_borrow: Vec<_> = + [LangItem::Copy, LangItem::Clone, LangItem::Unpin, LangItem::Sized] .iter() .filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok()) .collect(); + never_suggest_borrow.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(); @@ -798,7 +800,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { ty::TraitRef::new(trait_ref.def_id, imm_substs), trait_ref, false, - &blacklist[..], + &never_suggest_borrow[..], ) { return true; } else { @@ -806,7 +808,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { ty::TraitRef::new(trait_ref.def_id, mut_substs), trait_ref, true, - &blacklist[..], + &never_suggest_borrow[..], ); } } else { |
