Skip to content

Commit 0f7f234

Browse files
committed
Remove unnecessary note
1 parent 970503b commit 0f7f234

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

src/librustc/traits/error_reporting.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
771771
)
772772
};
773773

774+
if self.suggest_add_reference_to_arg(
775+
&obligation,
776+
&mut err,
777+
&trait_ref,
778+
points_at_arg,
779+
) {
780+
self.note_obligation_cause(&mut err, obligation);
781+
err.emit();
782+
return;
783+
}
774784
if let Some(ref s) = label {
775785
// If it has a custom `#[rustc_on_unimplemented]`
776786
// error message, let's display it as the label!
@@ -787,16 +797,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
787797
self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err);
788798
self.suggest_fn_call(&obligation, &mut err, &trait_ref, points_at_arg);
789799
self.suggest_remove_reference(&obligation, &mut err, &trait_ref);
790-
if self.suggest_add_reference_to_arg(
791-
&obligation,
792-
&mut err,
793-
&trait_ref,
794-
points_at_arg,
795-
) {
796-
self.note_obligation_cause(&mut err, obligation);
797-
err.emit();
798-
return;
799-
}
800800
self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref);
801801

802802
// Try to report a help message
@@ -1359,7 +1359,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13591359
// somewhere else in the obligation chain. Do not suggest non-sense.
13601360
return false;
13611361
}
1362-
err.span.clear_span_labels();
13631362
err.span_label(span, &format!(
13641363
"expected an implementor of trait `{}`",
13651364
obligation.parent_trait_ref.skip_binder(),

src/libsyntax_pos/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,6 @@ impl MultiSpan {
736736
replacements_occurred
737737
}
738738

739-
/// This should be *rarely* used. Remove all the labels in this `MultiSpan`.
740-
pub fn clear_span_labels(&mut self) {
741-
self.span_labels.clear();
742-
}
743-
744739
/// Returns the strings to highlight. We always ensure that there
745740
/// is an entry for each of the primary spans -- for each primary
746741
/// span `P`, if there is at least one label with span `P`, we return

src/test/ui/suggestions/issue-62843.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ LL | println!("{:?}", line.find(pattern));
77
| expected an implementor of trait `std::str::pattern::Pattern<'_>`
88
| help: consider borrowing here: `&pattern`
99
|
10-
= help: the trait `std::ops::FnMut<(char,)>` is not implemented for `std::string::String`
1110
= note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `std::string::String`
1211

1312
error: aborting due to previous error

src/test/ui/traits/traits-negative-impls.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ LL | is_send(Box::new(TestType));
5555
| expected an implementor of trait `std::marker::Send`
5656
| help: consider borrowing here: `&Box::new(TestType)`
5757
|
58-
= help: the trait `std::marker::Send` is not implemented for `dummy2::TestType`
5958
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<dummy2::TestType>`
6059
= note: required because it appears within the type `std::boxed::Box<dummy2::TestType>`
6160

@@ -85,7 +84,6 @@ LL | is_sync(Outer2(TestType));
8584
| expected an implementor of trait `std::marker::Sync`
8685
| help: consider borrowing here: `&Outer2(TestType)`
8786
|
88-
= help: the trait `std::marker::Send` is not implemented for `main::TestType`
8987
= note: required because of the requirements on the impl of `std::marker::Sync` for `Outer2<main::TestType>`
9088

9189
error: aborting due to 7 previous errors

0 commit comments

Comments
 (0)