Skip to content

Commit 1ef6d93

Browse files
committed
Remove unnecessary note
1 parent 03e4700 commit 1ef6d93

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
@@ -769,6 +769,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
769769
)
770770
};
771771

772+
if self.suggest_add_reference_to_arg(
773+
&obligation,
774+
&mut err,
775+
&trait_ref,
776+
points_at_arg,
777+
) {
778+
self.note_obligation_cause(&mut err, obligation);
779+
err.emit();
780+
return;
781+
}
772782
if let Some(ref s) = label {
773783
// If it has a custom `#[rustc_on_unimplemented]`
774784
// error message, let's display it as the label!
@@ -785,16 +795,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
785795
self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err);
786796
self.suggest_fn_call(&obligation, &mut err, &trait_ref, points_at_arg);
787797
self.suggest_remove_reference(&obligation, &mut err, &trait_ref);
788-
if self.suggest_add_reference_to_arg(
789-
&obligation,
790-
&mut err,
791-
&trait_ref,
792-
points_at_arg,
793-
) {
794-
self.note_obligation_cause(&mut err, obligation);
795-
err.emit();
796-
return;
797-
}
798798
self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref);
799799

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

src/libsyntax_pos/lib.rs

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

738-
/// This should be *rarely* used. Remove all the labels in this `MultiSpan`.
739-
pub fn clear_span_labels(&mut self) {
740-
self.span_labels.clear();
741-
}
742-
743738
/// Returns the strings to highlight. We always ensure that there
744739
/// is an entry for each of the primary spans -- for each primary
745740
/// 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)