Remove unnecessary note

This commit is contained in:
Esteban Küber 2019-10-15 20:35:54 -07:00
parent 970503b2e1
commit 0f7f2346a6
4 changed files with 10 additions and 19 deletions

View file

@ -771,6 +771,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
)
};
if self.suggest_add_reference_to_arg(
&obligation,
&mut err,
&trait_ref,
points_at_arg,
) {
self.note_obligation_cause(&mut err, obligation);
err.emit();
return;
}
if let Some(ref s) = label {
// If it has a custom `#[rustc_on_unimplemented]`
// error message, let's display it as the label!
@ -787,16 +797,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err);
self.suggest_fn_call(&obligation, &mut err, &trait_ref, points_at_arg);
self.suggest_remove_reference(&obligation, &mut err, &trait_ref);
if self.suggest_add_reference_to_arg(
&obligation,
&mut err,
&trait_ref,
points_at_arg,
) {
self.note_obligation_cause(&mut err, obligation);
err.emit();
return;
}
self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref);
// Try to report a help message
@ -1359,7 +1359,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// somewhere else in the obligation chain. Do not suggest non-sense.
return false;
}
err.span.clear_span_labels();
err.span_label(span, &format!(
"expected an implementor of trait `{}`",
obligation.parent_trait_ref.skip_binder(),

View file

@ -736,11 +736,6 @@ impl MultiSpan {
replacements_occurred
}
/// This should be *rarely* used. Remove all the labels in this `MultiSpan`.
pub fn clear_span_labels(&mut self) {
self.span_labels.clear();
}
/// Returns the strings to highlight. We always ensure that there
/// is an entry for each of the primary spans -- for each primary
/// span `P`, if there is at least one label with span `P`, we return

View file

@ -7,7 +7,6 @@ LL | println!("{:?}", line.find(pattern));
| expected an implementor of trait `std::str::pattern::Pattern<'_>`
| help: consider borrowing here: `&pattern`
|
= help: the trait `std::ops::FnMut<(char,)>` is not implemented for `std::string::String`
= note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `std::string::String`
error: aborting due to previous error

View file

@ -55,7 +55,6 @@ LL | is_send(Box::new(TestType));
| expected an implementor of trait `std::marker::Send`
| help: consider borrowing here: `&Box::new(TestType)`
|
= help: the trait `std::marker::Send` is not implemented for `dummy2::TestType`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<dummy2::TestType>`
= note: required because it appears within the type `std::boxed::Box<dummy2::TestType>`
@ -85,7 +84,6 @@ LL | is_sync(Outer2(TestType));
| expected an implementor of trait `std::marker::Sync`
| help: consider borrowing here: `&Outer2(TestType)`
|
= help: the trait `std::marker::Send` is not implemented for `main::TestType`
= note: required because of the requirements on the impl of `std::marker::Sync` for `Outer2<main::TestType>`
error: aborting due to 7 previous errors