Rename variable

This commit is contained in:
Roxane 2021-06-29 20:26:37 -04:00
parent 06afafd492
commit cc3af7091c
2 changed files with 5 additions and 9 deletions

View file

@ -687,16 +687,16 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
return false; 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 // For instance, immutable references are always Copy, so suggesting to
// borrow would always succeed, but it's probably not what the user wanted. // borrow would always succeed, but it's probably not what the user wanted.
let mut blacklist: Vec<_> = let mut never_suggest_borrow: Vec<_> =
[LangItem::Copy, LangItem::Clone, LangItem::Unpin, LangItem::Sized] [LangItem::Copy, LangItem::Clone, LangItem::Unpin, LangItem::Sized]
.iter() .iter()
.filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok()) .filter_map(|lang_item| self.tcx.lang_items().require(*lang_item).ok())
.collect(); .collect();
blacklist.push(self.tcx.get_diagnostic_item(sym::send_trait).unwrap()); never_suggest_borrow.push(self.tcx.get_diagnostic_item(sym::send_trait).unwrap());
let span = obligation.cause.span; let span = obligation.cause.span;
let param_env = obligation.param_env; let param_env = obligation.param_env;
@ -799,7 +799,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
ty::TraitRef::new(trait_ref.def_id, imm_substs), ty::TraitRef::new(trait_ref.def_id, imm_substs),
trait_ref, trait_ref,
false, false,
&blacklist[..], &never_suggest_borrow[..],
) { ) {
return true; return true;
} else { } else {
@ -807,7 +807,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
ty::TraitRef::new(trait_ref.def_id, mut_substs), ty::TraitRef::new(trait_ref.def_id, mut_substs),
trait_ref, trait_ref,
true, true,
&blacklist[..], &never_suggest_borrow[..],
); );
} }
} else { } else {

View file

@ -31,10 +31,6 @@ use crate::hash::Hasher;
/// [ub]: ../../reference/behavior-considered-undefined.html /// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "send_trait")] #[cfg_attr(not(test), rustc_diagnostic_item = "send_trait")]
<<<<<<< HEAD
#[lang = "send"]
=======
>>>>>>> Remove lang items Send, UnwindSafe and RefUnwindSafe
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
message = "`{Self}` cannot be sent between threads safely", message = "`{Self}` cannot be sent between threads safely",
label = "`{Self}` cannot be sent between threads safely" label = "`{Self}` cannot be sent between threads safely"